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