My Project
Loading...
Searching...
No Matches
Public Member Functions | Private Types | Private Attributes
PowerSeriesInputIterator< traits > Class Template Reference

#include <PowerSeries.h>

Public Member Functions

 PowerSeriesInputIterator (numerator_type num_arg, denominator_type den_arg)
 
 PowerSeriesInputIterator ()
 
void shorten ()
 
expansion_type getValue ()
 
PowerSeriesInputIteratoroperator++ ()
 
bool operator== (const PowerSeriesInputIterator &t2)
 
bool operator!= (const PowerSeriesInputIterator &t2)
 
PowerSeriesInputIterator operator++ (int)
 
const expansion_type operator* ()
 
shared_ptr< const expansion_typeoperator-> ()
 

Private Types

typedef traits::denominator_type denominator_type
 
typedef traits::numerator_type numerator_type
 
typedef traits::expansion_type expansion_type
 

Private Attributes

denominator_type denominator
 
numerator_type numerator
 
denominator_type toPot
 
int state
 
expansion_type data
 
denominator_type lastPot
 

Detailed Description

template<class traits>
class PowerSeriesInputIterator< traits >

Definition at line 5 of file PowerSeries.h.

Member Typedef Documentation

◆ denominator_type

template<class traits >
typedef traits::denominator_type PowerSeriesInputIterator< traits >::denominator_type
private

Definition at line 16 of file PowerSeries.h.

◆ expansion_type

template<class traits >
typedef traits::expansion_type PowerSeriesInputIterator< traits >::expansion_type
private

Definition at line 18 of file PowerSeries.h.

◆ numerator_type

template<class traits >
typedef traits::numerator_type PowerSeriesInputIterator< traits >::numerator_type
private

Definition at line 17 of file PowerSeries.h.

Constructor & Destructor Documentation

◆ PowerSeriesInputIterator() [1/2]

template<class traits >
PowerSeriesInputIterator< traits >::PowerSeriesInputIterator ( numerator_type  num_arg,
denominator_type  den_arg 
)
inline

Definition at line 26 of file PowerSeries.h.

27 :
28 data(den_arg.getRing()),
29 lastPot(den_arg.getRing()),
30 numerator(num_arg),
31 denominator(den_arg)
32 {
33 ring r=denominator.getRing();
34 //not the lead coef Number c=denominator.leadCoef();
35 Number c(1,r);
36 typename traits::denominator_type::iterator it=denominator.begin();
37 typename traits::denominator_type::iterator end=denominator.end();
38 while(it!=end)
39 {
40 if ((*it).isConstant())
41 {
42 //change this type
43 c=denominator_type(*it).leadCoef();
44 break;
45 }
46 ++it;
47 }
48 c=Number(1,r)/c;
49 numerator*=c;
50 denominator*=c;
52 toPot*=Number(-1,r);
53 //change this type
56 state=0;
57 }
Definition: Number.h:34
traits::denominator_type denominator_type
Definition: PowerSeries.h:16
expansion_type data
Definition: PowerSeries.h:23
denominator_type lastPot
Definition: PowerSeries.h:24
numerator_type numerator
Definition: PowerSeries.h:20
denominator_type toPot
Definition: PowerSeries.h:21
denominator_type denominator
Definition: PowerSeries.h:19

◆ PowerSeriesInputIterator() [2/2]

template<class traits >
PowerSeriesInputIterator< traits >::PowerSeriesInputIterator ( )
inline

Definition at line 58 of file PowerSeries.h.

59 {
60 state=-1;
61 }

Member Function Documentation

◆ getValue()

template<class traits >
expansion_type PowerSeriesInputIterator< traits >::getValue ( )
inline

Definition at line 79 of file PowerSeries.h.

80 {
81 typename expansion_type::iterator it=data.begin();
82 typename expansion_type::iterator end=data.end();
83 ring r=data.getRing();
85 while(it!=end)
86 {
87 if(it->lmTotalDegree()==state)
88 {
89 res+=expansion_type(*it);
90 }
91 it++;
92 }
93 return res;
94 }
traits::expansion_type expansion_type
Definition: PowerSeries.h:18
CanonicalForm res
Definition: facAbsFact.cc:60

◆ operator!=()

template<class traits >
bool PowerSeriesInputIterator< traits >::operator!= ( const PowerSeriesInputIterator< traits > &  t2)
inline

Definition at line 108 of file PowerSeries.h.

109 {
110 return state!=t2.state;
111 }

◆ operator*()

template<class traits >
const expansion_type PowerSeriesInputIterator< traits >::operator* ( )
inline

Definition at line 118 of file PowerSeries.h.

119 {
120 return expansion_type(getValue());
121 }
expansion_type getValue()
Definition: PowerSeries.h:79

◆ operator++() [1/2]

template<class traits >
PowerSeriesInputIterator & PowerSeriesInputIterator< traits >::operator++ ( )
inline

Definition at line 95 of file PowerSeries.h.

96 {
97 state++;
98 shorten();
101 return *this;
102 }

◆ operator++() [2/2]

template<class traits >
PowerSeriesInputIterator PowerSeriesInputIterator< traits >::operator++ ( int  )
inline

Definition at line 112 of file PowerSeries.h.

113 {
114 PowerSeriesInputIterator it(*this);
115 ++(*this);
116 return it;
117 }

◆ operator->()

template<class traits >
shared_ptr< const expansion_type > PowerSeriesInputIterator< traits >::operator-> ( )
inline

Definition at line 122 of file PowerSeries.h.

123 {
124 return shared_ptr<const expansion_type>(new expansion_type(getValue()));
125 }

◆ operator==()

template<class traits >
bool PowerSeriesInputIterator< traits >::operator== ( const PowerSeriesInputIterator< traits > &  t2)
inline

Definition at line 104 of file PowerSeries.h.

105 {
106 return state==t2.state;
107 }

◆ shorten()

template<class traits >
void PowerSeriesInputIterator< traits >::shorten ( )
inline

Definition at line 62 of file PowerSeries.h.

63 {
64 typename expansion_type::iterator it=data.begin();
65 typename expansion_type::iterator end=data.end();
66 ring r=data.getRing();
67 expansion_type remove(r);
68 while(it!=end)
69 {
70 if(it->lmTotalDegree()<state)
71 {
72 remove+=expansion_type(*it);
73 }
74 it++;
75 }
76 remove*=Number(-1,r);
77 data+=remove;
78 }

Field Documentation

◆ data

template<class traits >
expansion_type PowerSeriesInputIterator< traits >::data
private

Definition at line 23 of file PowerSeries.h.

◆ denominator

template<class traits >
denominator_type PowerSeriesInputIterator< traits >::denominator
private

Definition at line 19 of file PowerSeries.h.

◆ lastPot

template<class traits >
denominator_type PowerSeriesInputIterator< traits >::lastPot
private

Definition at line 24 of file PowerSeries.h.

◆ numerator

template<class traits >
numerator_type PowerSeriesInputIterator< traits >::numerator
private

Definition at line 20 of file PowerSeries.h.

◆ state

template<class traits >
int PowerSeriesInputIterator< traits >::state
private

Definition at line 22 of file PowerSeries.h.

◆ toPot

template<class traits >
denominator_type PowerSeriesInputIterator< traits >::toPot
private

Definition at line 21 of file PowerSeries.h.


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