My Project
Loading...
Searching...
No Matches
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 107 of file npolygon.cc.

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

◆ ~linearForm()

linearForm::~linearForm ( )

Definition at line 116 of file npolygon.cc.

117{
118 copy_delete( );
119}
void copy_delete(void)
Definition: npolygon.cc:82

Member Function Documentation

◆ copy_deep()

void linearForm::copy_deep ( const linearForm l)

Definition at line 93 of file npolygon.cc.

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

◆ copy_delete()

void linearForm::copy_delete ( void  )

Definition at line 82 of file npolygon.cc.

83{
84 if( c != (Rational*)NULL && N > 0 )
85 delete [] c;
86 copy_zero( );
87}
#define NULL
Definition: omList.c:12

◆ copy_new()

void linearForm::copy_new ( int  k)

Definition at line 36 of file npolygon.cc.

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

◆ 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}

◆ 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}

◆ operator=()

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

Definition at line 125 of file npolygon.cc.

126{
127 copy_delete( );
128 copy_deep( l );
129
130 return *this;
131}

◆ positive()

int linearForm::positive ( void  )

Definition at line 279 of file npolygon.cc.

280{
281 for( int i=0; i<N; i++ )
282 {
283 if( c[i] <= (Rational)0 )
284 {
285 return FALSE;
286 }
287 }
288 return TRUE;
289}
#define TRUE
Definition: auxiliary.h:100
#define FALSE
Definition: auxiliary.h:96

◆ pweight()

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

Definition at line 205 of file npolygon.cc.

206{
207 if( m==(poly)NULL )
208 return (Rational)0;
209
210 Rational ret = weight( m, r );
211 Rational tmp;
212
213 for( m=pNext(m); m!=(poly)NULL; pIter(m) )
214 {
215 tmp = weight( m, r );
216 if( tmp<ret )
217 {
218 ret = tmp;
219 }
220 }
221
222 return ret;
223}
int m
Definition: cfEzgcd.cc:128
Rational weight(poly, const ring r) const
Definition: npolygon.cc:189
#define pIter(p)
Definition: monomials.h:37
#define pNext(p)
Definition: monomials.h:36

◆ weight()

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

Definition at line 189 of file npolygon.cc.

190{
191 Rational ret=(Rational)0;
192
193 for( int i=0,j=1; i<N; i++,j++ )
194 {
195 ret += c[i]*(Rational)p_GetExp( m,j,r );
196 }
197
198 return ret;
199}
int j
Definition: facHensel.cc:110
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:467

◆ weight1()

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

Definition at line 245 of file npolygon.cc.

246{
247 Rational ret=(Rational)0;
248
249 for( int i=0,j=2; i<N; i++,j++ )
250 {
251 ret += c[i]*(Rational)p_GetExp( m,j,r );
252 }
253
254 return ret;
255}

◆ weight_shift()

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

Definition at line 229 of file npolygon.cc.

230{
231 Rational ret=(Rational)0;
232
233 for( int i=0,j=1; i<N; i++,j++ )
234 {
235 ret += c[i]*(Rational)( p_GetExp( m,j,r ) + 1 );
236 }
237
238 return ret;
239}

◆ weight_shift1()

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

Definition at line 262 of file npolygon.cc.

263{
264 Rational ret=(Rational)0;
265
266 for( int i=0,j=2; i<N; i++,j++ )
267 {
268 ret += c[i]*(Rational)( p_GetExp( m,j,r ) + 1 );
269 }
270
271 return ret;
272}

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 172 of file npolygon.cc.

173{
174 if( l1.N!=l2.N )
175 return FALSE;
176 for( int i=l1.N-1; i >=0 ; i-- )
177 {
178 if( l1.c[i]!=l2.c[i] )
179 return FALSE;
180 }
181 return TRUE;
182}

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: