OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
Tps< T > Class Template Reference

Truncated power series. More...

#include <Tps.h>

Public Member Functions

 Tps (int maxOrder, int nVar)
 Constructor.
 
 Tps (const T &y)
 Conversion.
 
 Tps (int y)
 Conversion.
 
 Tps ()
 
 Tps (const Tps< T > &x)
 
 ~Tps ()
 
Tps< T > & operator= (const Tps< T > &y)
 
Tps< T > & operator= (const T &y)
 Convert and assign.
 
Tps< T > filter (int lowOrder, int highOrder) const
 Extract orders.
 
Tps< T > truncate (int trunc)
 Truncate.
 
const T getCoefficient (int index) const
 Get coefficient.
 
void setCoefficient (int index, const T &value)
 Set coefficient.
 
const T getCoefficient (const TpsMonomial &monomial) const
 Get coefficient.
 
void setCoefficient (const TpsMonomial &monomial, const T &value)
 Set coefficient.
 
const T operator[] (int index) const
 Get coefficient.
 
T & operator[] (int index)
 Get coefficient.
 
const T operator[] (const TpsMonomial &monomial) const
 Get coefficient.
 
T & operator[] (const TpsMonomial &monomial)
 Get coefficient.
 
Tps< T > operator+ () const
 Unary plus.
 
Tps< T > operator- () const
 Unary minus.
 
Tps< T > & operator+= (const Tps< T > &y)
 Add and assign.
 
Tps< T > & operator-= (const Tps< T > &y)
 Subtract and assign.
 
Tps< T > & operator*= (const Tps< T > &y)
 Multiply and assign.
 
Tps< T > & operator/= (const Tps< T > &y)
 Divide and assign.
 
Tps< T > & operator+= (const T &y)
 Add constant and assign.
 
Tps< T > & operator-= (const T &y)
 Subtract constant and assign.
 
Tps< T > & operator*= (const T &y)
 Multiply by constant and assign.
 
Tps< T > & operator/= (const T &y)
 Divide by constant and assign.
 
bool operator== (const Tps< T > &y) const
 Equality operator.
 
bool operator== (const T &y) const
 Equlatity with constant.
 
bool operator!= (const Tps< T > &y) const
 Inequality operator.
 
bool operator!= (const T &y) const
 Inequality with constant.
 
Tps< T > substitute (const Matrix< T > &M) const
 Substitute.
 
Tps< T > substitute (const VpsMap< T > &m) const
 Substitute.
 
evaluate (const Vector< T > &v) const
 Substitute.
 
void clear ()
 Set to zero.
 
Tps< T > inverse (int order=truncOrder) const
 Reciprocal value.
 
Tps< T > multiply (const Tps< T > &y, int trunc) const
 Truncated multiplication.
 
Tps< T > derivative (int var) const
 Partial derivative.
 
Tps< T > integral (int var) const
 Partial integral.
 
Tps< T > multiplyVariable (int var) const
 Multiply by variable [b]var[/b].
 
Tps< T > scaleMonomials (const Tps< T > &y) const
 Multiply monomial-wise.
 
Tps< T > Taylor (const T series[], int n) const
 Taylor series.
 
int getMaxOrder () const
 Get maximal order.
 
int getTruncOrder () const
 Get truncation order.
 
int getVariables () const
 Get number of variables.
 
int getSize () const
 Get number of coefficients.
 
std::istream & get (std::istream &is)
 Get Tps from the stream is.
 
std::ostream & put (std::ostream &os) const
 Put Tps to the stream is.
 
const TpsMonomialgetExponents (int index) const
 Get exponents.
 
int getOrder (int index) const
 Get order.
 
int getSize (int order) const
 Size.
 
bool isConstant () const
 Test for constant.
 

Static Public Member Functions

static Tps< T > makeVariable (int nVar, int var)
 Make variable.
 
static Tps< T > makeVarPower (int nVar, int var, int power)
 Make power.
 
static Tps< T > makeMonomial (const TpsMonomial &m, const T &t)
 Make monomial.
 
static int getGlobalTruncOrder ()
 Get global truncation order.
 
static void setGlobalTruncOrder (int order)
 Set global truncation order.
 

Static Public Attributes

