My Project
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes
CFIterator Class Reference

class to iterate through CanonicalForm's More...

#include <cf_iter.h>

Public Member Functions

 CFIterator ()
 
 CFIterator (const CFIterator &)
 
 CFIterator (const CanonicalForm &)
 
 CFIterator (const CanonicalForm &, const Variable &)
 
 ~CFIterator ()
 
CFIteratoroperator= (const CFIterator &)
 
CFIteratoroperator= (const CanonicalForm &)
 
CF_NO_INLINE CFIteratoroperator++ ()
 
CF_NO_INLINE CFIteratoroperator++ (int)
 
CF_NO_INLINE int hasTerms () const
 check if iterator has reached the end of CanonicalForm More...
 
CF_NO_INLINE CanonicalForm coeff () const
 get the current coefficient More...
 
CF_NO_INLINE int exp () const
 get the current exponent More...
 

Private Attributes

CanonicalForm data
 
termList cursor
 
bool ispoly
 
bool hasterms
 

Detailed Description

class to iterate through CanonicalForm's

Note
a (multivariate) polynomial is viewed as a univariate poly in its main variable

Definition at line 44 of file cf_iter.h.

Constructor & Destructor Documentation

◆ CFIterator() [1/4]

CFIterator::CFIterator ( )

Definition at line 15 of file cf_iter.cc.

16{
17 data = 0; cursor = 0;
18 ispoly = false; hasterms = false;
19}
bool ispoly
Definition: cf_iter.h:48
CanonicalForm data
Definition: cf_iter.h:46
termList cursor
Definition: cf_iter.h:47
bool hasterms
Definition: cf_iter.h:48

◆ CFIterator() [2/4]

CFIterator::CFIterator ( const CFIterator i)

Definition at line 21 of file cf_iter.cc.

22{
23 data = i.data;
24 cursor = i.cursor;
25 ispoly = i.ispoly;
26 hasterms = i.hasterms;
27}
int i
Definition: cfEzgcd.cc:132

◆ CFIterator() [3/4]

CFIterator::CFIterator ( const CanonicalForm f)

Definition at line 29 of file cf_iter.cc.

30{
31 if ( f.inBaseDomain() || f.inQuotDomain() )
32 {
33 data = f; cursor = 0;
34 ispoly = false; hasterms = true;
35 }
36 else
37 {
38 data = f;
39 cursor = ((InternalPoly*)(f.value))->firstTerm;
40 ispoly = true; hasterms = true;
41 }
42}
FILE * f
Definition: checklibs.c:9
factory's class for polynomials
Definition: int_poly.h:71

◆ CFIterator() [4/4]

CFIterator::CFIterator ( const CanonicalForm f,
const Variable v 
)

Definition at line 44 of file cf_iter.cc.

45{
46 ASSERT( !f.inQuotDomain(), "illegal iterator" );
47 ASSERT( v.level() > 0, "illegal iterator" );
48 if ( f.inBaseDomain() )
49 {
50 data = f; cursor = 0;
51 ispoly = false; hasterms = true;
52 }
53 else
54 {
55 if ( f.mvar() == v )
56 {
57 data = f;
58 cursor = ((InternalPoly*)(f.value))->firstTerm;
59 ispoly = true; hasterms = true;
60 }
61 else if ( v > f.mvar() )
62 {
63 data = f; cursor = 0;
64 ispoly = false; hasterms = true;
65 }
66 else
67 {
68 data = swapvar( f, v, f.mvar().next() );
69 if ( data.mvar() == f.mvar().next() )
70 {
71 cursor = ((InternalPoly*)(data.value))->firstTerm;
72 ispoly = true; hasterms = true;
73 }
74 else
75 {
76 cursor = 0;
77 ispoly = false; hasterms = true;
78 }
79 }
80 }
81}
CanonicalForm FACTORY_PUBLIC swapvar(const CanonicalForm &, const Variable &, const Variable &)
swapvar() - swap variables x1 and x2 in f.
Definition: cf_ops.cc:168
#define ASSERT(expression, message)
Definition: cf_assert.h:99
InternalCF * value
Definition: canonicalform.h:88
Variable mvar() const
mvar() returns the main variable of CO or Variable() if CO is in a base domain.
int level() const
Definition: variable.h:49
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:39

◆ ~CFIterator()

CFIterator::~CFIterator ( )

Definition at line 83 of file cf_iter.cc.

84{
85 data = 0; cursor = 0;
86}

Member Function Documentation

◆ coeff()

CF_NO_INLINE CanonicalForm CFIterator::coeff ( ) const

get the current coefficient

◆ exp()

CF_NO_INLINE int CFIterator::exp ( ) const

get the current exponent

◆ hasTerms()

CF_NO_INLINE int CFIterator::hasTerms ( ) const

check if iterator has reached the end of CanonicalForm

◆ operator++() [1/2]

CF_NO_INLINE CFIterator & CFIterator::operator++ ( )

◆ operator++() [2/2]

CF_NO_INLINE CFIterator & CFIterator::operator++ ( int  )

◆ operator=() [1/2]

CFIterator & CFIterator::operator= ( const CanonicalForm f)

Definition at line 102 of file cf_iter.cc.

103{
104 if ( f.inBaseDomain() || f.inQuotDomain() )
105 {
106 data = f; cursor = 0;
107 ispoly = false; hasterms = true;
108 }
109 else
110 {
111 data = f;
112 cursor = ((InternalPoly*)(f.value))->firstTerm;
113 ispoly = true; hasterms = true;
114 }
115 return *this;
116}

◆ operator=() [2/2]

CFIterator & CFIterator::operator= ( const CFIterator i)

Definition at line 89 of file cf_iter.cc.

90{
91 if ( this != &i )
92 {
93 data = i.data;
94 cursor = i.cursor;
95 ispoly = i.ispoly;
96 hasterms = i.hasterms;
97 }
98 return *this;
99}

Field Documentation

◆ cursor

termList CFIterator::cursor
private

Definition at line 47 of file cf_iter.h.

◆ data

CanonicalForm CFIterator::data
private

Definition at line 46 of file cf_iter.h.

◆ hasterms

bool CFIterator::hasterms
private

Definition at line 48 of file cf_iter.h.

◆ ispoly

bool CFIterator::ispoly
private

Definition at line 48 of file cf_iter.h.


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