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 | Public Attributes | Static Public Attributes | List of all members
Sacado::ELRCacheFad::Expr< SFadExprTag< T, Num > > Class Template Reference

Expression template forward-mode AD class with static memory allocation. More...

#include <Sacado_ELRCacheFad_SFad.hpp>

Classes

struct  LocalAccumOp
 

Public Types

typedef RemoveConst< T >::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...
 
typedef SFad< value_type, Num > base_expr_type
 Typename of base-expressions. More...
 

Public Member Functions

template<typename S >
SACADO_INLINE_FUNCTION SACADO_ENABLE_VALUE_FUNC (Expr &) operator
 Assignment operator with constant right-hand-side. More...
 

Public Attributes

T val_
 Value. More...
 

Static Public Attributes

static const int num_args = 1
 Number of arguments. More...
 
static const bool is_linear = true
 Is expression linear. More...
 

Initialization methods

SACADO_INLINE_FUNCTION Expr ()
 Default constructor. More...
 
template<typename S >
SACADO_INLINE_FUNCTION Expr (const S &x, SACADO_ENABLE_VALUE_CTOR_DECL)
 Constructor with supplied value x. More...
 
SACADO_INLINE_FUNCTION Expr (const int sz, const T &x, const DerivInit zero_out=InitDerivArray)
 Constructor with size sz and value x. More...
 
SACADO_INLINE_FUNCTION Expr (const int sz, const int i, const T &x)
 Constructor with size sz, index i, and value x. More...
 
SACADO_INLINE_FUNCTION Expr (const Expr &x)
 Copy constructor. More...
 
template<typename S >
SACADO_INLINE_FUNCTION Expr (const Expr< S > &x, SACADO_ENABLE_EXPR_CTOR_DECL)
 Copy constructor from any Expression object. More...
 
SACADO_INLINE_FUNCTION ~Expr ()
 Destructor. More...
 
SACADO_INLINE_FUNCTION void diff (const int ith, const int n)
 Set Fad object as the ith independent variable. More...
 
SACADO_INLINE_FUNCTION void resize (int sz)
 Resize derivative array to length sz. More...
 
SACADO_INLINE_FUNCTION void expand (int sz)
 Expand derivative array to size sz. More...
 
SACADO_INLINE_FUNCTION void zero ()
 Zero out the derivative array. 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...
 
template<typename S >
SACADO_INLINE_FUNCTION SACADO_ENABLE_EXPR_FUNC (bool) isEqualTo(const Expr< S > &x) const
 Returns whether two Fad objects have the same values. More...
 

Value accessor methods

SACADO_INLINE_FUNCTION const Tval () const
 Returns value. More...
 
SACADO_INLINE_FUNCTION Tval ()
 Returns value. More...
 

Derivative accessor methods

SACADO_INLINE_FUNCTION int size () const
 Returns number of derivative components. 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...
 
SACADO_INLINE_FUNCTION const Tdx () const
 Returns derivative array. More...
 
SACADO_INLINE_FUNCTION const Tdx (int i) const
 Returns derivative component i with bounds checking. More...
 
SACADO_INLINE_FUNCTION TfastAccessDx (int i)
 Returns derivative component i without bounds checking. More...
 
SACADO_INLINE_FUNCTION const TfastAccessDx (int i) const
 Returns derivative component i without bounds checking. More...
 
SACADO_INLINE_FUNCTION void computePartials (const T &bar, value_type partials[]) const
 Return partials w.r.t. arguments. More...
 
SACADO_INLINE_FUNCTION void getTangents (int i, value_type dots[]) const
 Return tangent component i of arguments. More...
 
template<int Arg>
SACADO_INLINE_FUNCTION bool isActive () const
 Return whether argument is active. More...
 
template<int Arg>
SACADO_INLINE_FUNCTION T getTangent (int i) const
 Return tangent component i of argument Arg. More...
 
SACADO_INLINE_FUNCTION const
value_type
getDx (int j) const
 Get dx array. More...
 

Detailed Description

