My Project
Loading...
Searching...
No Matches
Public Member Functions | Data Fields
spectrumPolyList Class Reference

#include <splist.h>

Public Member Functions

 spectrumPolyList ()
 
 spectrumPolyList (newtonPolygon *)
 
 ~spectrumPolyList ()
 
void copy_zero (void)
 
void copy_shallow (spectrumPolyNode *, int, newtonPolygon *)
 
void copy_shallow (spectrumPolyList &)
 
void insert_node (poly, poly, const ring)
 
void delete_node (spectrumPolyNode **)
 
void delete_monomial (poly, const ring)
 

Data Fields

spectrumPolyNoderoot
 
int N
 
newtonPolygonnp
 

Detailed Description

Definition at line 56 of file splist.h.

Constructor & Destructor Documentation

◆ spectrumPolyList() [1/2]

spectrumPolyList::spectrumPolyList ( )

Definition at line 146 of file splist.cc.

147{
148 copy_zero( );
149}
void copy_zero(void)
Definition: splist.cc:114

◆ spectrumPolyList() [2/2]

spectrumPolyList::spectrumPolyList ( newtonPolygon npolygon)

Definition at line 155 of file splist.cc.

156{
157 copy_shallow( (spectrumPolyNode*)NULL,0,npolygon );
158}
void copy_shallow(spectrumPolyNode *, int, newtonPolygon *)
Definition: splist.cc:125
#define NULL
Definition: omList.c:12

◆ ~spectrumPolyList()

spectrumPolyList::~spectrumPolyList ( )

Definition at line 164 of file splist.cc.

165{
166 spectrumPolyNode *node;
167
168 while( root!=(spectrumPolyNode*)NULL )
169 {
170 node = root->next;
171 delete root;
172 root = node;
173 }
174
175 copy_zero( );
176}
spectrumPolyNode * root
Definition: splist.h:60
spectrumPolyNode * next
Definition: splist.h:39

Member Function Documentation

◆ copy_shallow() [1/2]

void spectrumPolyList::copy_shallow ( spectrumPolyList splist)

Definition at line 137 of file splist.cc.

138{
139 copy_shallow( splist.root,splist.N,splist.np );
140}
newtonPolygon * np
Definition: splist.h:62

◆ copy_shallow() [2/2]

void spectrumPolyList::copy_shallow ( spectrumPolyNode node,
int  k,
newtonPolygon npolygon 
)

Definition at line 125 of file splist.cc.

127{
128 root = node;
129 N = k;
130 np = npolygon;
131}
int k
Definition: cfEzgcd.cc:99

◆ copy_zero()

void spectrumPolyList::copy_zero ( void  )

Definition at line 114 of file splist.cc.

115{
117 N = 0;
119}

◆ delete_monomial()

void spectrumPolyList::delete_monomial ( poly  m,
const ring  R 
)

Definition at line 269 of file splist.cc.

270{
271 spectrumPolyNode **node = &root;
272 poly *f;
273
274 m = p_Copy( m,R );
275
276 while( *node!=(spectrumPolyNode*)NULL )
277 {
278 if( p_Cmp( m,(*node)->mon,R )>=0 && p_LmDivisibleByNoComp( m,(*node)->mon, R ))
279 {
280 delete_node( node );
281 }
282 else if( (*node)->nf!=NULL )
283 {
284 f = &((*node)->nf);
285
286 while( *f!=NULL )
287 {
288 if( p_Cmp( m,*f,R )>=0 && p_LmDivisibleByNoComp( m,*f,R ) )
289 {
290 p_LmDelete(f,R);
291 }
292 else
293 {
294 f = &(pNext( *f ));
295 }
296 }
297
298 if( (*node)->nf==NULL )
299 {
300 delete_node( node );
301 }
302 else
303 {
304 node = &((*node)->next);
305 }
306 }
307 else
308 {
309 node = &((*node)->next);
310 }
311 }
312 p_Delete( &m,R );
313}
int m
Definition: cfEzgcd.cc:128
FILE * f
Definition: checklibs.c:9
void delete_node(spectrumPolyNode **)
Definition: splist.cc:256
#define pNext(p)
Definition: monomials.h:36
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:721
static int p_Cmp(poly p1, poly p2, ring r)
Definition: p_polys.h:1725
static BOOLEAN p_LmDivisibleByNoComp(poly a, poly b, const ring r)
Definition: p_polys.h:1875
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:899
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:844
#define R
Definition: sirandom.c:27

◆ delete_node()

void spectrumPolyList::delete_node ( spectrumPolyNode **  node)

Definition at line 256 of file splist.cc.

257{
258 spectrumPolyNode *foo = *node;
259 *node = (*node)->next;
260 delete foo;
261 N--;
262}
object foo()
Definition: playground.cc:12

◆ insert_node()

void spectrumPolyList::insert_node ( poly  m,
poly  f,
const ring  R 
)

Definition at line 184 of file splist.cc.

185{
186 #ifdef SPLIST_DEBUG
187 if( np==(newtonPolygon*)NULL )
188 {
189 #ifdef SPLIST_PRINT
190 #ifdef SPLIST_IOSTREAM
191 cerr << "void spectrumPolyList::insert_node( poly f )" << endl;
192 cerr << " no Newton polygon" << endl;
193 cerr << " exiting..." << endl;
194 #else
195 fprintf( stderr,"void spectrumPolyList::insert_node( poly f )\n" );
196 fprintf( stderr," no Newton polygon\n" );
197 fprintf( stderr," exiting...\n" );
198 #endif
199 #endif
200
201 exit( 1 );
202 }
203 #endif
204
205 spectrumPolyNode *newnode = new spectrumPolyNode(
207
208 if( N==0 ||
209 root->weight>newnode->weight ||
210 ( root->weight==newnode->weight &&
211 p_Cmp( root->mon,newnode->mon,R )<0 ) )
212 {
213 // ----------------------
214 // insert at position 0
215 // ----------------------
216
217 newnode->next = root;
218 root = newnode;
219 }
220 else if( N==1 )
221 {
222 // ---------------
223 // insert at end
224 // ---------------
225
226 root->next = newnode;
227 }
228 else
229 {
230 // ----------------------------
231 // insert according to weight
232 // ----------------------------
233
234 spectrumPolyNode *actual = root;
236
237 while( next!=(spectrumPolyNode*)NULL &&
238 ( newnode->weight>next->weight ||
239 ( newnode->weight==next->weight &&
240 p_Cmp( newnode->mon,next->mon, R )<0 ) ) )
241 {
242 actual = next;
243 next = next->next;
244 }
245
246 actual->next = newnode;
247 newnode->next = next;
248 }
249 N++;
250}
Rational weight_shift(poly, const ring r) const
Definition: npolygon.cc:585
Rational weight
Definition: splist.h:41
ListNode * next
Definition: janet.h:31

Field Documentation

◆ N

int spectrumPolyList::N

Definition at line 61 of file splist.h.

◆ np

newtonPolygon* spectrumPolyList::np

Definition at line 62 of file splist.h.

◆ root

spectrumPolyNode* spectrumPolyList::root

Definition at line 60 of file splist.h.


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