Sacado  Development
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends 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]
Collaboration diagram for Sacado::Fad::SimpleFad< ValueT >:
Collaboration 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.
 
typedef GeneralFad< ValueT,
StorageType
GeneralFadType
 
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
 

Public Member Functions

 ~SimpleFad ()
 Destructor.
 
bool isEqualTo (const SimpleFad &x) const
 Returns whether two Fad objects have the same values.
 
template<typename S >
Sacado::mpl::enable_if
< Sacado::mpl::is_convertible
< S, value_type >, SimpleFad & >
::type 
operator= (const S &v)
 Assignment operator with constant right-hand-side.
 
SimpleFadoperator= (const SimpleFad &x)
 Assignment operator with SimpleFad right-hand-side.
 
template<typename S >
Sacado::mpl::enable_if
< Sacado::mpl::is_convertible
< S, value_type >, SimpleFad & >
::type 
operator+= (const S &x)
 Addition-assignment operator with constant right-hand-side.
 
template<typename S >
Sacado::mpl::enable_if
< Sacado::mpl::is_convertible
< S, value_type >, SimpleFad & >
::type 
operator-= (const S &x)
 Subtraction-assignment operator with constant right-hand-side.
 
template<typename S >
Sacado::mpl::enable_if
< Sacado::mpl::is_convertible
< S, value_type >, SimpleFad & >
::type 
operator*= (const S &x)
 Multiplication-assignment operator with constant right-hand-side.
 
template<typename S >
Sacado::mpl::enable_if
< Sacado::mpl::is_convertible
< S, value_type >, SimpleFad & >
::type 
operator/= (const S &x)
 Division-assignment operator with constant right-hand-side.
 
SimpleFadoperator+= (const SimpleFad &x)
 Addition-assignment operator with SimpleFad right-hand-side.
 
SimpleFadoperator-= (const SimpleFad &x)
 Subtraction-assignment operator with SimpleFad right-hand-side.
 
SimpleFadoperator*= (const SimpleFad &x)
 Multiplication-assignment operator with SimpleFad right-hand-side.
 
SimpleFadoperator/= (const SimpleFad &x)
 Division-assignment operator with SimpleFad right-hand-side.
 
Initialization methods
 SimpleFad ()
 Default constructor. More...
 
template<typename S >
 SimpleFad (const S &x, typename Sacado::mpl::enable_if< Sacado::mpl::is_convertible< S, value_type >, void * >::type=0)
 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.
 
 SimpleFad (const SimpleFad &x, const ValueT &v, const ValueT &partial)
 Tangent copy constructor.
 
- Public Member Functions inherited from Sacado::Fad::GeneralFad< ValueT, DynamicStorage< ValueT > >
 GeneralFad ()
 Default constructor.
 
 GeneralFad (const S &x, typename Sacado::mpl::enable_if< Sacado::mpl::is_convertible< S, value_type >, void * >::type=0)
 Constructor with supplied value x. More...
 
 GeneralFad (const int sz, const ValueT &x, const DerivInit zero_out=InitDerivArray)
 Constructor with size sz and value x. More...
 
 GeneralFad (const int sz, const int i, const ValueT &x)
 Constructor with size sz, index i, and value x. More...
 
 GeneralFad (const DynamicStorage< ValueT > &s)
 Constructor with supplied storage s.
 
 GeneralFad (const GeneralFad &x)
 Copy constructor.
 
 GeneralFad (const Expr< S > &x, typename mpl::enable_if_c< mpl::is_convertible< typename Expr< S >::value_type, value_type >::value &&ExprLevel< typename Expr< S >::value_type >::value==ExprLevel< value_type >::value, void * >::type=0)
 Copy constructor from any Expression object.
 
 ~GeneralFad ()
 Destructor.
 
void diff (const int ith, const int n)
 Set GeneralFad object as the ith independent variable. More...
 
void setUpdateValue (bool update_val)
 Set whether this Fad object should update values.
 
bool updateValue () const
 Return whether this Fad object has an updated value.
 
void cache () const
 Cache values.
 
mpl::enable_if_c
< mpl::is_convertible
< typename Expr< S >
::value_type, value_type >
::value &&ExprLevel< typename
Expr< S >::value_type >::value==ExprLevel
< value_type >::value, bool >
::type 
isEqualTo (const Expr< S > &x) const
 Returns whether two Fad objects have the same values.
 
int availableSize () const
 Returns number of derivative components that can be stored without reallocation.
 
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.
 
Sacado::mpl::enable_if
< Sacado::mpl::is_convertible
< S, value_type >, GeneralFad & >
::type 
operator= (const S &v)
 Assignment operator with constant right-hand-side.
 
GeneralFadoperator= (const GeneralFad &x)
 Assignment with GeneralFad right-hand-side.
 
