Public Member Functions | Private Attributes | Friends
linearForm Class Reference

#include <npolygon.h>

Public Member Functions

 linearForm ()
 
 linearForm (const linearForm &)
 
 ~linearForm ()
 
linearFormoperator= (const linearForm &)
 
void copy_new (int)
 
void copy_delete (void)
 
void copy_zero (void)
 
void copy_shallow (linearForm &)
 
void copy_deep (const linearForm &)
 
Rational weight (poly, const ring r) const
 
Rational weight_shift (poly, const ring r) const
 
Rational weight1 (poly, const ring r) const
 
Rational weight_shift1 (poly, const ring r) const
 
Rational pweight (poly, const ring r) const
 
int positive (void)
 

Private Attributes

Rationalc
 
int N
 

Friends

class newtonPolygon
 
int operator== (const linearForm &, const linearForm &)
 

Detailed Description

Definition at line 17 of file npolygon.h.

Constructor & Destructor Documentation

◆ linearForm() [1/2]

linearForm::linearForm ( )
inline

Definition at line 130 of file npolygon.h.

131 {
132  copy_zero( );
133 }
void copy_zero(void)
Definition: npolygon.h:109

◆ linearForm() [2/2]

linearForm::linearForm ( const linearForm l)

Definition at line 108 of file npolygon.cc.

109 {
110  copy_deep( l );
111 }
void copy_deep(const linearForm &)
Definition: npolygon.cc:94
int l
Definition: cfEzgcd.cc:94

◆ ~linearForm()

linearForm::~linearForm ( )

Definition at line 117 of file npolygon.cc.

118 {
119  copy_delete( );
120 }
void copy_delete(void)
Definition: npolygon.cc:83

Member Function Documentation

◆ copy_deep()

void linearForm::copy_deep ( const linearForm l)

Definition at line 94 of file npolygon.cc.

95 {
96  copy_new( l.N );
97  for( int i=l.N-1; i>=0; i-- )
98  {
99  c[i] = l.c[i];
100  }
101  N = l.N;
102 }
Rational * c
Definition: npolygon.h:22
int i
Definition: cfEzgcd.cc:123
int l
Definition: cfEzgcd.cc:94
void copy_new(int)
Definition: npolygon.cc:37

◆ copy_delete()

void linearForm::copy_delete ( void  )

Definition at line 83 of file npolygon.cc.

84 {
85  if( c != (Rational*)NULL && N > 0 )
86  delete [] c;
87  copy_zero( );
88 }
void copy_zero(void)
Definition: npolygon.h:109
Rational * c
Definition: npolygon.h:22
#define NULL
Definition: omList.c:10

◆ copy_new()

void linearForm::copy_new ( int  k)

Definition at line 37 of file npolygon.cc.

38 {
39  if( k > 0 )
40  {
41  c = new Rational[k];
42 
43  #ifndef NBDEBUG
44  if( c == (Rational*)NULL )
45  {
46  #ifdef NPOLYGON_PRINT
47  #ifdef NPOLYGON_IOSTREAM
48  cerr <<
49  "void linearForm::copy_new( int k ): no memory left ...\n" ;
50  #else
51  fprintf( stderr,
52  "void linearForm::copy_new( int k ): no memory left ...\n");
53  #endif
54  #endif
55  HALT();
56  }
57  #endif
58  }
59  else if( k == 0 )
60  {
61  c = (Rational*)NULL;
62  }
63  else if( k < 0 )
64  {
65  #ifdef NPOLYGON_PRINT
66  #ifdef NPOLYGON_IOSTREAM
67  cerr <<
68  "void linearForm::copy_new( int k ): k < 0 ...\n";
69  #else
70  fprintf( stderr,
71  "void linearForm::copy_new( int k ): k < 0 ...\n" );
72  #endif
73  #endif
74 
75  HALT();
76  }
77 }
int k
Definition: cfEzgcd.cc:93
Rational * c
Definition: npolygon.h:22
#define HALT()
Definition: mod2.h:117
#define NULL
Definition: omList.c:10

◆ copy_shallow()

void linearForm::copy_shallow ( linearForm l)
inline

Definition at line 119 of file npolygon.h.

120 {
121  c = l.c;
122  N = l.N;
123 }
Rational * c
Definition: npolygon.h:22
int l
Definition: cfEzgcd.cc:94

◆ copy_zero()

void linearForm::copy_zero ( void  )
inline

Definition at line 109 of file npolygon.h.

110 {
111  c = (Rational*)NULL;
112  N = 0;
113 }
Rational * c
Definition: npolygon.h:22
#define NULL
Definition: omList.c:10