static const int EXACT = INT_MAX
 Representation of infinite precision.
 

Private Member Functions

 Tps (TpsRep< T > *)
 
void setMaxOrder (int)
 
void unique ()
 

Private Attributes

TpsRep< T > * rep
 

Static Private Attributes

static int truncOrder = EXACT
 

Detailed Description

template<class T>
class Tps< T >

Truncated power series.

Definition at line 46 of file Tps.h.

Constructor & Destructor Documentation

◆ Tps() [1/6]

template<class T >
Tps< T >::Tps ( int  maxOrder,
int  nVar 
)

Constructor.

Definition at line 239 of file Tps.hpp.

◆ Tps() [2/6]

template<class T >
Tps< T >::Tps ( const T &  y)

Conversion.

Definition at line 251 of file Tps.hpp.

References Tps< T >::rep.

◆ Tps() [3/6]

template<class T >
Tps< T >::Tps ( int  y)

Conversion.

Definition at line 258 of file Tps.hpp.

References Tps< T >::rep.

◆ Tps() [4/6]

template<class T >
Tps< T >::Tps ( )

Definition at line 233 of file Tps.hpp.

◆ Tps() [5/6]

template<class T >
Tps< T >::Tps ( const Tps< T > &  x)

Definition at line 245 of file Tps.hpp.

◆ ~Tps()

template<class T >
Tps< T >::~Tps ( )

Definition at line 265 of file Tps.hpp.

References TpsRep< T >::release(), and Tps< T >::rep.

Here is the call graph for this function:

◆ Tps() [6/6]

template<class T >
Tps< T >::Tps ( TpsRep< T > *  d)
inlineprivate

Definition at line 1108 of file Tps.hpp.

Member Function Documentation

◆ clear()

template<class T >
void Tps< T >::clear ( )

Set to zero.

Definition at line 726 of file Tps.hpp.

References TpsRep< T >::release(), Tps< T >::rep, and TpsRep< T >::zero().

Here is the call graph for this function:

◆ derivative()

template<class T >
Tps< T > Tps< T >::derivative ( int  var) const

Partial derivative.

Definition at line 932 of file Tps.hpp.

References TpsRep< T >::create(), TpsRep< T >::data(), Tps< T >::getExponents(), Tps< T >::getMaxOrder(), Tps< T >::getSize(), Tps< T >::getTruncOrder(), Tps< T >::getVariables(), and Tps< T >::rep.

Here is the call graph for this function:

◆ evaluate()

template<class T >
T Tps< T >::evaluate ( const Vector< T > &  v) const

◆ filter()

template<class T >
Tps< T > Tps< T >::filter ( int  lowOrder,
int  highOrder 
) const

Extract orders.

Definition at line 291 of file Tps.hpp.

References TpsRep< T >::create(), TpsRep< T >::data(), Tps< T >::getMaxOrder(), Tps< T >::getSize(), Tps< T >::getTruncOrder(), Tps< T >::getVariables(), and Tps< T >::rep.

Referenced by Tps< T >::truncate().

Here is the call graph for this function:

◆ get()

template<class T >
std::istream & Tps< T >::get ( std::istream &  is)

Get Tps from the stream is.

Definition at line 733 of file Tps.hpp.

References TpsMonomial::getIndex(), Tps< T >::setMaxOrder(), and Tps< T >::truncOrder.

Referenced by operator>>().

Here is the call graph for this function:

◆ getCoefficient() [1/2]

template<class T >
const T Tps< T >::getCoefficient ( const TpsMonomial monomial) const

Get coefficient.

Definition at line 367 of file Tps.hpp.

References Tps< T >::getCoefficient(), TpsMonomial::getIndex(), Tps< T >::getVariables(), and TpsMonomial::getVariables().

Here is the call graph for this function:

◆ getCoefficient() [2/2]

template<class T >
const T Tps< T >::getCoefficient ( int  index) const

Get coefficient.

Definition at line 339 of file Tps.hpp.

References Tps< T >::rep.

Referenced by Tps< T >::getCoefficient().

◆ getExponents()

template<class T >
const TpsMonomial & Tps< T >::getExponents ( int  index) const

Get exponents.

Definition at line 1085 of file Tps.hpp.

References Tps< T >::rep.

Referenced by Tps< T >::derivative(), Tps< T >::integral(), and Tps< T >::put().

◆ getGlobalTruncOrder()

template<class T >
int Tps< T >::getGlobalTruncOrder ( )
static

Get global truncation order.

Definition at line 1073 of file Tps.hpp.

References Tps< T >::truncOrder.

◆ getMaxOrder()

template<class T >
int Tps< T >::getMaxOrder ( ) const

◆ getOrder()

template<class T >
int Tps< T >::getOrder ( int  index) const

Get order.

Definition at line 1096 of file Tps.hpp.

References Tps< T >::rep.

Referenced by Tps< T >::setCoefficient().

◆ getSize() [1/2]

template<class T >
int Tps< T >::getSize ( ) const

◆ getSize() [2/2]

template<class T >
int Tps< T >::getSize ( int  order) const

Size.

Definition at line 1102 of file Tps.hpp.

References Tps< T >::rep.

◆ getTruncOrder()

template<class T >
int Tps< T >::getTruncOrder ( ) const

◆ getVariables()

template<class T >
int Tps< T >::getVariables ( ) const

◆ integral()

template<class T >
Tps< T > Tps< T >::integral ( int  var) const

Partial integral.

Definition at line 958 of file Tps.hpp.

References TpsRep< T >::create(), TpsRep< T >::data(), Tps< T >::getExponents(), Tps< T >::getSize(), Tps< T >::getVariables(), Tps< T >::rep, and Tps< T >::truncOrder.

Here is the call graph for this function:

◆ inverse()

template<class T >
Tps< T > Tps< T >::inverse ( int  order = truncOrder) const

Reciprocal value.

Definition at line 909 of file Tps.hpp.

References Tps< T >::getTruncOrder(), Tps< T >::isConstant(), and Tps< T >::rep.

Referenced by csc(), operator/(), Tps< T >::operator/=(), Vps< T >::operator/=(), pow(), and sec().

Here is the call graph for this function:

◆ isConstant()

template<class T >
bool Tps< T >::isConstant ( ) const

Test for constant.

Definition at line 1067 of file Tps.hpp.

References Tps< T >::rep.

Referenced by Tps< T >::inverse(), and Tps< T >::Taylor().

◆ makeMonomial()

template<class T >
Tps< T > Tps< T >::makeMonomial ( const TpsMonomial m,
const T &  t 
)
static

Make monomial.

Definition at line 413 of file Tps.hpp.

References Tps< T >::EXACT, TpsMonomial::getOrder(), and TpsMonomial::getVariables().

Here is the call graph for this function:

◆ makeVariable()

template<class T >
Tps< T > Tps< T >::makeVariable ( int  nVar,
int  var 
)
static

Make variable.

Definition at line 395 of file Tps.hpp.

References TpsRep< T >::create(), TpsRep< T >::data(), and Tps< T >::EXACT.

Here is the call graph for this function:

◆ makeVarPower()

template<class T >
Tps< T > Tps< T >::makeVarPower ( int  nVar,
int  var,
int  power 
)
static

Make power.

Definition at line 403 of file Tps.hpp.

References Tps< T >::EXACT.

◆ multiply()

template<class T >
Tps< T > Tps< T >::multiply ( const Tps< T > &  y,
int  trunc 
) const

◆ multiplyVariable()

template<class T >
Tps< T > Tps< T >::multiplyVariable ( int  var) const

Multiply by variable [b]var[/b].

Definition at line 981 of file Tps.hpp.

References TpsRep< T >::create(), TpsRep< T >::data(), Tps< T >::getSize(), Tps< T >::getVariables(), Tps< T >::rep, and Tps< T >::truncOrder.

Here is the call graph for this function:

◆ operator!=() [1/2]

template<class T >
bool Tps< T >::operator!= ( const T &  y) const

Inequality with constant.

Definition at line 620 of file Tps.hpp.

◆ operator!=() [2/2]

template<class T >
bool Tps< T >::operator!= ( const Tps< T > &  y) const

Inequality operator.

Definition at line 614 of file Tps.hpp.

◆ operator*=() [1/2]

template<class T >
Tps< T > & Tps< T >::operator*= ( const T &  y)

Multiply by constant and assign.

Definition at line 539 of file Tps.hpp.

References Tps< T >::rep, and Tps< T >::unique().

Here is the call graph for this function:

◆ operator*=() [2/2]

template<class T >
Tps< T > & Tps< T >::operator*= ( const Tps< T > &  y)

Multiply and assign.

Definition at line 511 of file Tps.hpp.

References Tps< T >::multiply(), and Tps< T >::truncOrder.

Here is the call graph for this function:

◆ operator+()

template<class T >
Tps< T > Tps< T >::operator+ ( ) const

Unary plus.

Definition at line 423 of file Tps.hpp.

◆ operator+=() [1/2]

template<class T >
Tps< T > & Tps< T >::operator+= ( const T &  y)

Add constant and assign.

Definition at line 523 of file Tps.hpp.

References Tps< T >::rep, and Tps< T >::unique().

Here is the call graph for this function:

◆ operator+=() [2/2]

template<class T >
Tps< T > & Tps< T >::operator+= ( const Tps< T > &  y)

◆ operator-()

template<class T >
Tps< T > Tps< T >::operator- ( ) const

Unary minus.

Definition at line 429 of file Tps.hpp.

References TpsRep< T >::create(), TpsRep< T >::data(), Tps< T >::getMaxOrder(), Tps< T >::getTruncOrder(), Tps< T >::getVariables(), and Tps< T >::rep.

Here is the call graph for this function:

◆ operator-=() [1/2]

template<class T >
Tps< T > & Tps< T >::operator-= ( const T &  y)

Subtract constant and assign.

Definition at line 531 of file Tps.hpp.

References Tps< T >::rep, and Tps< T >::unique().

Here is the call graph for this function:

◆ operator-=() [2/2]

template<class T >
Tps< T > & Tps< T >::operator-= ( const Tps< T > &  y)

◆ operator/=() [1/2]

template<class T >
Tps< T > & Tps< T >::operator/= ( const T &  y)

Divide by constant and assign.

Definition at line 548 of file Tps.hpp.

References Tps< T >::rep.

◆ operator/=() [2/2]

template<class T >
Tps< T > & Tps< T >::operator/= ( const Tps< T > &  y)

Divide and assign.

Definition at line 517 of file Tps.hpp.

References Tps< T >::inverse(), Tps< T >::multiply(), and Tps< T >::truncOrder.

Here is the call graph for this function:

◆ operator=() [1/2]

template<class T >
Tps< T > & Tps< T >::operator= ( const T &  y)

Convert and assign.

Definition at line 282 of file Tps.hpp.

References TpsRep< T >::release(), Tps< T >::rep, and TpsRep< T >::zero().

Here is the call graph for this function:

◆ operator=() [2/2]

template<class T >
Tps< T > & Tps< T >::operator= ( const Tps< T > &  y)

Definition at line 271 of file Tps.hpp.

References TpsRep< T >::release(), and Tps< T >::rep.

Here is the call graph for this function:

◆ operator==() [1/2]

template<class T >
bool Tps< T >::operator== ( const T &  y) const

Equlatity with constant.

Definition at line 600 of file Tps.hpp.

References Tps< T >::getSize(), and Tps< T >::rep.

Here is the call graph for this function:

◆ operator==() [2/2]

template<class T >
bool Tps< T >::operator== ( const Tps< T > &  y) const

Equality operator.

Definition at line 557 of file Tps.hpp.

References Tps< T >::getMaxOrder(), Tps< T >::getSize(), Tps< T >::getTruncOrder(), Tps< T >::getVariables(), and Tps< T >::rep.

Here is the call graph for this function:

◆ operator[]() [1/4]

template<class T >
T & Tps< T >::operator[] ( const TpsMonomial monomial)

Get coefficient.

Definition at line 332 of file Tps.hpp.

References TpsMonomial::getIndex(), Tps< T >::rep, and Tps< T >::unique().

Here is the call graph for this function:

◆ operator[]() [2/4]

template<class T >
const T Tps< T >::operator[] ( const TpsMonomial monomial) const

Get coefficient.

Definition at line 326 of file Tps.hpp.

References TpsMonomial::getIndex(), and Tps< T >::rep.

Here is the call graph for this function:

◆ operator[]() [3/4]

template<class T >
T & Tps< T >::operator[] ( int  index)

Get coefficient.

Definition at line 319 of file Tps.hpp.

References Tps< T >::rep, and Tps< T >::unique().

Here is the call graph for this function:

◆ operator[]() [4/4]

template<class T >
const T Tps< T >::operator[] ( int  index) const

Get coefficient.

Definition at line 313 of file Tps.hpp.

References Tps< T >::rep.

◆ put()

template<class T >
std::ostream & Tps< T >::put ( std::ostream &  os) const

Put Tps to the stream is.

Definition at line 796 of file Tps.hpp.

References Tps< T >::getExponents(), Tps< T >::getMaxOrder(), Tps< T >::getSize(), Tps< T >::getTruncOrder(), Tps< T >::getVariables(), and Tps< T >::rep.

Referenced by operator<<().

Here is the call graph for this function:

◆ scaleMonomials()

template<class T >
Tps< T > Tps< T >::scaleMonomials ( const Tps< T > &  y) const

Multiply monomial-wise.

Definition at line 1004 of file Tps.hpp.

References TpsRep< T >::create(), TpsRep< T >::data(), Tps< T >::getMaxOrder(), Tps< T >::getTruncOrder(), Tps< T >::getVariables(), TpsRep< T >::len, and Tps< T >::rep.

Here is the call graph for this function:

◆ setCoefficient() [1/2]

template<class T >
void Tps< T >::setCoefficient ( const TpsMonomial monomial,
const T &  value 
)

Set coefficient.

Definition at line 381 of file Tps.hpp.

References TpsMonomial::getIndex(), Tps< T >::getVariables(), TpsMonomial::getVariables(), and Tps< T >::setCoefficient().

Here is the call graph for this function:

◆ setCoefficient() [2/2]

template<class T >
void Tps< T >::setCoefficient ( int  index,
const T &  value 
)

Set coefficient.

Definition at line 349 of file Tps.hpp.

References TpsRep< T >::create(), TpsRep< T >::data(), Tps< T >::getOrder(), Tps< T >::getVariables(), TpsRep< T >::release(), Tps< T >::rep, and Tps< T >::unique().

Referenced by Tps< T >::setCoefficient().

Here is the call graph for this function:

◆ setGlobalTruncOrder()

template<class T >
void Tps< T >::setGlobalTruncOrder ( int  order)
static

Set global truncation order.

Definition at line 1079 of file Tps.hpp.

References Tps< T >::truncOrder.

◆ setMaxOrder()

template<class T >
void Tps< T >::setMaxOrder ( int  order)
inlineprivate

Definition at line 49 of file Tps.hpp.

Referenced by Tps< T >::get().

◆ substitute() [1/2]

template<class T >
Tps< T > Tps< T >::substitute ( const Matrix< T > &  M) const

◆ substitute() [2/2]

template<class T >
Tps< T > Tps< T >::substitute ( const VpsMap< T > &  m) const

◆ Taylor()

template<class T >
Tps< T > Tps< T >::Taylor ( const T  series[],
int  n 
) const

Taylor series.

Definition at line 1026 of file Tps.hpp.

References Tps< T >::isConstant(), and Tps< T >::multiply().

Referenced by cos(), cosh(), exp(), log(), sin(), sinh(), and sqrt().

Here is the call graph for this function:

◆ truncate()

template<class T >
Tps< T > Tps< T >::truncate ( int  trunc)

Truncate.

Definition at line 307 of file Tps.hpp.

References Tps< T >::filter().

Here is the call graph for this function:

◆ unique()

template<class T >
void Tps< T >::unique ( )
inlineprivate

Member Data Documentation

◆ EXACT

template<class T >
const int Tps< T >::EXACT = INT_MAX
static

Representation of infinite precision.

Definition at line 260 of file Tps.h.

Referenced by Tps< T >::makeMonomial(), Tps< T >::makeVariable(), Tps< T >::makeVarPower(), and Tps< T >::multiply().

◆ rep

template<class T >
TpsRep<T>* Tps< T >::rep
private

◆ truncOrder

template<class T >
int Tps< T >::truncOrder = EXACT
staticprivate

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