Sacado::CacheFad::DFad< ValueT, ScalarT > Class Template Reference

Forward-mode AD class using dynamic memory allocation and caching expression templates. More...

#include <Sacado_CacheFad_DFad.hpp>

Inheritance diagram for Sacado::CacheFad::DFad< ValueT, ScalarT >:

Inheritance graph
[legend]
List of all members.

Initialization methods

 DFad ()
 Default constructor.
 DFad (const ValueT &x)
 Constructor with supplied value x of type ValueT.
 DFad (const ScalarT &x)
 Constructor with supplied value x of type ScalarT.
 DFad (const int sz, const ValueT &x)
 Constructor with size sz and value x.
 DFad (const int sz, const int i, const ValueT &x)
 Constructor with size sz, index i, and value x.
 DFad (const DFad &x)
 Copy constructor.
template<typename S>
 DFad (const Expr< S > &x)
 Copy constructor from any Expression object.

Public Member Functions

 ~DFad ()
 Destructor.
DFadoperator= (const ValueT &val)
 Assignment operator with constant right-hand-side.
DFadoperator= (const ScalarT &val)
 Assignment operator with constant right-hand-side.
DFadoperator= (const DFad &x)
 Assignment operator with DFad right-hand-side.
template<typename S>
DFadoperator= (const Expr< S > &x)
 Assignment operator with any expression right-hand-side.

Detailed Description

template<typename ValueT, typename ScalarT = typename ScalarValueType<ValueT>::type>
class Sacado::CacheFad::DFad< ValueT, ScalarT >

Forward-mode AD class using dynamic memory allocation and caching expression templates.

This is a user-level class for forward mode AD with dynamic memory allocation, and is appropriate for whenever the number of derivative components is not known at compile time. The user interface is provided by Sacado::CacheFad::GeneralFad. It is similar to Sacado::Fad::DFad, except it uses the caching expression templates that cache the results of val() calculations for later dx() calculations. Preliminary testing indicates this is more efficient for deep expressions with large numbers of derivative components, but is less efficient otherwise.

The class is templated on two types, ValueT and ScalarT. Type ValueT is the type for values the derivative class holds, while type ScalarT is the type of basic scalars in the code being differentiated (usually doubles). When computing first derivatives, these two types are generally the same, However when computing higher derivatives, ValueT may be DFad<double> while ScalarT will still be double. Usually ScalarT does not need to be explicitly specified since it can be deduced from ValueT through the template metafunction ScalarValueType.

Definition at line 70 of file Sacado_CacheFad_DFad.hpp.


Constructor & Destructor Documentation

template<typename ValueT, typename ScalarT = typename ScalarValueType<ValueT>::type>
Sacado::CacheFad::DFad< ValueT, ScalarT >::DFad (  )  [inline]

Default constructor.

Initializes value to 0 and derivative array is empty

Definition at line 84 of file Sacado_CacheFad_DFad.hpp.

template<typename ValueT, typename ScalarT = typename ScalarValueType<ValueT>::type>
Sacado::CacheFad::DFad< ValueT, ScalarT >::DFad ( const ValueT &  x  )  [inline]

Constructor with supplied value x of type ValueT.

Initializes value to x and derivative array is empty

Definition at line 91 of file Sacado_CacheFad_DFad.hpp.

template<typename ValueT, typename ScalarT = typename ScalarValueType<ValueT>::type>
Sacado::CacheFad::DFad< ValueT, ScalarT >::DFad ( const ScalarT &  x  )  [inline]

Constructor with supplied value x of type ScalarT.

Initializes value to ValueT(x) and derivative array is empty

Definition at line 98 of file Sacado_CacheFad_DFad.hpp.

template<typename ValueT, typename ScalarT = typename ScalarValueType<ValueT>::type>
Sacado::CacheFad::DFad< ValueT, ScalarT >::DFad ( const int  sz,
const ValueT &  x 
) [inline]

Constructor with size sz and value x.

Initializes value to x and derivative array 0 of length sz

Definition at line 105 of file Sacado_CacheFad_DFad.hpp.

template<typename ValueT, typename ScalarT = typename ScalarValueType<ValueT>::type>
Sacado::CacheFad::DFad< ValueT, ScalarT >::DFad ( const int  sz,
const int  i,
const ValueT &  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 114 of file Sacado_CacheFad_DFad.hpp.

template<typename ValueT, typename ScalarT = typename ScalarValueType<ValueT>::type>
Sacado::CacheFad::DFad< ValueT, ScalarT >::DFad ( const DFad< ValueT, ScalarT > &  x  )  [inline]

Copy constructor.

Definition at line 118 of file Sacado_CacheFad_DFad.hpp.

template<typename ValueT, typename ScalarT = typename ScalarValueType<ValueT>::type>
template<typename S>
Sacado::CacheFad::DFad< ValueT, ScalarT >::DFad ( const Expr< S > &  x  )  [inline]

Copy constructor from any Expression object.

Definition at line 122 of file Sacado_CacheFad_DFad.hpp.

template<typename ValueT, typename ScalarT = typename ScalarValueType<ValueT>::type>
Sacado::CacheFad::DFad< ValueT, ScalarT >::~DFad (  )  [inline]

Destructor.

Definition at line 128 of file Sacado_CacheFad_DFad.hpp.


Member Function Documentation

template<typename ValueT, typename ScalarT = typename ScalarValueType<ValueT>::type>
DFad& Sacado::CacheFad::DFad< ValueT, ScalarT >::operator= ( const ValueT &  val  )  [inline]

Assignment operator with constant right-hand-side.

Definition at line 131 of file Sacado_CacheFad_DFad.hpp.

template<typename ValueT, typename ScalarT = typename ScalarValueType<ValueT>::type>
DFad& Sacado::CacheFad::DFad< ValueT, ScalarT >::operator= ( const ScalarT &  val  )  [inline]

Assignment operator with constant right-hand-side.

Definition at line 137 of file Sacado_CacheFad_DFad.hpp.

template<typename ValueT, typename ScalarT = typename ScalarValueType<ValueT>::type>
DFad& Sacado::CacheFad::DFad< ValueT, ScalarT >::operator= ( const DFad< ValueT, ScalarT > &  x  )  [inline]

Assignment operator with DFad right-hand-side.

Definition at line 143 of file Sacado_CacheFad_DFad.hpp.

template<typename ValueT, typename ScalarT = typename ScalarValueType<ValueT>::type>
template<typename S>
DFad& Sacado::CacheFad::DFad< ValueT, ScalarT >::operator= ( const Expr< S > &  x  )  [inline]

Assignment operator with any expression right-hand-side.

Definition at line 149 of file Sacado_CacheFad_DFad.hpp.


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