template<typename T, int Num>
class Sacado::ELRCacheFad::Expr< SFadExprTag< T, Num > >

Expression template forward-mode AD class with static memory allocation.

This classes specializes Expr to SFad expressions.

Definition at line 80 of file Sacado_ELRCacheFad_SFad.hpp.

Member Typedef Documentation

template<typename T , int Num>
typedef RemoveConst<T>::type Sacado::ELRCacheFad::Expr< SFadExprTag< T, Num > >::value_type

Typename of values.

Definition at line 85 of file Sacado_ELRCacheFad_SFad.hpp.

template<typename T , int Num>
typedef ScalarType<value_type>::type Sacado::ELRCacheFad::Expr< SFadExprTag< T, Num > >::scalar_type

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

Definition at line 88 of file Sacado_ELRCacheFad_SFad.hpp.

template<typename T , int Num>
typedef SFad<value_type,Num> Sacado::ELRCacheFad::Expr< SFadExprTag< T, Num > >::base_expr_type

Typename of base-expressions.

Definition at line 91 of file Sacado_ELRCacheFad_SFad.hpp.

Constructor & Destructor Documentation

template<typename T , int Num>
SACADO_INLINE_FUNCTION Sacado::ELRCacheFad::Expr< SFadExprTag< T, Num > >::Expr ( )
inline

Default constructor.

Definition at line 106 of file Sacado_ELRCacheFad_SFad.hpp.

template<typename T , int Num>
template<typename S >
SACADO_INLINE_FUNCTION Sacado::ELRCacheFad::Expr< SFadExprTag< T, Num > >::Expr ( const S &  x,
SACADO_ENABLE_VALUE_CTOR_DECL   
)
inline

Constructor with supplied value x.

Initializes value to x and derivative array is empty

Definition at line 114 of file Sacado_ELRCacheFad_SFad.hpp.

