Sacado::Tay::Taylor< T > Class Template Reference

Taylor polynomial class. More...

#include <Sacado_Tay_Taylor.hpp>

List of all members.

Assignment operators

Taylor< T > & operator= (const T &val)
 Assignment operator with constant right-hand-side.
Taylor< T > & operator= (const Taylor< T > &x)
 Assignment with Taylor right-hand-side.

Value accessor methods

const T & val () const
 Returns value.
T & val ()
 Returns value.

Taylor coefficient accessor methods

unsigned int degree () const
 Returns degree of polynomial.
bool hasFastAccess (unsigned int d) const
 Returns true if polynomial has degree >= d.
const T * coeff () const
 Returns Taylor coefficient array.
T * coeff ()
 Returns Taylor coefficient array.
coeff (unsigned int i) const
 Returns degree i term with bounds checking.
T & fastAccessCoeff (unsigned int i)
 Returns degree i term without bounds checking.
fastAccessCoeff (unsigned int i) const
 Returns degree i term without bounds checking.

Unary operators

Taylor< T > operator+ () const
 Unary-plus operator.
Taylor< T > operator- () const
 Unary-minus operator.
Taylor< T > & operator+= (const T &x)
 Addition-assignment operator with constant right-hand-side.
Taylor< T > & operator-= (const T &x)
 Subtraction-assignment operator with constant right-hand-side.
Taylor< T > & operator *= (const T &x)
 Multiplication-assignment operator with constant right-hand-side.
Taylor< T > & operator/= (const T &x)
 Division-assignment operator with constant right-hand-side.
Taylor< T > & operator+= (const Taylor< T > &x)
 Addition-assignment operator with Taylor right-hand-side.
Taylor< T > & operator-= (const Taylor< T > &x)
 Subtraction-assignment operator with Taylor right-hand-side.
Taylor< T > & operator *= (const Taylor< T > &x)
 Multiplication-assignment operator with Taylor right-hand-side.
Taylor< T > & operator/= (const Taylor< T > &x)
 Division-assignment operator with Taylor right-hand-side.

Public Types

typedef T value_type
 Typename of values.

Public Member Functions

 Taylor ()
 Default constructor.
 Taylor (const T &x)
 Constructor with supplied value x.
 Taylor (unsigned int d, const T &x)
 Constructor with degree d and value x.
 Taylor (unsigned int d)
 Constructor with degree d.
 Taylor (const Taylor &x)
 Copy constructor.
 ~Taylor ()
 Destructor.
void resize (unsigned int d, bool keep_coeffs)
 Resize polynomial to degree d.
void reserve (unsigned int d)
 Reserve space for a degree d polynomial.
void copyForWrite ()
 Prepare polynomial for writing.

Protected Member Functions

unsigned int length () const
 Return length of array.
void resizeCoeffs (unsigned int len)
 Resize coefficient array to new size.

Protected Attributes

Sacado::Handle< TaylorDatath

Classes

struct  apply
 Turn Taylor into a meta-function class usable with mpl::apply. More...
struct  TaylorData


Detailed Description

template<typename T>
class Sacado::Tay::Taylor< T >

Taylor polynomial class.

Uses a handle and a "copy-on-write" strategy for efficient copying, but no expression templating.

Definition at line 51 of file Sacado_Tay_Taylor.hpp.


Member Typedef Documentation

template<typename T>
typedef T Sacado::Tay::Taylor< T >::value_type

Typename of values.

Definition at line 61 of file Sacado_Tay_Taylor.hpp.


Constructor & Destructor Documentation

template<typename T>
Sacado::Tay::Taylor< T >::Taylor (  ) 

Default constructor.

Definition at line 117 of file Sacado_Tay_TaylorImp.hpp.

template<typename T>
Sacado::Tay::Taylor< T >::Taylor ( const T &  x  ) 

Constructor with supplied value x.

Sets the first coefficient to x

Definition at line 124 of file Sacado_Tay_TaylorImp.hpp.

template<typename T>
Sacado::Tay::Taylor< T >::Taylor ( unsigned int  d,
const T &  x 
)

Constructor with degree d and value x.

Initializes first coeffienct to x and of a polynomial of degree d

Definition at line 131 of file Sacado_Tay_TaylorImp.hpp.

template<typename T>
Sacado::Tay::Taylor< T >::Taylor ( unsigned int  d  ) 

Constructor with degree d.

Initializes all components to zero

Definition at line 138 of file Sacado_Tay_TaylorImp.hpp.

template<typename T>
Sacado::Tay::Taylor< T >::Taylor ( const Taylor< T > &  x  ) 

Copy constructor.

template<typename T>
Sacado::Tay::Taylor< T >::~Taylor (  ) 

Destructor.

Definition at line 152 of file Sacado_Tay_TaylorImp.hpp.


Member Function Documentation

template<typename T>
void Sacado::Tay::Taylor< T >::resize ( unsigned int  d,
bool  keep_coeffs 
)

Resize polynomial to degree d.

Coefficients are preserved if keep_coeffs is true, otherwise all coefficients are reset to zero.

Definition at line 159 of file Sacado_Tay_TaylorImp.hpp.

template<typename T>
void Sacado::Tay::Taylor< T >::reserve ( unsigned int  d  ) 

Reserve space for a degree d polynomial.

Coefficients are preserved.

Definition at line 178 of file Sacado_Tay_TaylorImp.hpp.

template<typename T>
void Sacado::Tay::Taylor< T >::copyForWrite (  )  [inline]

Prepare polynomial for writing.

This method prepares the polynomial for writing through coeff() and fastAccessCoeff() member functions. It ensures the handle for the Taylor coefficients is not shared among any other Taylor polynomial objects. If the handle is not shared it does nothing, so there is no cost in calling this method in this case. If the handle is shared and this method is not called, any changes to the coefficients by coeff() or fastAccessCoeff() may change other polynomial objects.

Definition at line 113 of file Sacado_Tay_Taylor.hpp.

template<typename T>
Taylor< T > & Sacado::Tay::Taylor< T >::operator= ( const T &  val  ) 

Assignment operator with constant right-hand-side.

Definition at line 190 of file Sacado_Tay_TaylorImp.hpp.

template<typename T>
Taylor< T > & Sacado::Tay::Taylor< T >::operator= ( const Taylor< T > &  x  ) 

Assignment with Taylor right-hand-side.

Definition at line 209 of file Sacado_Tay_TaylorImp.hpp.

template<typename T>
const T& Sacado::Tay::Taylor< T >::val (  )  const [inline]

Returns value.

Definition at line 134 of file Sacado_Tay_Taylor.hpp.

template<typename T>
T& Sacado::Tay::Taylor< T >::val (  )  [inline]

Returns value.

Definition at line 137 of file Sacado_Tay_Taylor.hpp.

template<typename T>
unsigned int Sacado::Tay::Taylor< T >::degree (  )  const [inline]

Returns degree of polynomial.

Definition at line 147 of file Sacado_Tay_Taylor.hpp.

template<typename T>
bool Sacado::Tay::Taylor< T >::hasFastAccess ( unsigned int  d  )  const [inline]

Returns true if polynomial has degree >= d.

Definition at line 150 of file Sacado_Tay_Taylor.hpp.

template<typename T>
const T* Sacado::Tay::Taylor< T >::coeff (  )  const [inline]

Returns Taylor coefficient array.

Definition at line 153 of file Sacado_Tay_Taylor.hpp.

template<typename T>
T* Sacado::Tay::Taylor< T >::coeff (  )  [inline]

Returns Taylor coefficient array.

Definition at line 156 of file Sacado_Tay_Taylor.hpp.

template<typename T>
T Sacado::Tay::Taylor< T >::coeff ( unsigned int  i  )  const [inline]