◆ operator=()

linearForm & linearForm::operator= ( const linearForm l)

Definition at line 126 of file npolygon.cc.

127 {
128  copy_delete( );
129  copy_deep( l );
130 
131  return *this;
132 }
void copy_deep(const linearForm &)
Definition: npolygon.cc:94
void copy_delete(void)
Definition: npolygon.cc:83
int l
Definition: cfEzgcd.cc:94

◆ positive()

int linearForm::positive ( void  )

Definition at line 280 of file npolygon.cc.

281 {
282  for( int i=0; i<N; i++ )
283  {
284  if( c[i] <= (Rational)0 )
285  {
286  return FALSE;
287  }
288  }
289  return TRUE;
290 }
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
Rational * c
Definition: npolygon.h:22
int i
Definition: cfEzgcd.cc:123

◆ pweight()

Rational linearForm::pweight ( poly  m,
const ring  r 
) const

Definition at line 206 of file npolygon.cc.

207 {
208  if( m==(poly)NULL )
209  return (Rational)0;
210 
211  Rational ret = weight( m, r );
212  Rational tmp;
213 
214  for( m=pNext(m); m!=(poly)NULL; pIter(m) )
215  {
216  tmp = weight( m, r );
217  if( tmp<ret )
218  {
219  ret = tmp;
220  }
221  }
222 
223  return ret;
224 }
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
Rational weight(poly, const ring r) const
Definition: npolygon.cc:190
int m
Definition: cfEzgcd.cc:119
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10

◆ weight()

Rational linearForm::weight ( poly  m,
const ring  r 
) const

Definition at line 190 of file npolygon.cc.

191 {
192  Rational ret=(Rational)0;
193 
194  for( int i=0,j=1; i<N; i++,j++ )
195  {
196  ret += c[i]*(Rational)p_GetExp( m,j,r );
197  }
198 
199  return ret;
200 }
Rational * c
Definition: npolygon.h:22
const ring r
Definition: syzextra.cc:208
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
int j
Definition: myNF.cc:70
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123

◆ weight1()

Rational linearForm::weight1 ( poly  m,
const ring  r 
) const

Definition at line 246 of file npolygon.cc.

247 {
248  Rational ret=(Rational)0;
249 
250  for( int i=0,j=2; i<N; i++,j++ )
251  {
252  ret += c[i]*(Rational)p_GetExp( m,j,r );
253  }
254 
255  return ret;
256 }
Rational * c
Definition: npolygon.h:22
const ring r
Definition: syzextra.cc:208
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
int j
Definition: myNF.cc:70
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123

◆ weight_shift()

Rational linearForm::weight_shift ( poly  m,
const ring  r 
) const

Definition at line 230 of file npolygon.cc.

231 {
232  Rational ret=(Rational)0;
233 
234  for( int i=0,j=1; i<N; i++,j++ )
235  {
236  ret += c[i]*(Rational)( p_GetExp( m,j,r ) + 1 );
237  }
238 
239  return ret;
240 }
Rational * c
Definition: npolygon.h:22
const ring r
Definition: syzextra.cc:208
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
int j
Definition: myNF.cc:70
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123

◆ weight_shift1()

Rational linearForm::weight_shift1 ( poly  m,
const ring  r 
) const

Definition at line 263 of file npolygon.cc.

264 {
265  Rational ret=(Rational)0;
266 
267  for( int i=0,j=2; i<N; i++,j++ )
268  {
269  ret += c[i]*(Rational)( p_GetExp( m,j,r ) + 1 );
270  }
271 
272  return ret;
273 }
Rational * c
Definition: npolygon.h:22
const ring r
Definition: syzextra.cc:208
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
int j
Definition: myNF.cc:70
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123

Friends And Related Function Documentation

◆ newtonPolygon

friend class newtonPolygon
friend

Definition at line 54 of file npolygon.h.

◆ operator==

int operator== ( const linearForm l1,
const linearForm l2 
)
friend

Definition at line 173 of file npolygon.cc.

174 {
175  if( l1.N!=l2.N )
176  return FALSE;
177  for( int i=l1.N-1; i >=0 ; i-- )
178  {
179  if( l1.c[i]!=l2.c[i] )
180  return FALSE;
181  }
182  return TRUE;
183 }
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
Rational * c
Definition: npolygon.h:22
int i
Definition: cfEzgcd.cc:123

Field Documentation

◆ c

Rational* linearForm::c
private

Definition at line 22 of file npolygon.h.

◆ N

int linearForm::N
private

Definition at line 23 of file npolygon.h.


The documentation for this class was generated from the following files: