30#ifndef SACADO_TAY_CACHETAYLOR_HPP
31#define SACADO_TAY_CACHETAYLOR_HPP
50 template <
typename T>
class CacheTaylor;
99 void resize(
int d,
bool keep_coeffs) {
151 template <
typename S>
154 if (
x.degree() != this->degree())
return false;
157 eq = eq && IE::eval(
x.coeff(
i), this->
coeff(
i));
167 std::valarray<T> tmp =
coeff_;
171 std::slice s(0,dnew+1,1);
175 std::slice s(0,sz,1);
193 template <
typename T>
227 template <
typename T>
239 template <
typename U>
Taylor polynomial class using caching expression templates.
const T coeff(int i) const
Returns degree i term with bounds checking.
T value_type
Typename of values.
CacheTaylorImplementation(const CacheTaylorImplementation &x)
Copy constructor.
CacheTaylorImplementation(const T &x)
Constructor with supplied value x.
bool isEqualTo(const Expr< S > &x) const
Returns whether two Taylor objects have the same values.
bool hasFastAccess(int d) const
Returns true if polynomial has degree >= d.
int degree() const
Returns degree of polynomial.
void resize(int d, bool keep_coeffs)
Resize polynomial to degree d.
const T & fastAccessCoeff(int i) const
Returns degree i term without bounds checking.
T coeff(int i)
Returns degree i term with bounds checking.
ScalarType< T >::type scalar_type
Typename of scalar's (which may be different from ValueT)
CacheTaylorImplementation(int d, const T &x)
Constructor with degree d and value x.
CacheTaylorImplementation()
Default constructor.
const std::valarray< T > & coeff() const
Returns Taylor coefficient array.
void resizeCoeffs(int dnew)
Resize coefficient array to new size.
void allocateCache(int d) const
Allocate coefficient cache.
const T & val() const
Returns value.
std::valarray< T > coeff_
Taylor polynomial coefficients.
T & fastAccessCoeff(int i)
Returns degree i term without bounds checking.
~CacheTaylorImplementation()
Destructor.
Forward-mode AD class using dynamic memory allocation.
CacheTaylor< T > & operator=(const Expr< S > &x)
Assignment operator with any expression right-hand-side.
CacheTaylor< T > & operator+=(const T &x)
Addition-assignment operator with constant right-hand-side.
CacheTaylor< T > & operator=(const T &v)
Assignment operator with constant right-hand-side.
CacheTaylor< T > & operator/=(const T &x)
Division-assignment operator with constant right-hand-side.
Expr< UnaryExpr< CacheTaylor< T >, UnaryPlusOp > > operator+() const
Unary-plus operator.
CacheTaylor(const typename dummy< value_type, scalar_type >::type &x)
Constructor with supplied value x.
CacheTaylor(const CacheTaylor &x)
Copy constructor.
CacheTaylor< T > & operator-=(const T &x)
Subtraction-assignment operator with constant right-hand-side.
CacheTaylor< T > & operator=(const typename dummy< value_type, scalar_type >::type &val)
Assignment operator with constant right-hand-side.
ScalarType< T >::type scalar_type
Typename of scalar's (which may be different from ValueT)
CacheTaylor(int d, const T &x)
Constructor with degree d and value x.
Expr< UnaryExpr< CacheTaylor< T >, UnaryMinusOp > > operator-() const
Unary-minus operator.
~CacheTaylor()
Destructor.
CacheTaylor()
Default constructor.
T value_type
Typename of values.
CacheTaylor(const T &x)
Constructor with supplied value x.
CacheTaylor< T > & operator*=(const T &x)
Multiplication-assignment operator with constant right-hand-side.
Expr()
Default constructor.
CacheTaylor< T > base_expr_type
Typename of base-expressions.
Expr(int d, const T &x)
Constructor with degree d and value x.
Expr(const T &x)
Constructor with supplied value x.
Expr(const Expr &x)
Copy constructor.
Wrapper for a generic expression template.
Unary expression template.
Base template specification for testing equivalence.
Turn CacheTaylor into a meta-function class usable with mpl::apply.