Returns degree i term with bounds checking.

Definition at line 159 of file Sacado_Tay_Taylor.hpp.

template<typename T>
T& Sacado::Tay::Taylor< T >::fastAccessCoeff ( unsigned int  i  )  [inline]

Returns degree i term without bounds checking.

Definition at line 163 of file Sacado_Tay_Taylor.hpp.

template<typename T>
T Sacado::Tay::Taylor< T >::fastAccessCoeff ( unsigned int  i  )  const [inline]

Returns degree i term without bounds checking.

Definition at line 166 of file Sacado_Tay_Taylor.hpp.

template<typename T>
Taylor< T > Sacado::Tay::Taylor< T >::operator+ (  )  const

Unary-plus operator.

Definition at line 218 of file Sacado_Tay_TaylorImp.hpp.

template<typename T>
Taylor< T > Sacado::Tay::Taylor< T >::operator- (  )  const

Unary-minus operator.

Definition at line 226 of file Sacado_Tay_TaylorImp.hpp.

template<typename T>
Taylor< T > & Sacado::Tay::Taylor< T >::operator+= ( const T &  x  ) 

Addition-assignment operator with constant right-hand-side.

Definition at line 241 of file Sacado_Tay_TaylorImp.hpp.

template<typename T>
Taylor< T > & Sacado::Tay::Taylor< T >::operator-= ( const T &  x  ) 

Subtraction-assignment operator with constant right-hand-side.

Definition at line 253 of file Sacado_Tay_TaylorImp.hpp.

template<typename T>
Taylor< T > & Sacado::Tay::Taylor< T >::operator *= ( const T &  x  ) 

Multiplication-assignment operator with constant right-hand-side.

Definition at line 265 of file Sacado_Tay_TaylorImp.hpp.

template<typename T>
Taylor< T > & Sacado::Tay::Taylor< T >::operator/= ( const T &  x  ) 

Division-assignment operator with constant right-hand-side.

Definition at line 278 of file Sacado_Tay_TaylorImp.hpp.

template<typename T>
Taylor< T > & Sacado::Tay::Taylor< T >::operator+= ( const Taylor< T > &  x  ) 

Addition-assignment operator with Taylor right-hand-side.

Definition at line 291 of file Sacado_Tay_TaylorImp.hpp.

template<typename T>
Taylor< T > & Sacado::Tay::Taylor< T >::operator-= ( const Taylor< T > &  x  ) 

Subtraction-assignment operator with Taylor right-hand-side.

Definition at line 331 of file Sacado_Tay_TaylorImp.hpp.

template<typename T>
Taylor< T > & Sacado::Tay::Taylor< T >::operator *= ( const Taylor< T > &  x  ) 

Multiplication-assignment operator with Taylor right-hand-side.

Definition at line 371 of file Sacado_Tay_TaylorImp.hpp.

template<typename T>
Taylor< T > & Sacado::Tay::Taylor< T >::operator/= ( const Taylor< T > &  x  ) 

Division-assignment operator with Taylor right-hand-side.

Definition at line 422 of file Sacado_Tay_TaylorImp.hpp.

template<typename T>
unsigned int Sacado::Tay::Taylor< T >::length (  )  const [inline, protected]

Return length of array.

Definition at line 210 of file Sacado_Tay_Taylor.hpp.

template<typename T>
void Sacado::Tay::Taylor< T >::resizeCoeffs ( unsigned int  len  )  [protected]

Resize coefficient array to new size.

Definition at line 472 of file Sacado_Tay_TaylorImp.hpp.


Member Data Documentation

template<typename T>
Sacado::Handle<TaylorData> Sacado::Tay::Taylor< T >::th [protected]

Definition at line 254 of file Sacado_Tay_Taylor.hpp.


The documentation for this class was generated from the following files:
Generated on Wed May 12 21:39:48 2010 for Sacado Package Browser (Single Doxygen Collection) by  doxygen 1.4.7