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++ ()
 CFIterator::operator ++ (), operator ++ ( int ) More...
 
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...
 
 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...
 
 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/12]

CFIterator::CFIterator ( )

Definition at line 15 of file cf_iter.cc.

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

§ CFIterator() [2/12]

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 }
termList cursor
Definition: cf_iter.h:47
bool ispoly
Definition: cf_iter.h:48
bool hasterms
Definition: cf_iter.h:48
CanonicalForm data
Definition: cf_iter.h:46

§ CFIterator() [3/12]

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 }
termList cursor
Definition: cf_iter.h:47
f
Definition: cfModGcd.cc:4022
bool ispoly
Definition: cf_iter.h:48
bool inBaseDomain() const
bool inQuotDomain() const
factory&#39;s class for polynomials
Definition: int_poly.h:71
InternalCF * value
Definition: canonicalform.h:81
bool hasterms
Definition: cf_iter.h:48
CanonicalForm data
Definition: cf_iter.h:46

§ CFIterator() [4/12]

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 }
termList cursor
Definition: cf_iter.h:47
f
Definition: cfModGcd.cc:4022
bool ispoly
Definition: cf_iter.h:48
CanonicalForm swapvar(const CanonicalForm &, const Variable &, const Variable &)
swapvar() - swap variables x1 and x2 in f.
Definition: cf_ops.cc:168
bool inBaseDomain() const
int level() const
Definition: factory.h:132
bool inQuotDomain() const
factory&#39;s class for polynomials
Definition: int_poly.h:71
Variable next() const
Definition: factory.h:135
Variable mvar() const
mvar() returns the main variable of CO or Variable() if CO is in a base domain.
InternalCF * value
Definition: canonicalform.h:81
bool hasterms
Definition: cf_iter.h:48
CanonicalForm data
Definition: cf_iter.h:46
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define ASSERT(expression, message)
Definition: cf_assert.h:99

§ ~CFIterator() [1/3]

CFIterator::~CFIterator ( )

Definition at line 83 of file cf_iter.cc.

84 {
85  data = 0; cursor = 0;
86 }
termList cursor
Definition: cf_iter.h:47
CanonicalForm data
Definition: cf_iter.h:46

§ CFIterator() [5/12]

CFIterator::CFIterator ( )

§ CFIterator() [6/12]

CFIterator::CFIterator ( const CFIterator )

§ CFIterator() [7/12]

CFIterator::CFIterator ( const CanonicalForm )

§ CFIterator() [8/12]

CFIterator::CFIterator ( const CanonicalForm ,
const Variable  
)

§ ~CFIterator() [2/3]

CFIterator::~CFIterator ( )

§ CFIterator() [9/12]

CFIterator::CFIterator ( )

§ CFIterator() [10/12]

CFIterator::CFIterator ( const CFIterator )

§ CFIterator() [11/12]

CFIterator::CFIterator ( const CanonicalForm )

§ CFIterator() [12/12]

CFIterator::CFIterator ( const CanonicalForm ,
const Variable  
)

§ ~CFIterator() [3/3]

CFIterator::~CFIterator ( )

Member Function Documentation

§ coeff() [1/3]

CF_INLINE CanonicalForm CFIterator::coeff ( ) const

get the current coefficient

CF_INLINE CanonicalForm CFIterator::coeff () const.

coeff() - return coefficient of current term of CO.

CO has to point to a valid term.

Definition at line 88 of file cf_iter_inline.cc.

89 {
90  ASSERT( hasterms, "lib error: iterator out of terms" );
91  if ( ispoly )
92  return cursor->coeff;
93  else
94  return data;
95 }
termList cursor
Definition: cf_iter.h:47
CanonicalForm coeff
Definition: int_poly.h:36
bool ispoly
Definition: cf_iter.h:48
bool hasterms
Definition: cf_iter.h:48
CanonicalForm data
Definition: cf_iter.h:46
#define ASSERT(expression, message)
Definition: cf_assert.h:99

§ coeff() [2/3]

CF_NO_INLINE CanonicalForm CFIterator::coeff ( ) const

get the current coefficient

§ coeff() [3/3]

CF_NO_INLINE CanonicalForm CFIterator::coeff ( ) const

get the current coefficient

§ exp() [1/3]

CF_INLINE int CFIterator::exp ( ) const

get the current exponent

CF_INLINE int CFIterator::exp () const.

exp() - return exponent of current term of CO.

CO has to point to a valid term.

Definition at line 105 of file cf_iter_inline.cc.

