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 | List of all members
Sacado::Fad::SimpleFad< ValueT > Class Template Reference

Forward-mode AD class using dynamic memory allocation but no expression templates. More...

#include <Sacado_Fad_SimpleFad.hpp>

Inheritance diagram for Sacado::Fad::SimpleFad< ValueT >:
Inheritance graph
[legend]

Classes

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

Public Types

typedef DynamicStorage< ValueT > StorageType
 Base classes. More...
 
typedef GeneralFad< ValueT,
StorageType
GeneralFadType
 
typedef GeneralFadType::value_type value_type
 Typename of values. More...
 
typedef GeneralFadType::scalar_type scalar_type
 Typename of scalar's (which may be different from value_type) More...
 
typedef ScalarType< ValueT >::type ScalarT
 Typename of scalar's (which may be different from ValueT) More...
 
- Public Types inherited from Sacado::Fad::GeneralFad< ValueT, DynamicStorage< ValueT > >
typedef RemoveConst< ValueT >::type value_type
 Typename of values. More...
 
typedef ScalarType< value_type >
::type 
scalar_type
 Typename of scalar's (which may be different from T) More...
 
- Public Types inherited from Sacado::Fad::DynamicStorage< ValueT >
typedef ValueT value_type
 

Public Member Functions

 ~SimpleFad ()
 Destructor. More...
 
bool isEqualTo (const SimpleFad &x) const
 Returns whether two Fad objects have the same values. More...
 
- Public Member Functions inherited from Sacado::Fad::GeneralFad< ValueT, DynamicStorage< ValueT > >
SACADO_INLINE_FUNCTION GeneralFad ()
 Default constructor. More...
 
SACADO_INLINE_FUNCTION GeneralFad (const S &x, SACADO_ENABLE_VALUE_CTOR_DECL)
 Constructor with supplied value x. More...
 
SACADO_INLINE_FUNCTION GeneralFad (const int sz, const ValueT &x, const DerivInit zero_out=InitDerivArray)
 Constructor with size sz and value x. More...
 
SACADO_INLINE_FUNCTION GeneralFad (const int sz, const int i, const ValueT &x)
 Constructor with size sz, index i, and value x. More...
 
SACADO_INLINE_FUNCTION GeneralFad (const DynamicStorage< ValueT > &s)
 Constructor with supplied storage s. More...
 
SACADO_INLINE_FUNCTION GeneralFad (const GeneralFad &x)
 Copy constructor. More...
 
SACADO_INLINE_FUNCTION GeneralFad (const Expr< S > &x, SACADO_ENABLE_EXPR_CTOR_DECL)
 Copy constructor from any Expression object. More...
 
SACADO_INLINE_FUNCTION ~GeneralFad ()
 Destructor. More...
 
SACADO_INLINE_FUNCTION void diff (const int ith, const int n)
 Set GeneralFad object as the ith independent variable. More...
 
SACADO_INLINE_FUNCTION void setUpdateValue (bool update_val)
 Set whether this Fad object should update values. More...
 
SACADO_INLINE_FUNCTION bool updateValue () const
 Return whether this Fad object has an updated value. More...
 
SACADO_INLINE_FUNCTION void cache () const
 Cache values. More...
 
SACADO_INLINE_FUNCTION SACADO_ENABLE_EXPR_FUNC (bool) isEqualTo(const Expr< S > &x) const
 Returns whether two Fad objects have the same values. More...
 
SACADO_INLINE_FUNCTION int availableSize () const
 Returns number of derivative components that can be stored without reallocation. More...
 
SACADO_INLINE_FUNCTION bool hasFastAccess () const
 Returns true if derivative array is not empty. More...
 
SACADO_INLINE_FUNCTION bool isPassive () const
 Returns true if derivative array is empty. More...
 
SACADO_INLINE_FUNCTION void setIsConstant (bool is_const)
 Set whether variable is constant. More...
 
- Public Member Functions inherited from Sacado::Fad::DynamicStorage< ValueT >
SACADO_INLINE_FUNCTION DynamicStorage (const S &x, SACADO_ENABLE_VALUE_CTOR_DECL)
 Default constructor. More...
 
SACADO_INLINE_FUNCTION DynamicStorage (const int sz, const ValueT &x, const DerivInit zero_out=InitDerivArray)
 Constructor with size sz. More...
 
SACADO_INLINE_FUNCTION DynamicStorage (const DynamicStorage &x)
 Copy constructor. More...
 
SACADO_INLINE_FUNCTION ~DynamicStorage ()
 Destructor. More...
 
SACADO_INLINE_FUNCTION
DynamicStorage
operator= (const DynamicStorage &x)
 Assignment. More...
 
SACADO_INLINE_FUNCTION int size () const
 Returns number of derivative components. More...
 
SACADO_INLINE_FUNCTION int length () const
 Returns array length. More...
 
SACADO_INLINE_FUNCTION void resize (int sz)
 Resize the derivative array to sz. More...
 
SACADO_INLINE_FUNCTION void resizeAndZero (int sz)
 Resize the derivative array to sz. More...
 
SACADO_INLINE_FUNCTION void expand (int sz)
 Expand derivative array to size sz. More...
 
SACADO_INLINE_FUNCTION void zero ()
 Zero out derivative array. More...
 
SACADO_INLINE_FUNCTION const
ValueT & 
val () const
 Returns value. More...
 
