OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
|
Truncated power series. More...
#include <Tps.h>
Public Member Functions | |
Tps (int maxOrder, int nVar) | |
Constructor. More... | |
Tps (const T &y) | |
Conversion. More... | |
Tps (int y) | |
Conversion. More... | |
Tps () | |
Tps (const Tps< T > &x) | |
~Tps () | |
Tps< T > & | operator= (const Tps< T > &y) |
Tps< T > & | operator= (const T &y) |
Convert and assign. More... | |
Tps< T > | filter (int lowOrder, int highOrder) const |
Extract orders. More... | |
Tps< T > | truncate (int trunc) |
Truncate. More... | |
const T | getCoefficient (int index) const |
Get coefficient. More... | |
void | setCoefficient (int index, const T &value) |
Set coefficient. More... | |
const T | getCoefficient (const TpsMonomial &monomial) const |
Get coefficient. More... | |
void | setCoefficient (const TpsMonomial &monomial, const T &value) |
Set coefficient. More... | |
const T | operator[] (int index) const |
Get coefficient. More... | |
T & | operator[] (int index) |
Get coefficient. More... | |
const T | operator[] (const TpsMonomial &monomial) const |
Get coefficient. More... | |
T & | operator[] (const TpsMonomial &monomial) |
Get coefficient. More... | |
Tps< T > | operator+ () const |
Unary plus. More... | |
Tps< T > | operator- () const |
Unary minus. More... | |
Tps< T > & | operator+= (const Tps< T > &y) |
Add and assign. More... | |
Tps< T > & | operator-= (const Tps< T > &y) |
Subtract and assign. More... | |
Tps< T > & | operator*= (const Tps< T > &y) |
Multiply and assign. More... | |
Tps< T > & | operator/= (const Tps< T > &y) |
Divide and assign. More... | |
Tps< T > & | operator+= (const T &y) |
Add constant and assign. More... | |
Tps< T > & | operator-= (const T &y) |
Subtract constant and assign. More... | |
Tps< T > & | operator*= (const T &y) |
Multiply by constant and assign. More... | |
Tps< T > & | operator/= (const T &y) |
Divide by constant and assign. More... | |
bool | operator== (const Tps< T > &y) const |
Equality operator. More... | |
bool | operator== (const T &y) const |
Equlatity with constant. More... | |
bool | operator!= (const Tps< T > &y) const |
Inequality operator. More... | |
bool | operator!= (const T &y) const |
Inequality with constant. More... | |
Tps< T > | substitute (const Matrix< T > &M) const |
Substitute. More... | |
Tps< T > | substitute (const VpsMap< T > &m) const |
Substitute. More... | |
T | evaluate (const Vector< T > &v) const |
Substitute. More... | |
void | clear () |
Set to zero. More... | |
Tps< T > | inverse (int order=truncOrder) const |
Reciprocal value. More... | |
Tps< T > | multiply (const Tps< T > &y, int trunc) const |
Truncated multiplication. More... | |
Tps< T > | derivative (int var) const |
Partial derivative. More... | |
Tps< T > | integral (int var) const |
Partial integral. More... | |
Tps< T > | multiplyVariable (int var) const |
Multiply by variable [b]var[/b]. More... | |
Tps< T > | scaleMonomials (const Tps< T > &y) const |
Multiply monomial-wise. More... | |
Tps< T > | Taylor (const T series[], int n) const |
Taylor series. More... | |
int | getMaxOrder () const |
Get maximal order. More... | |
int | getTruncOrder () const |
Get truncation order. More... | |
int | getVariables () const |
Get number of variables. More... | |
int | getSize () const |
Get number of coefficients. More... | |
std::istream & | get (std::istream &is) |
Get Tps from the stream is. More... | |
std::ostream & | put (std::ostream &os) const |
Put Tps to the stream is. More... | |
const TpsMonomial & | getExponents (int index) const |
Get exponents. More... | |
int | getOrder (int index) const |
Get order. More... | |
int | getSize (int order) const |
Size. More... | |
bool | isConstant () const |
Test for constant. More... | |
Static Public Member Functions | |
static Tps< T > | makeVariable (int nVar, int var) |
Make variable. More... | |
static Tps< T > | makeVarPower (int nVar, int var, int power) |
Make power. More... | |
static Tps< T > | makeMonomial (const TpsMonomial &m, const T &t) |
Make monomial. More... | |
static int | getGlobalTruncOrder () |
Get global truncation order. More... | |
static void | setGlobalTruncOrder (int order) |
Set global truncation order. More... | |
Static Public Attributes | |
static const int | EXACT = INT_MAX |
Representation of infinite precision. More... | |
Private Member Functions | |
Tps (TpsRep< T > *) | |
void | setMaxOrder (int) |
void | unique () |
Private Attributes | |
TpsRep< T > * | rep |
Static Private Attributes | |
static int | truncOrder = EXACT |
Conversion.
Definition at line 246 of file Tps.hpp.
References Tps< T >::rep, and Attrib::Legacy::Distribution::T.
Definition at line 253 of file Tps.hpp.
References TpsRep< T >::release(), and Tps< T >::rep.
void Tps< T >::clear |
Set to zero.
Definition at line 714 of file Tps.hpp.
References TpsRep< T >::release(), Tps< T >::rep, and TpsRep< T >::zero().
Partial derivative.
Definition at line 920 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(), Tps< T >::rep, and Attrib::Legacy::Distribution::T.
Substitute.
Definition at line 686 of file Tps.hpp.
References Tps< T >::getMaxOrder(), Tps< T >::getVariables(), TpsSubstitution::index, TpsSubstitution::order, Tps< T >::rep, Array1D< T >::size(), TpsSubstitution::skip, Attrib::Legacy::Distribution::T, and TpsSubstitution::variable.
Extract orders.
Definition at line 279 of file Tps.hpp.
References TpsRep< T >::create(), TpsRep< T >::data(), Tps< T >::getMaxOrder(), Tps< T >::getSize(), Tps< T >::getTruncOrder(), Tps< T >::getVariables(), min(), and Tps< T >::rep.
Referenced by Tps< T >::truncate().
std::istream & Tps< T >::get | ( | std::istream & | is | ) |
Get Tps from the stream is.
Definition at line 721 of file Tps.hpp.
References TpsMonomial::getIndex(), Tps< T >::setMaxOrder(), Attrib::Legacy::Distribution::T, and Tps< T >::truncOrder.
Referenced by operator>>().
const T Tps< T >::getCoefficient | ( | const TpsMonomial & | monomial | ) | const |
Get coefficient.
Definition at line 355 of file Tps.hpp.
References Tps< T >::getCoefficient(), TpsMonomial::getIndex(), Tps< T >::getVariables(), and TpsMonomial::getVariables().
const T Tps< T >::getCoefficient | ( | int | index | ) | const |
Get coefficient.
Definition at line 327 of file Tps.hpp.
References Tps< T >::rep.
Referenced by Tps< T >::getCoefficient().
const TpsMonomial & Tps< T >::getExponents | ( | int | index | ) | const |
Get exponents.
Definition at line 1073 of file Tps.hpp.
References Tps< T >::rep.
Referenced by Tps< T >::derivative(), Tps< T >::integral(), and Tps< T >::put().
|
static |
Get global truncation order.
Definition at line 1061 of file Tps.hpp.
References Tps< T >::truncOrder.
int Tps< T >::getMaxOrder |
Get maximal order.
Definition at line 1031 of file Tps.hpp.
References Tps< T >::rep.
Referenced by Tps< T >::derivative(), Tps< T >::evaluate(), Tps< T >::filter(), Vps< T >::getTopOrder(), Tps< T >::multiply(), Tps< T >::operator+=(), Tps< T >::operator-(), Tps< T >::operator-=(), Tps< T >::operator==(), Tps< T >::put(), Tps< T >::scaleMonomials(), and Tps< T >::substitute().
int Tps< T >::getOrder | ( | int | index | ) | const |
Get order.
Definition at line 1084 of file Tps.hpp.
References Tps< T >::rep.
Referenced by Tps< T >::setCoefficient().
int Tps< T >::getSize |
Get number of coefficients.
Definition at line 1049 of file Tps.hpp.
References Tps< T >::rep.
Referenced by Tps< T >::derivative(), Tps< T >::filter(), Tps< T >::integral(), Tps< T >::multiply(), Tps< T >::multiplyVariable(), Tps< T >::operator+=(), Tps< T >::operator-=(), Tps< T >::operator==(), and Tps< T >::put().
int Tps< T >::getSize | ( | int | order | ) | const |
int Tps< T >::getTruncOrder |
Get truncation order.
Definition at line 1037 of file Tps.hpp.
References min(), Tps< T >::rep, and Tps< T >::truncOrder.
Referenced by cos(), cosh(), Tps< T >::derivative(), exp(), Tps< T >::filter(), Vps< T >::getTruncOrder(), Tps< T >::inverse(), log(), Tps< T >::multiply(), Tps< T >::operator+=(), Tps< T >::operator-(), Tps< T >::operator-=(), Tps< T >::operator==(), Tps< T >::put(), Tps< T >::scaleMonomials(), sin(), sinh(), sqrt(), and Tps< T >::substitute().
int Tps< T >::getVariables |
Get number of variables.
Definition at line 1043 of file Tps.hpp.
References Tps< T >::rep.
Referenced by Tps< T >::derivative(), Tps< T >::evaluate(), Tps< T >::filter(), Tps< T >::getCoefficient(), Tps< T >::integral(), Tps< T >::multiply(), Tps< T >::multiplyVariable(), Tps< T >::operator+=(), Tps< T >::operator-(), Tps< T >::operator-=(), Tps< T >::operator==(), Tps< T >::put(), Tps< T >::scaleMonomials(), Tps< T >::setCoefficient(), Vps< T >::setComponent(), and Tps< T >::substitute().
Partial integral.
Definition at line 946 of file Tps.hpp.
References TpsRep< T >::create(), TpsRep< T >::data(), Tps< T >::getExponents(), Tps< T >::getSize(), Tps< T >::getVariables(), min(), Tps< T >::rep, Attrib::Legacy::Distribution::T, and Tps< T >::truncOrder.
Tps< T > Tps< T >::inverse | ( | int | order = truncOrder | ) | const |
Reciprocal value.
Definition at line 897 of file Tps.hpp.
References Tps< T >::getTruncOrder(), Tps< T >::isConstant(), min(), Tps< T >::rep, Attrib::Legacy::Distribution::T, and Tps< T >::Taylor().
Referenced by operator/(), Tps< T >::operator/=(), Vps< T >::operator/=(), and pow().
bool Tps< T >::isConstant |
Test for constant.
Definition at line 1055 of file Tps.hpp.
References Tps< T >::rep.
Referenced by Tps< T >::inverse(), and Tps< T >::Taylor().
|
static |
Make monomial.
Definition at line 401 of file Tps.hpp.
References Tps< T >::EXACT, TpsMonomial::getOrder(), and TpsMonomial::getVariables().
Make variable.
Definition at line 383 of file Tps.hpp.
References TpsRep< T >::create(), TpsRep< T >::data(), Tps< T >::EXACT, and Attrib::Legacy::Distribution::T.
Make power.
Definition at line 391 of file Tps.hpp.
References Tps< T >::EXACT, and Attrib::Legacy::Distribution::T.
Truncated multiplication.
Definition at line 823 of file Tps.hpp.
References TpsRep< T >::create(), TpsRep< T >::data(), Tps< T >::EXACT, Tps< T >::getMaxOrder(), Tps< T >::getSize(), Tps< T >::getTruncOrder(), Tps< T >::getVariables(), min(), prod(), Tps< T >::rep, and Attrib::Legacy::Distribution::T.
Referenced by Tps< T >::operator*=(), Tps< T >::operator/=(), and Tps< T >::Taylor().
Multiply by variable [b]var[/b].
Definition at line 969 of file Tps.hpp.
References TpsRep< T >::create(), TpsRep< T >::data(), Tps< T >::getSize(), Tps< T >::getVariables(), min(), Tps< T >::rep, Attrib::Legacy::Distribution::T, and Tps< T >::truncOrder.
bool Tps< T >::operator!= | ( | const T & | y | ) | const |
bool Tps< T >::operator!= | ( | const Tps< T > & | y | ) | const |
Multiply by constant and assign.
Definition at line 527 of file Tps.hpp.
References Tps< T >::rep, Attrib::Legacy::Distribution::T, and Tps< T >::unique().
Multiply and assign.
Definition at line 499 of file Tps.hpp.
References Tps< T >::multiply(), and Tps< T >::truncOrder.
Add constant and assign.
Definition at line 511 of file Tps.hpp.
References Tps< T >::rep, and Tps< T >::unique().
Add and assign.
Definition at line 427 of file Tps.hpp.
References TpsRep< T >::create(), TpsRep< T >::data(), Tps< T >::getMaxOrder(), Tps< T >::getSize(), Tps< T >::getTruncOrder(), Tps< T >::getVariables(), max(), min(), TpsRep< T >::release(), Tps< T >::rep, Attrib::Legacy::Distribution::T, and Tps< T >::unique().
Unary minus.
Definition at line 417 of file Tps.hpp.
References TpsRep< T >::create(), TpsRep< T >::data(), Tps< T >::getMaxOrder(), Tps< T >::getTruncOrder(), Tps< T >::getVariables(), and Tps< T >::rep.
Subtract constant and assign.
Definition at line 519 of file Tps.hpp.
References Tps< T >::rep, and Tps< T >::unique().
Subtract and assign.
Definition at line 462 of file Tps.hpp.
References TpsRep< T >::create(), TpsRep< T >::data(), Tps< T >::getMaxOrder(), Tps< T >::getSize(), Tps< T >::getTruncOrder(), Tps< T >::getVariables(), max(), min(), TpsRep< T >::release(), Tps< T >::rep, Attrib::Legacy::Distribution::T, and Tps< T >::unique().
Divide by constant and assign.
Definition at line 536 of file Tps.hpp.
References Tps< T >::rep, and Attrib::Legacy::Distribution::T.
Divide and assign.
Definition at line 505 of file Tps.hpp.
References Tps< T >::inverse(), Tps< T >::multiply(), and Tps< T >::truncOrder.
Convert and assign.
Definition at line 270 of file Tps.hpp.
References TpsRep< T >::release(), Tps< T >::rep, and TpsRep< T >::zero().
Definition at line 259 of file Tps.hpp.
References TpsRep< T >::release(), and Tps< T >::rep.
bool Tps< T >::operator== | ( | const T & | y | ) | const |
Equlatity with constant.
Definition at line 588 of file Tps.hpp.
References Tps< T >::getSize(), Tps< T >::rep, and Attrib::Legacy::Distribution::T.
Equality operator.
Definition at line 545 of file Tps.hpp.
References Tps< T >::getMaxOrder(), Tps< T >::getSize(), Tps< T >::getTruncOrder(), Tps< T >::getVariables(), min(), Tps< T >::rep, and Attrib::Legacy::Distribution::T.
T & Tps< T >::operator[] | ( | const TpsMonomial & | monomial | ) |
Get coefficient.
Definition at line 320 of file Tps.hpp.
References TpsMonomial::getIndex(), Tps< T >::rep, and Tps< T >::unique().
const T Tps< T >::operator[] | ( | const TpsMonomial & | monomial | ) | const |
Get coefficient.
Definition at line 314 of file Tps.hpp.
References TpsMonomial::getIndex(), and Tps< T >::rep.
T & Tps< T >::operator[] | ( | int | index | ) |
Get coefficient.
Definition at line 307 of file Tps.hpp.
References Tps< T >::rep, and Tps< T >::unique().
const T Tps< T >::operator[] | ( | int | index | ) | const |
std::ostream & Tps< T >::put | ( | std::ostream & | os | ) | const |
Put Tps to the stream is.
Definition at line 784 of file Tps.hpp.
References endl(), Tps< T >::getExponents(), Tps< T >::getMaxOrder(), Tps< T >::getSize(), Tps< T >::getTruncOrder(), Tps< T >::getVariables(), Inform::precision(), Tps< T >::rep, and Attrib::Legacy::Distribution::T.
Referenced by operator<<().
Multiply monomial-wise.
Definition at line 992 of file Tps.hpp.
References TpsRep< T >::create(), TpsRep< T >::data(), Tps< T >::getMaxOrder(), Tps< T >::getTruncOrder(), Tps< T >::getVariables(), TpsRep< T >::len, min(), Tps< T >::rep, and Attrib::Legacy::Distribution::T.
void Tps< T >::setCoefficient | ( | const TpsMonomial & | monomial, |
const T & | value | ||
) |
Set coefficient.
Definition at line 369 of file Tps.hpp.
References TpsMonomial::getIndex(), Tps< T >::getVariables(), TpsMonomial::getVariables(), and Tps< T >::setCoefficient().
void Tps< T >::setCoefficient | ( | int | index, |
const T & | value | ||
) |
Set coefficient.
Definition at line 337 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().
|
static |
Set global truncation order.
Definition at line 1067 of file Tps.hpp.
References Tps< T >::truncOrder.
|
inlineprivate |
Definition at line 49 of file Tps.hpp.
Referenced by Tps< T >::get().
Substitute.
Definition at line 614 of file Tps.hpp.
References Tps< T >::getMaxOrder(), Tps< T >::getVariables(), TpsSubstitution::index, Array2D< T >::ncols(), Array2D< T >::nrows(), TpsSubstitution::order, Tps< T >::rep, Array1D< T >::size(), TpsSubstitution::skip, Attrib::Legacy::Distribution::T, and TpsSubstitution::variable.
Substitute.
Definition at line 657 of file Tps.hpp.
References Vps< T >::getDimension(), Tps< T >::getMaxOrder(), Tps< T >::getTruncOrder(), Tps< T >::getVariables(), TpsSubstitution::index, TpsSubstitution::order, Tps< T >::rep, Array1D< T >::size(), TpsSubstitution::skip, Attrib::Legacy::Distribution::T, and TpsSubstitution::variable.
Taylor series.
Definition at line 1014 of file Tps.hpp.
References Tps< T >::isConstant(), Tps< T >::multiply(), and Attrib::Legacy::Distribution::T.
Referenced by cos(), cosh(), exp(), Tps< T >::inverse(), sin(), sinh(), and sqrt().
Truncate.
Definition at line 295 of file Tps.hpp.
References Tps< T >::filter().
|
inlineprivate |
Definition at line 55 of file Tps.hpp.
Referenced by Tps< T >::operator*=(), Tps< T >::operator+=(), Tps< T >::operator-=(), Tps< T >::operator[](), and Tps< T >::setCoefficient().
|
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().
Definition at line 274 of file Tps.h.
Referenced by Tps< T >::clear(), Tps< T >::derivative(), Tps< T >::evaluate(), Tps< T >::filter(), Tps< T >::getCoefficient(), Tps< T >::getExponents(), Tps< T >::getMaxOrder(), Tps< T >::getOrder(), Tps< T >::getSize(), Tps< T >::getTruncOrder(), Tps< T >::getVariables(), Tps< T >::integral(), Tps< T >::inverse(), Tps< T >::isConstant(), Tps< T >::multiply(), Tps< T >::multiplyVariable(), Tps< T >::operator*=(), Tps< T >::operator+=(), Tps< T >::operator-(), Tps< T >::operator-=(), Tps< T >::operator/=(), Tps< T >::operator=(), Tps< T >::operator==(), Tps< T >::operator[](), Tps< T >::put(), Tps< T >::scaleMonomials(), Tps< T >::setCoefficient(), Tps< T >::substitute(), Tps< T >::Tps(), and Tps< T >::~Tps().
Definition at line 277 of file Tps.h.
Referenced by Tps< T >::get(), Tps< T >::getGlobalTruncOrder(), Tps< T >::getTruncOrder(), Tps< T >::integral(), Tps< T >::multiplyVariable(), Tps< T >::operator*=(), Tps< T >::operator/=(), and Tps< T >::setGlobalTruncOrder().