106 {
107  ASSERT( hasterms, "lib error: iterator out of terms" );
108  if ( ispoly )
109  return cursor->exp;
110  else
111  return 0;
112 }
termList cursor
Definition: cf_iter.h:47
int exp
Definition: int_poly.h:37
bool ispoly
Definition: cf_iter.h:48
bool hasterms
Definition: cf_iter.h:48
#define ASSERT(expression, message)
Definition: cf_assert.h:99

§ exp() [2/3]

CF_NO_INLINE int CFIterator::exp ( ) const

get the current exponent

§ exp() [3/3]

CF_NO_INLINE int CFIterator::exp ( ) const

get the current exponent

§ hasTerms() [1/3]

CF_INLINE int CFIterator::hasTerms ( ) const

check if iterator has reached < the end of CanonicalForm

CF_INLINE int CFIterator::hasTerms () const.

hasTerm() - check whether CO points to a valid term.

Return true if CO points to a valid term, false if CO points to the end of the sequence of terms.

Definition at line 75 of file cf_iter_inline.cc.

76 {
77  return hasterms;
78 }
bool hasterms
Definition: cf_iter.h:48

§ hasTerms() [2/3]

CF_NO_INLINE int CFIterator::hasTerms ( ) const

check if iterator has reached < the end of CanonicalForm

§ hasTerms() [3/3]

CF_NO_INLINE int CFIterator::hasTerms ( ) const

check if iterator has reached < the end of CanonicalForm

§ operator++() [1/6]

CF_INLINE CFIterator & CFIterator::operator++ ( )

CFIterator::operator ++ (), operator ++ ( int )

operator ++() - advance CO to next term.

Advance current term to next term in the sequence of terms or to end of sequence. CO has to point to a valid term.

The postfix and prefix operator are identical.

Definition at line 126 of file cf_iter_inline.cc.

127 {
128  ASSERT( hasterms, "lib error: iterator out of terms" );
129  if ( ispoly ) {
130  cursor = cursor->next;
131  hasterms = cursor != 0;
132  } else
133  hasterms = false;
134 
135  return *this;
136 }
termList cursor
Definition: cf_iter.h:47
term * next
Definition: int_poly.h:35
bool ispoly
Definition: cf_iter.h:48
bool hasterms
Definition: cf_iter.h:48
#define ASSERT(expression, message)
Definition: cf_assert.h:99

§ operator++() [2/6]

CF_INLINE CFIterator & CFIterator::operator++ ( int  )
See also
CFIterator::operator

Definition at line 142 of file cf_iter_inline.cc.

143 {
144  ASSERT( hasterms, "lib error: iterator out of terms" );
145  if ( ispoly ) {
146  cursor = cursor->next;
147  hasterms = cursor != 0;
148  } else
149  hasterms = false;
150 
151  return *this;
152 }
termList cursor
Definition: cf_iter.h:47
term * next
Definition: int_poly.h:35
bool ispoly
Definition: cf_iter.h:48
bool hasterms
Definition: cf_iter.h:48
#define ASSERT(expression, message)
Definition: cf_assert.h:99

§ operator++() [3/6]

CF_NO_INLINE CFIterator& CFIterator::operator++ ( )

§ operator++() [4/6]

CF_NO_INLINE CFIterator& CFIterator::operator++ ( )

§ operator++() [5/6]

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

§ operator++() [6/6]

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

§ operator=() [1/6]

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 }
termList cursor
Definition: cf_iter.h:47
bool ispoly
Definition: cf_iter.h:48
bool hasterms
Definition: cf_iter.h:48
CanonicalForm data
Definition: cf_iter.h:46

§ operator=() [2/6]

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 }
termList cursor
Definition: cf_iter.h:47
f
Definition: cfModGcd.cc:4022
bool ispoly
Definition: cf_iter.h:48
bool inBaseDomain() const
bool inQuotDomain() const
factory&#39;s class for polynomials
Definition: int_poly.h:71
InternalCF * value
Definition: canonicalform.h:81
bool hasterms
Definition: cf_iter.h:48
CanonicalForm data
Definition: cf_iter.h:46

§ operator=() [3/6]

CFIterator& CFIterator::operator= ( const CFIterator )

§ operator=() [4/6]

CFIterator& CFIterator::operator= ( const CFIterator )

§ operator=() [5/6]

CFIterator& CFIterator::operator= ( const CanonicalForm )

§ operator=() [6/6]

CFIterator& CFIterator::operator= ( const CanonicalForm )

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: