Sacado Package Browser (Single Doxygen Collection) Version of the Day
Loading...
Searching...
No Matches
Classes | Public Types | 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< ValueTStorageType
 Base classes.
 
typedef GeneralFad< ValueT, StorageTypeGeneralFadType
 
typedef GeneralFadType::value_type value_type
 Typename of values.
 
typedef GeneralFadType::scalar_type scalar_type
 Typename of scalar's (which may be different from value_type)
 
typedef ScalarType< ValueT >::type ScalarT
 Typename of scalar's (which may be different from ValueT)
 
- Public Types inherited from Sacado::Fad::GeneralFad< ValueT, DynamicStorage< ValueT > >
typedef RemoveConst< ValueT >::type value_type
 Typename of values.
 
typedef ScalarType< value_type >::type scalar_type
 Typename of scalar's (which may be different from T)
 
- Public Types inherited from Sacado::Fad::DynamicStorage< ValueT >
typedef ValueT value_type
 

Initialization methods

 SimpleFad ()
 Default constructor.
 
template<typename S >
 SimpleFad (const S &x, SACADO_ENABLE_VALUE_CTOR_DECL)
 Constructor with supplied value x convertible to ValueT.
 
 SimpleFad (const int sz, const ValueT &x, const DerivInit zero_out=InitDerivArray)
 Constructor with size sz and value x.
 
 SimpleFad (const int sz, const int i, const ValueT &x)
 Constructor with size sz, index i, and value x.
 
 SimpleFad (const SimpleFad &x)
 Copy constructor.
 
 SimpleFad (const SimpleFad &x, const ValueT &v, const ValueT &partial)
 Tangent copy constructor.
 
 ~SimpleFad ()
 Destructor.
 
bool isEqualTo (const SimpleFad &x) const
 Returns whether two Fad objects have the same values.
 

Additional Inherited Members

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

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

◆ StorageType

Base classes.

Definition at line 57 of file Sacado_Fad_SimpleFad.hpp.

◆ GeneralFadType

Definition at line 58 of file Sacado_Fad_SimpleFad.hpp.

◆ value_type

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.

◆ scalar_type

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

Definition at line 64 of file Sacado_Fad_SimpleFad.hpp.

◆ ScalarT

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

Definition at line 67 of file Sacado_Fad_SimpleFad.hpp.

Constructor & Destructor Documentation

◆ SimpleFad() [1/6]

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.

◆ SimpleFad() [2/6]

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.

◆ SimpleFad() [3/6]

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.

◆ SimpleFad() [4/6]

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.

◆ SimpleFad() [5/6]

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.

◆ SimpleFad() [6/6]

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.

◆ ~SimpleFad()

Destructor.

Definition at line 125 of file Sacado_Fad_SimpleFad.hpp.

Member Function Documentation

◆ isEqualTo()

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: