Sacado::CacheFad::GeneralFad< T, Storage > Class Template Reference

Forward-mode AD class templated on the storage for the derivative array. More...

#include <Sacado_CacheFad_GeneralFad.hpp>

Inheritance diagram for Sacado::CacheFad::GeneralFad< T, Storage >:

Inheritance graph
[legend]
List of all members.

Initialization methods

 GeneralFad ()
 Default constructor.
 GeneralFad (const T &x)
 Constructor with supplied value x.
 GeneralFad (const int sz, const T &x)
 Constructor with size sz and value x.
 GeneralFad (const int sz, const int i, const T &x)
 Constructor with size sz, index i, and value x.
 GeneralFad (const GeneralFad &x)
 Copy constructor.
template<typename S>
 GeneralFad (const Expr< S > &x)
 Copy constructor from any Expression object.
 ~GeneralFad ()
 Destructor.
void diff (const int ith, const int n)
 Set GeneralFad object as the ith independent variable.
void resize (int sz)
 Resize derivative array to length sz.
void zero ()
 Zero out the derivative array.

Value accessor methods

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

Derivative accessor methods

int size () const
 Returns number of derivative components.
bool hasFastAccess () const
 Returns true if derivative array is not empty.
bool isPassive () const
 Returns true if derivative array is empty.
void setIsConstant (bool is_const)
 Set whether variable is constant.
const T * dx () const
 Returns derivative array.
dx (int i) const
 Returns derivative component i with bounds checking.
T & fastAccessDx (int i)
 Returns derivative component i without bounds checking.
fastAccessDx (int i) const
 Returns derivative component i without bounds checking.

Assignment operators

GeneralFadoperator= (const T &val)
 Assignment operator with constant right-hand-side.
GeneralFadoperator= (const GeneralFad &x)
 Assignment with Expr right-hand-side.
template<typename S>
GeneralFadoperator= (const Expr< S > &x)
 Assignment operator with any expression right-hand-side.

Unary operators

GeneralFadoperator+= (const T &x)
 Addition-assignment operator with constant right-hand-side.
GeneralFadoperator-= (const T &x)
 Subtraction-assignment operator with constant right-hand-side.
GeneralFadoperator *= (const T &x)
 Multiplication-assignment operator with constant right-hand-side.
GeneralFadoperator/= (const T &x)
 Division-assignment operator with constant right-hand-side.
template<typename S>
GeneralFadoperator+= (const Expr< S > &x)
 Addition-assignment operator with Expr right-hand-side.
template<typename S>
GeneralFadoperator-= (const Expr< S > &x)
 Subtraction-assignment operator with Expr right-hand-side.
template<typename S>
GeneralFadoperator *= (const Expr< S > &x)
 Multiplication-assignment operator with Expr right-hand-side.
template<typename S>
GeneralFadoperator/= (const Expr< S > &x)
 Division-assignment operator with Expr right-hand-side.

Public Types

typedef T value_type
 Typename of values.

Protected Attributes

Storage s_
 Value & Derivatives.

Detailed Description

template<typename T, typename Storage>
class Sacado::CacheFad::GeneralFad< T, Storage >

Forward-mode AD class templated on the storage for the derivative array.

This class provides a general forward mode AD implementation for any type of derivative array storage. It does not incorporate expression templates.

This version of GeneralFad is virtually identical to Sacado::Fad::GeneralFad, with small differences in the implementations of some of the methods to support caching of "values" of intermediate operations in an expression, recognizing that the "this" object might also be on the right-hand-side of an expression.

Definition at line 77 of file Sacado_CacheFad_GeneralFad.hpp.


Member Typedef Documentation

template<typename T, typename Storage>
typedef T Sacado::CacheFad::GeneralFad< T, Storage >::value_type

Typename of values.

Definition at line 82 of file Sacado_CacheFad_GeneralFad.hpp.


Constructor & Destructor Documentation

template<typename T, typename Storage>
Sacado::CacheFad::GeneralFad< T, Storage >::GeneralFad (  )  [inline]

Default constructor.

Definition at line 90 of file Sacado_CacheFad_GeneralFad.hpp.

template<typename T, typename Storage>
Sacado::CacheFad::GeneralFad< T, Storage >::GeneralFad ( const T &  x  )  [inline]

Constructor with supplied value x.

Initializes value to x and derivative array is empty

Definition at line 96 of file Sacado_CacheFad_GeneralFad.hpp.

