Sacado Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Sacado::Tay::Taylor< T > Class Template Reference

Taylor polynomial class. More...

#include <Sacado_Tay_Taylor.hpp>

Inheritance diagram for Sacado::Tay::Taylor< T >:
Inheritance graph
[legend]

Classes

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

Public Types

typedef T value_type
 Typename of values. More...
 
typedef ScalarType< value_type >
::type 
scalar_type
 Typename of scalar's (which may be different from value_type) More...
 
- Public Types inherited from Sacado::Base< Taylor< T > >
typedef Taylor< Tderived_type
 

Public Member Functions

 Taylor ()
 Default constructor. More...
 
 Taylor (const T &x)
 Constructor with supplied value x. More...
 
 Taylor (const typename dummy< value_type, scalar_type >::type &x)
 Constructor with supplied value x. More...
 
 Taylor (int d, const T &x)
 Constructor with degree d and value x. More...
 
 Taylor (int d)
 Constructor with degree d. More...
 
 Taylor (const Taylor &x)
 Copy constructor. More...
 
 ~Taylor ()
 Destructor. More...
 
void resize (int d, bool keep_coeffs)
 Resize polynomial to degree d. More...
 
void reserve (int d)
 Reserve space for a degree d polynomial. More...
 
void copyForWrite ()
 Prepare polynomial for writing. More...
 
bool isEqualTo (const Taylor &x) const
 Returns whether two Taylor objects have the same values. More...
 
- Public Member Functions inherited from Sacado::Base< Taylor< T > >
const derived_typederived () const
 

Protected Member Functions

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

Protected Attributes

Sacado::Handle< TaylorDatath
 

Assignment operators

Taylor< T > & operator= (const T &val)
 Assignment operator with constant right-hand-side. More...
 
Taylor< T > & operator= (const typename dummy< value_type, scalar_type >::type &val)
 Assignment operator with constant right-hand-side. More...
 
Taylor< T > & operator= (const Taylor< T > &x)
 Assignment with Taylor right-hand-side. More...
 

Value accessor methods

const Tval () const
 Returns value. More...
 
Tval ()
 Returns value. More...
 

Taylor coefficient accessor methods

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

Unary operators

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

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 32 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 42 of file Sacado_Tay_Taylor.hpp.

template<typename T>
typedef ScalarType<value_type>::type Sacado::Tay::Taylor< T >::scalar_type

Typename of scalar's (which may be different from value_type)

Definition at line 45 of file Sacado_Tay_Taylor.hpp.

Constructor & Destructor Documentation

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

Default constructor.

Definition at line 100 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 107 of file Sacado_Tay_TaylorImp.hpp.

template<typename T>
Sacado::Tay::Taylor< T >::Taylor ( const typename dummy< value_type, scalar_type >::type &  x)

Constructor with supplied value x.

Sets the first coefficient to x. Creates a dummy overload when ValueT and ScalarT are the same type.

Definition at line 114 of file Sacado_Tay_TaylorImp.hpp.

template<typename T>
Sacado::Tay::Taylor< T >::Taylor ( 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 121 of file Sacado_Tay_TaylorImp.hpp.

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

Constructor with degree d.

Initializes all components to zero

Definition at line 128 of file Sacado_Tay_TaylorImp.hpp.

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

Copy constructor.

Definition at line 135 of file Sacado_Tay_TaylorImp.hpp.

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

Destructor.

Definition at line 142 of file Sacado_Tay_TaylorImp.hpp.

Member Function Documentation

template<typename T >
void Sacado::Tay::Taylor< T >::resize ( 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 149 of file Sacado_Tay_TaylorImp.hpp.

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

Reserve space for a degree d polynomial.

Coefficients are preserved.

Definition at line 168 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 104 of file Sacado_Tay_Taylor.hpp.

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

Returns whether two Taylor objects have the same values.

Definition at line 107 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 180 of file Sacado_Tay_TaylorImp.hpp.

template<typename T>
Taylor< T > & Sacado::Tay::Taylor< T >::operator= ( const typename dummy< value_type, scalar_type >::type &  val)

Assignment operator with constant right-hand-side.

Creates a dummy overload when value_type and scalar_type are the same type.

Definition at line 199 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 207 of file Sacado_Tay_TaylorImp.hpp.

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

Returns value.

Definition at line 142 of file Sacado_Tay_Taylor.hpp.

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

Returns value.

Definition at line 145 of file Sacado_Tay_Taylor.hpp.

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

Returns degree of polynomial.

Definition at line 155 of file Sacado_Tay_Taylor.hpp.

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

Returns true if polynomial has degree >= d.

Definition at line 158 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 161 of file Sacado_Tay_Taylor.hpp.

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

Returns Taylor coefficient array.

Definition at line 164 of file Sacado_Tay_Taylor.hpp.

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

Returns degree i term with bounds checking.

Definition at line 167 of file Sacado_Tay_Taylor.hpp.

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

Returns degree i term without bounds checking.

Definition at line 171 of file Sacado_Tay_Taylor.hpp.

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

Returns degree i term without bounds checking.

Definition at line 174 of file Sacado_Tay_Taylor.hpp.

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

Unary-plus operator.

Definition at line 216 of file Sacado_Tay_TaylorImp.hpp.

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

Unary-minus operator.

Definition at line 224 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 239 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 251 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 263 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 276 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 289 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 329 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 369 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 420 of file Sacado_Tay_TaylorImp.hpp.

template<typename T>
int Sacado::Tay::Taylor< T >::length ( ) const
inlineprotected

Return length of array.

Definition at line 218 of file Sacado_Tay_Taylor.hpp.

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

Resize coefficient array to new size.

Definition at line 470 of file Sacado_Tay_TaylorImp.hpp.

Member Data Documentation

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

Definition at line 262 of file Sacado_Tay_Taylor.hpp.


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