template<typename T , int Num>
SACADO_INLINE_FUNCTION Sacado::ELRCacheFad::Expr< SFadExprTag< T, Num > >::Expr ( const int  sz,
const T 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 124 of file Sacado_ELRCacheFad_SFad.hpp.

template<typename T , int Num>
SACADO_INLINE_FUNCTION Sacado::ELRCacheFad::Expr< SFadExprTag< T, Num > >::Expr ( 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 141 of file Sacado_ELRCacheFad_SFad.hpp.

template<typename T , int Num>
SACADO_INLINE_FUNCTION Sacado::ELRCacheFad::Expr< SFadExprTag< T, Num > >::Expr ( const Expr< SFadExprTag< T, Num > > &  x)
inline

Copy constructor.

Definition at line 156 of file Sacado_ELRCacheFad_SFad.hpp.

template<typename T , int Num>
template<typename S >
SACADO_INLINE_FUNCTION Sacado::ELRCacheFad::Expr< SFadExprTag< T, Num > >::Expr ( const Expr< S > &  x,
SACADO_ENABLE_EXPR_CTOR_DECL   
)
inline

Copy constructor from any Expression object.

Definition at line 165 of file Sacado_ELRCacheFad_SFad.hpp.

template<typename T , int Num>
SACADO_INLINE_FUNCTION Sacado::ELRCacheFad::Expr< SFadExprTag< T, Num > >::~Expr ( )
inline

Destructor.

Definition at line 195 of file Sacado_ELRCacheFad_SFad.hpp.

Member Function Documentation

template<typename T , int Num>
SACADO_INLINE_FUNCTION void Sacado::ELRCacheFad::Expr< SFadExprTag< T, Num > >::diff ( const int  ith,
const int  n 
)
inline

Set Fad 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 205 of file Sacado_ELRCacheFad_SFad.hpp.

template<typename T , int Num>
SACADO_INLINE_FUNCTION void Sacado::ELRCacheFad::Expr< SFadExprTag< T, Num > >::resize ( int  sz)
inline

Resize derivative array to length sz.

Since the derivative array length is not dynamic, this method throws an error if compiled with SACADO_DEBUG defined.

Definition at line 221 of file Sacado_ELRCacheFad_SFad.hpp.

template<typename T , int Num>
SACADO_INLINE_FUNCTION void Sacado::ELRCacheFad::Expr< SFadExprTag< T, Num > >::expand ( int  sz)
inline

Expand derivative array to size sz.

Since the derivative array length is not dynamic, this method throws an error if compiled with SACADO_DEBUG defined.

Definition at line 234 of file Sacado_ELRCacheFad_SFad.hpp.

template<typename T , int Num>
SACADO_INLINE_FUNCTION void Sacado::ELRCacheFad::Expr< SFadExprTag< T, Num > >::zero ( )
inline

Zero out the derivative array.

Definition at line 238 of file Sacado_ELRCacheFad_SFad.hpp.

template<typename T , int Num>
SACADO_INLINE_FUNCTION void Sacado::ELRCacheFad::Expr< SFadExprTag< T, Num > >::setUpdateValue ( bool  update_val)
inline

Set whether this Fad object should update values.

Definition at line 242 of file Sacado_ELRCacheFad_SFad.hpp.

template<typename T , int Num>
SACADO_INLINE_FUNCTION bool Sacado::ELRCacheFad::Expr< SFadExprTag< T, Num > >::updateValue ( ) const
inline

Return whether this Fad object has an updated value.

Definition at line 246 of file Sacado_ELRCacheFad_SFad.hpp.

template<typename T , int Num>
SACADO_INLINE_FUNCTION void Sacado::ELRCacheFad::Expr< SFadExprTag< T, Num > >::cache ( ) const
inline

Cache values.

Definition at line 250 of file Sacado_ELRCacheFad_SFad.hpp.

template<typename T , int Num>
template<typename S >
SACADO_INLINE_FUNCTION Sacado::ELRCacheFad::Expr< SFadExprTag< T, Num > >::SACADO_ENABLE_EXPR_FUNC ( bool  ) const
inline

Returns whether two Fad objects have the same values.

Definition at line 255 of file Sacado_ELRCacheFad_SFad.hpp.

template<typename T , int Num>
SACADO_INLINE_FUNCTION const T& Sacado::ELRCacheFad::Expr< SFadExprTag< T, Num > >::val ( ) const
inline

Returns value.

Definition at line 273 of file Sacado_ELRCacheFad_SFad.hpp.

template<typename T , int Num>
SACADO_INLINE_FUNCTION T& Sacado::ELRCacheFad::Expr< SFadExprTag< T, Num > >::val ( )
inline

Returns value.

Definition at line 277 of file Sacado_ELRCacheFad_SFad.hpp.

template<typename T , int Num>
SACADO_INLINE_FUNCTION int Sacado::ELRCacheFad::Expr< SFadExprTag< T, Num > >::size ( ) const
inline

Returns number of derivative components.

Definition at line 288 of file Sacado_ELRCacheFad_SFad.hpp.

template<typename T , int Num>
SACADO_INLINE_FUNCTION int Sacado::ELRCacheFad::Expr< SFadExprTag< T, Num > >::availableSize ( ) const
inline

Returns number of derivative components that can be stored without reallocation.

Definition at line 295 of file Sacado_ELRCacheFad_SFad.hpp.

template<typename T , int Num>
SACADO_INLINE_FUNCTION bool Sacado::ELRCacheFad::Expr< SFadExprTag< T, Num > >::hasFastAccess ( ) const
inline

Returns true if derivative array is not empty.

Definition at line 299 of file Sacado_ELRCacheFad_SFad.hpp.

template<typename T , int Num>
SACADO_INLINE_FUNCTION bool Sacado::ELRCacheFad::Expr< SFadExprTag< T, Num > >::isPassive ( ) const
inline

Returns true if derivative array is empty.

Definition at line 303 of file Sacado_ELRCacheFad_SFad.hpp.

template<typename T , int Num>
SACADO_INLINE_FUNCTION void Sacado::ELRCacheFad::Expr< SFadExprTag< T, Num > >::setIsConstant ( bool  is_const)
inline

Set whether variable is constant.

Definition at line 307 of file Sacado_ELRCacheFad_SFad.hpp.

template<typename T , int Num>
SACADO_INLINE_FUNCTION const T* Sacado::ELRCacheFad::Expr< SFadExprTag< T, Num > >::dx ( ) const
inline

Returns derivative array.

Definition at line 311 of file Sacado_ELRCacheFad_SFad.hpp.

template<typename T , int Num>
SACADO_INLINE_FUNCTION const T& Sacado::ELRCacheFad::Expr< SFadExprTag< T, Num > >::dx ( int  i) const
inline

Returns derivative component i with bounds checking.

Definition at line 315 of file Sacado_ELRCacheFad_SFad.hpp.

template<typename T , int Num>
SACADO_INLINE_FUNCTION T& Sacado::ELRCacheFad::Expr< SFadExprTag< T, Num > >::fastAccessDx ( int  i)
inline

Returns derivative component i without bounds checking.

Definition at line 319 of file Sacado_ELRCacheFad_SFad.hpp.

template<typename T , int Num>
SACADO_INLINE_FUNCTION const T& Sacado::ELRCacheFad::Expr< SFadExprTag< T, Num > >::fastAccessDx ( int  i) const
inline

Returns derivative component i without bounds checking.

Definition at line 323 of file Sacado_ELRCacheFad_SFad.hpp.

template<typename T , int Num>
SACADO_INLINE_FUNCTION void Sacado::ELRCacheFad::Expr< SFadExprTag< T, Num > >::computePartials ( const T bar,
value_type  partials[] 
) const
inline

Return partials w.r.t. arguments.

Definition at line 327 of file Sacado_ELRCacheFad_SFad.hpp.

template<typename T , int Num>
SACADO_INLINE_FUNCTION void Sacado::ELRCacheFad::Expr< SFadExprTag< T, Num > >::getTangents ( int  i,
value_type  dots[] 
) const
inline

Return tangent component i of arguments.

Definition at line 333 of file Sacado_ELRCacheFad_SFad.hpp.

template<typename T , int Num>
template<int Arg>
SACADO_INLINE_FUNCTION bool Sacado::ELRCacheFad::Expr< SFadExprTag< T, Num > >::isActive ( ) const
inline

Return whether argument is active.

Definition at line 340 of file Sacado_ELRCacheFad_SFad.hpp.

template<typename T , int Num>
template<int Arg>
SACADO_INLINE_FUNCTION T Sacado::ELRCacheFad::Expr< SFadExprTag< T, Num > >::getTangent ( int  i) const
inline

Return tangent component i of argument Arg.

Definition at line 345 of file Sacado_ELRCacheFad_SFad.hpp.

template<typename T , int Num>
SACADO_INLINE_FUNCTION const value_type* Sacado::ELRCacheFad::Expr< SFadExprTag< T, Num > >::getDx ( int  j) const
inline

Get dx array.

Definition at line 349 of file Sacado_ELRCacheFad_SFad.hpp.

template<typename T , int Num>
template<typename S >
SACADO_INLINE_FUNCTION Sacado::ELRCacheFad::Expr< SFadExprTag< T, Num > >::SACADO_ENABLE_VALUE_FUNC ( Expr< SFadExprTag< T, Num > > &  )

Assignment operator with constant right-hand-side.

Member Data Documentation

template<typename T , int Num>
const int Sacado::ELRCacheFad::Expr< SFadExprTag< T, Num > >::num_args = 1
static

Number of arguments.

Definition at line 94 of file Sacado_ELRCacheFad_SFad.hpp.

template<typename T , int Num>
const bool Sacado::ELRCacheFad::Expr< SFadExprTag< T, Num > >::is_linear = true
static

Is expression linear.

Definition at line 97 of file Sacado_ELRCacheFad_SFad.hpp.

template<typename T , int Num>
T Sacado::ELRCacheFad::Expr< SFadExprTag< T, Num > >::val_

Value.

Definition at line 601 of file Sacado_ELRCacheFad_SFad.hpp.


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