template<typename T, typename Storage>
Sacado::CacheFad::GeneralFad< T, Storage >::GeneralFad ( const int  sz,
const T &  x 
) [inline]

Constructor with size sz and value x.

Initializes value to x and derivative array 0 of length sz

Definition at line 102 of file Sacado_CacheFad_GeneralFad.hpp.

template<typename T, typename Storage>
Sacado::CacheFad::GeneralFad< T, Storage >::GeneralFad ( const int  sz,
const int  i,
const T &  x 
) [inline]

Constructor with size sz, index i, and value x.

Initializes value to x and derivative array of length sz as row i of the identity matrix, i.e., sets derivative component i to 1 and all other's to zero.

Definition at line 110 of file Sacado_CacheFad_GeneralFad.hpp.

template<typename T, typename Storage>
Sacado::CacheFad::GeneralFad< T, Storage >::GeneralFad ( const GeneralFad< T, Storage > &  x  )  [inline]

Copy constructor.

Definition at line 116 of file Sacado_CacheFad_GeneralFad.hpp.

template<typename T, typename Storage>
template<typename S>
Sacado::CacheFad::GeneralFad< T, Storage >::GeneralFad ( const Expr< S > &  x  )  [inline]

Copy constructor from any Expression object.

Definition at line 58 of file Sacado_CacheFad_GeneralFadImp.hpp.

template<typename T, typename Storage>
Sacado::CacheFad::GeneralFad< T, Storage >::~GeneralFad (  )  [inline]

Destructor.

Definition at line 123 of file Sacado_CacheFad_GeneralFad.hpp.


Member Function Documentation

template<typename T, typename Storage>
void Sacado::CacheFad::GeneralFad< T, Storage >::diff ( const int  ith,
const int  n 
) [inline]

Set GeneralFad object as the ith independent variable.

Sets the derivative array of length n to the ith row of the identity matrix and has the same affect as the Implementation(const int sz, const int i, const T & x) constructor.

Definition at line 83 of file Sacado_CacheFad_GeneralFadImp.hpp.

template<typename T, typename Storage>
void Sacado::CacheFad::GeneralFad< T, Storage >::resize ( int  sz  )  [inline]

Resize derivative array to length sz.

This method does not (re)initialize the derivative components, so any previous values may be lost. Also any pointers to derivative components may be invalid.

Definition at line 140 of file Sacado_CacheFad_GeneralFad.hpp.

template<typename T, typename Storage>
void Sacado::CacheFad::GeneralFad< T, Storage >::zero (  )  [inline]

Zero out the derivative array.

Definition at line 143 of file Sacado_CacheFad_GeneralFad.hpp.

template<typename T, typename Storage>
const T& Sacado::CacheFad::GeneralFad< T, Storage >::val (  )  const [inline]

Returns value.

Definition at line 153 of file Sacado_CacheFad_GeneralFad.hpp.

template<typename T, typename Storage>
T& Sacado::CacheFad::GeneralFad< T, Storage >::val (  )  [inline]

Returns value.

Definition at line 156 of file Sacado_CacheFad_GeneralFad.hpp.

template<typename T, typename Storage>
int Sacado::CacheFad::GeneralFad< T, Storage >::size (  )  const [inline]

Returns number of derivative components.

Definition at line 166 of file Sacado_CacheFad_GeneralFad.hpp.

template<typename T, typename Storage>
bool Sacado::CacheFad::GeneralFad< T, Storage >::hasFastAccess (  )  const [inline]

Returns true if derivative array is not empty.

Definition at line 169 of file Sacado_CacheFad_GeneralFad.hpp.

template<typename T, typename Storage>
bool Sacado::CacheFad::GeneralFad< T, Storage >::isPassive (  )  const [inline]

Returns true if derivative array is empty.

Definition at line 172 of file Sacado_CacheFad_GeneralFad.hpp.

template<typename T, typename Storage>
void Sacado::CacheFad::GeneralFad< T, Storage >::setIsConstant ( bool  is_const  )  [inline]

Set whether variable is constant.

Definition at line 175 of file Sacado_CacheFad_GeneralFad.hpp.

template<typename T, typename Storage>
const T* Sacado::CacheFad::GeneralFad< T, Storage >::dx (  )  const [inline]

Returns derivative array.

Definition at line 181 of file Sacado_CacheFad_GeneralFad.hpp.

template<typename T, typename Storage>
T Sacado::CacheFad::GeneralFad< T, Storage >::dx ( int  i  )  const [inline]

Returns derivative component i with bounds checking.