SACADO_INLINE_FUNCTION ValueT & val ()
 Returns value. More...
 
SACADO_INLINE_FUNCTION const
ValueT * 
dx () const
 Returns derivative array. More...
 
SACADO_INLINE_FUNCTION ValueT dx (int i) const
 Returns derivative component i with bounds checking. More...
 
SACADO_INLINE_FUNCTION ValueT & fastAccessDx (int i)
 Returns derivative component i without bounds checking. More...
 
SACADO_INLINE_FUNCTION const
ValueT & 
fastAccessDx (int i) const
 Returns derivative component i without bounds checking. More...
 

Initialization methods

 SimpleFad ()
 Default constructor. More...
 
template<typename S >
 SimpleFad (const S &x, SACADO_ENABLE_VALUE_CTOR_DECL)
 Constructor with supplied value x convertible to ValueT. More...
 
 SimpleFad (const int sz, const ValueT &x, const DerivInit zero_out=InitDerivArray)
 Constructor with size sz and value x. More...
 
 SimpleFad (const int sz, const int i, const ValueT &x)
 Constructor with size sz, index i, and value x. More...
 
 SimpleFad (const SimpleFad &x)
 Copy constructor. More...
 
 SimpleFad (const SimpleFad &x, const ValueT &v, const ValueT &partial)
 Tangent copy constructor. More...
 

Additional Inherited Members

- Protected Attributes inherited from Sacado::Fad::DynamicStorage< ValueT >
ValueT val_
 Value. More...
 
int sz_
 Derivative array size. More...
 
int len_
 Derivative array length. More...
 
ValueT * dx_
 Derivative array. More...
 

Detailed Description

template<typename ValueT>
class Sacado::Fad::SimpleFad< ValueT >

Forward-mode AD class using dynamic memory allocation but no expression templates.

This is the 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::Fad::GeneralFad.

Definition at line 52 of file Sacado_Fad_SimpleFad.hpp.

Member Typedef Documentation

template<typename ValueT>
typedef DynamicStorage<ValueT> Sacado::Fad::SimpleFad< ValueT >::StorageType

Base classes.

Definition at line 57 of file Sacado_Fad_SimpleFad.hpp.

template<typename ValueT>
typedef GeneralFad<ValueT,StorageType> Sacado::Fad::SimpleFad< ValueT >::GeneralFadType

Definition at line 58 of file Sacado_Fad_SimpleFad.hpp.

template<typename ValueT>
typedef GeneralFadType::value_type Sacado::Fad::SimpleFad< ValueT >::value_type

Typename of values.

Definition at line 61 of file Sacado_Fad_SimpleFad.hpp.

template<typename ValueT>
typedef GeneralFadType::scalar_type Sacado::Fad::SimpleFad< ValueT >::scalar_type

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

Definition at line 64 of file Sacado_Fad_SimpleFad.hpp.

template<typename ValueT>
typedef ScalarType<ValueT>::type Sacado::Fad::SimpleFad< ValueT >::ScalarT

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

Definition at line 67 of file Sacado_Fad_SimpleFad.hpp.

Constructor & Destructor Documentation

template<typename ValueT>
Sacado::Fad::SimpleFad< ValueT >::SimpleFad ( )
inline

Default constructor.

Initializes value to 0 and derivative array is empty

Definition at line 84 of file Sacado_Fad_SimpleFad.hpp.

template<typename ValueT>
template<typename S >
Sacado::Fad::SimpleFad< ValueT >::SimpleFad ( const S &  x,
SACADO_ENABLE_VALUE_CTOR_DECL   
)
inline

Constructor with supplied value x convertible to ValueT.

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

Definition at line 92 of file Sacado_Fad_SimpleFad.hpp.

template<typename ValueT>
Sacado::Fad::SimpleFad< ValueT >::SimpleFad ( const int  sz,
const ValueT &  x,
const DerivInit  zero_out = InitDerivArray 
)
inline

Constructor with size sz and value x.

Initializes value to x and derivative array 0 of length sz

Definition at line 99 of file Sacado_Fad_SimpleFad.hpp.

template<typename ValueT>
Sacado::Fad::SimpleFad< ValueT >::SimpleFad ( 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 108 of file Sacado_Fad_SimpleFad.hpp.

template<typename ValueT>
Sacado::Fad::SimpleFad< ValueT >::SimpleFad ( const SimpleFad< ValueT > &  x)
inline

Copy constructor.

Definition at line 112 of file Sacado_Fad_SimpleFad.hpp.

template<typename ValueT>
Sacado::Fad::SimpleFad< ValueT >::SimpleFad ( const SimpleFad< ValueT > &  x,
const ValueT &  v,
const ValueT &  partial 
)
inline

Tangent copy constructor.

Definition at line 116 of file Sacado_Fad_SimpleFad.hpp.

template<typename ValueT>
Sacado::Fad::SimpleFad< ValueT >::~SimpleFad ( )
inline

Destructor.

Definition at line 125 of file Sacado_Fad_SimpleFad.hpp.

Member Function Documentation

template<typename ValueT>
bool Sacado::Fad::SimpleFad< ValueT >::isEqualTo ( const SimpleFad< ValueT > &  x) const
inline

Returns whether two Fad objects have the same values.

Definition at line 128 of file Sacado_Fad_SimpleFad.hpp.


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