mpl::enable_if_c
< mpl::is_convertible
< typename Expr< S >
::value_type, value_type >
::value &&ExprLevel< typename
Expr< S >::value_type >::value==ExprLevel
< value_type >::value,
GeneralFad & >::type 
operator= (const Expr< S > &x)
 Assignment operator with any expression right-hand-side.
 
Sacado::mpl::enable_if
< Sacado::mpl::is_convertible
< S, value_type >, GeneralFad & >
::type 
operator+= (const S &v)
 Addition-assignment operator with constant right-hand-side.
 
GeneralFadoperator+= (const GeneralFad &x)
 Addition-assignment operator with GeneralFad right-hand-side.
 
mpl::enable_if_c
< mpl::is_convertible
< typename Expr< S >
::value_type, value_type >
::value &&ExprLevel< typename
Expr< S >::value_type >::value==ExprLevel
< value_type >::value,
GeneralFad & >::type 
operator+= (const Expr< S > &x)
 Addition-assignment operator with Expr right-hand-side.
 
Sacado::mpl::enable_if
< Sacado::mpl::is_convertible
< S, value_type >, GeneralFad & >
::type 
operator-= (const S &v)
 Subtraction-assignment operator with constant right-hand-side.
 
GeneralFadoperator-= (const GeneralFad &x)
 Subtraction-assignment operator with GeneralFad right-hand-side.
 
mpl::enable_if_c
< mpl::is_convertible
< typename Expr< S >
::value_type, value_type >
::value &&ExprLevel< typename
Expr< S >::value_type >::value==ExprLevel
< value_type >::value,
GeneralFad & >::type 
operator-= (const Expr< S > &x)
 Subtraction-assignment operator with Expr right-hand-side.
 
Sacado::mpl::enable_if
< Sacado::mpl::is_convertible
< S, value_type >, GeneralFad & >
::type 
operator*= (const S &v)
 Multiplication-assignment operator with constant right-hand-side.
 
GeneralFadoperator*= (const GeneralFad &x)
 Multiplication-assignment operator with GeneralFad right-hand-side.
 
mpl::enable_if_c
< mpl::is_convertible
< typename Expr< S >
::value_type, value_type >
::value &&ExprLevel< typename
Expr< S >::value_type >::value==ExprLevel
< value_type >::value,
GeneralFad & >::type 
operator*= (const Expr< S > &x)
 Multiplication-assignment operator with Expr right-hand-side.
 
Sacado::mpl::enable_if
< Sacado::mpl::is_convertible
< S, value_type >, GeneralFad & >
::type 
operator/= (const S &v)
 Division-assignment operator with constant right-hand-side.
 
GeneralFadoperator/= (const GeneralFad &x)
 Division-assignment operator with GeneralFad right-hand-side.
 
mpl::enable_if_c
< mpl::is_convertible
< typename Expr< S >
::value_type, value_type >
::value &&ExprLevel< typename
Expr< S >::value_type >::value==ExprLevel
< value_type >::value,
GeneralFad & >::type 
operator/= (const Expr< S > &x)
 Division-assignment operator with Expr right-hand-side.
 
- Public Member Functions inherited from Sacado::Fad::DynamicStorage< ValueT >
 DynamicStorage (const S &x, SACADO_ENABLE_VALUE_CTOR_DECL)
 Default constructor.
 
 DynamicStorage (const int sz, const ValueT &x, const DerivInit zero_out=InitDerivArray)
 Constructor with size sz. More...
 
 DynamicStorage (const DynamicStorage &x)
 Copy constructor.
 
 ~DynamicStorage ()
 Destructor.
 
DynamicStorageoperator= (const DynamicStorage &x)
 Assignment.
 
int size () const
 Returns number of derivative components.
 
int length () const
 Returns array length.
 
void resize (int sz)
 Resize the derivative array to sz. More...
 
void resizeAndZero (int sz)
 Resize the derivative array to sz. More...
 
void expand (int sz)
 Expand derivative array to size sz. More...
 
void zero ()
 Zero out derivative array.
 
const ValueT & val () const
 Returns value.
 
ValueT & val ()
 Returns value.
 
const ValueT * dx () const
 Returns derivative array.
 
ValueT dx (int i) const
 Returns derivative component i with bounds checking.
 
ValueT & fastAccessDx (int i)
 Returns derivative component i without bounds checking.
 
const ValueT & fastAccessDx (int i) const
 Returns derivative component i without bounds checking.
 

Additional Inherited Members

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

Constructor & Destructor Documentation

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

Default constructor.

Initializes value to 0 and derivative array is empty

template<typename ValueT>
template<typename S >
Sacado::Fad::SimpleFad< ValueT >::SimpleFad ( const S &  x,
typename Sacado::mpl::enable_if< Sacado::mpl::is_convertible< S, value_type >, void * >::type  = 0 
)
inline

Constructor with supplied value x convertible to ValueT.

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

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

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.


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