Definition at line 184 of file Sacado_CacheFad_GeneralFad.hpp.

template<typename T, typename Storage>
T& Sacado::CacheFad::GeneralFad< T, Storage >::fastAccessDx ( int  i  )  [inline]

Returns derivative component i without bounds checking.

Definition at line 188 of file Sacado_CacheFad_GeneralFad.hpp.

template<typename T, typename Storage>
T Sacado::CacheFad::GeneralFad< T, Storage >::fastAccessDx ( int  i  )  const [inline]

Returns derivative component i without bounds checking.

Definition at line 191 of file Sacado_CacheFad_GeneralFad.hpp.

template<typename T, typename Storage>
Sacado::CacheFad::GeneralFad< T, Storage > & Sacado::CacheFad::GeneralFad< T, Storage >::operator= ( const T &  val  )  [inline]

Assignment operator with constant right-hand-side.

Definition at line 95 of file Sacado_CacheFad_GeneralFadImp.hpp.

template<typename T, typename Storage>
GeneralFad& Sacado::CacheFad::GeneralFad< T, Storage >::operator= ( const GeneralFad< T, Storage > &  x  ) 

Assignment with Expr right-hand-side.

template<typename T, typename Storage>
template<typename S>
Sacado::CacheFad::GeneralFad< T, Storage > & Sacado::CacheFad::GeneralFad< T, Storage >::operator= ( const Expr< S > &  x  )  [inline]

Assignment operator with any expression right-hand-side.

Definition at line 121 of file Sacado_CacheFad_GeneralFadImp.hpp.

template<typename T, typename Storage>
Sacado::CacheFad::GeneralFad< T, Storage > & Sacado::CacheFad::GeneralFad< T, Storage >::operator+= ( const T &  x  )  [inline]

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

Definition at line 146 of file Sacado_CacheFad_GeneralFadImp.hpp.

template<typename T, typename Storage>
Sacado::CacheFad::GeneralFad< T, Storage > & Sacado::CacheFad::GeneralFad< T, Storage >::operator-= ( const T &  x  )  [inline]

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

Definition at line 155 of file Sacado_CacheFad_GeneralFadImp.hpp.

template<typename T, typename Storage>
Sacado::CacheFad::GeneralFad< T, Storage > & Sacado::CacheFad::GeneralFad< T, Storage >::operator *= ( const T &  x  )  [inline]

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

Definition at line 164 of file Sacado_CacheFad_GeneralFadImp.hpp.

template<typename T, typename Storage>
Sacado::CacheFad::GeneralFad< T, Storage > & Sacado::CacheFad::GeneralFad< T, Storage >::operator/= ( const T &  x  )  [inline]

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

Definition at line 177 of file Sacado_CacheFad_GeneralFadImp.hpp.

template<typename T, typename Storage>
template<typename S>
Sacado::CacheFad::GeneralFad< T, Storage > & Sacado::CacheFad::GeneralFad< T, Storage >::operator+= ( const Expr< S > &  x  )  [inline]

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

Definition at line 191 of file Sacado_CacheFad_GeneralFadImp.hpp.

template<typename T, typename Storage>
template<typename S>
Sacado::CacheFad::GeneralFad< T, Storage > & Sacado::CacheFad::GeneralFad< T, Storage >::operator-= ( const Expr< S > &  x  )  [inline]

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

Definition at line 230 of file Sacado_CacheFad_GeneralFadImp.hpp.

template<typename T, typename Storage>
template<typename S>
Sacado::CacheFad::GeneralFad< T, Storage > & Sacado::CacheFad::GeneralFad< T, Storage >::operator *= ( const Expr< S > &  x  )  [inline]

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

Definition at line 270 of file Sacado_CacheFad_GeneralFadImp.hpp.

template<typename T, typename Storage>
template<typename S>
Sacado::CacheFad::GeneralFad< T, Storage > & Sacado::CacheFad::GeneralFad< T, Storage >::operator/= ( const Expr< S > &  x  )  [inline]

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

Definition at line 314 of file Sacado_CacheFad_GeneralFadImp.hpp.


Member Data Documentation

template<typename T, typename Storage>
Storage Sacado::CacheFad::GeneralFad< T, Storage >::s_ [protected]

Value & Derivatives.

Definition at line 251 of file Sacado_CacheFad_GeneralFad.hpp.


The documentation for this class was generated from the following files:
Generated on Tue Oct 20 12:55:13 2009 for Sacado Package Browser (Single Doxygen Collection) by doxygen 1.4.7