Sacado Package Browser (Single Doxygen Collection) Version of the Day
Loading...
Searching...
No Matches
Sacado::Fad::Expr< SFadExprTag< T, Num >, ExprSpecDefault > Class Template Reference

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

#include <Sacado_Fad_SFad.hpp>

Inheritance diagram for Sacado::Fad::Expr< SFadExprTag< T, Num >, ExprSpecDefault >:

Public Types

typedef RemoveConst< T >::type value_type
 Typename of values.
typedef ScalarType< value_type >::type scalar_type
 Typename of scalar's (which may be different from T).
typedef SFad< value_type, Num > base_expr_type
 Typename of base-expressions.

Assignment operators

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

Initialization methods

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

Value accessor methods

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

Derivative accessor methods

SACADO_INLINE_FUNCTION int size () const
 Returns number of derivative components.
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.
SACADO_INLINE_FUNCTION const Tdx () const
 Returns derivative array.
SACADO_INLINE_FUNCTION const Tdx (int i) const
 Returns derivative component i with bounds checking.
SACADO_INLINE_FUNCTION TfastAccessDx (int i)
 Returns derivative component i without bounds checking.
SACADO_INLINE_FUNCTION const TfastAccessDx (int i) const
 Returns derivative component i without bounds checking.

Detailed Description

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

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

This classes specializes Expr to SFad expressions.

Definition at line 110 of file Sacado_Fad_SFad.hpp.

Member Typedef Documentation

◆ value_type

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

Typename of values.

Definition at line 115 of file Sacado_Fad_SFad.hpp.

◆ scalar_type

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

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

Definition at line 118 of file Sacado_Fad_SFad.hpp.

◆ base_expr_type

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

Typename of base-expressions.

Definition at line 121 of file Sacado_Fad_SFad.hpp.

Constructor & Destructor Documentation

◆ Expr() [1/6]

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

Default constructor.

Definition at line 130 of file Sacado_Fad_SFad.hpp.

◆ Expr() [2/6]

template<typename T, int Num>
template<typename S>
SACADO_INLINE_FUNCTION Sacado::Fad::Expr< SFadExprTag< T, Num >, ExprSpecDefault >::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 139 of file Sacado_Fad_SFad.hpp.

◆ Expr() [3/6]

template<typename T, int Num>
SACADO_INLINE_FUNCTION Sacado::Fad::Expr< SFadExprTag< T, Num >, ExprSpecDefault >::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 149 of file Sacado_Fad_SFad.hpp.

◆ Expr() [4/6]

template<typename T, int Num>
SACADO_INLINE_FUNCTION Sacado::Fad::Expr< SFadExprTag< T, Num >, ExprSpecDefault >::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 165 of file Sacado_Fad_SFad.hpp.

◆ Expr() [5/6]

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

Copy constructor.

Definition at line 180 of file Sacado_Fad_SFad.hpp.

◆ Expr() [6/6]

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

Copy constructor from any Expression object.

Definition at line 189 of file Sacado_Fad_SFad.hpp.

◆ ~Expr()

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

Destructor.

Definition at line 203 of file Sacado_Fad_SFad.hpp.

Member Function Documentation

◆ diff()

template<typename T, int Num>
SACADO_INLINE_FUNCTION void Sacado::Fad::Expr< SFadExprTag< T, Num >, ExprSpecDefault >::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 213 of file Sacado_Fad_SFad.hpp.

◆ resize()

template<typename T, int Num>
SACADO_INLINE_FUNCTION void Sacado::Fad::Expr< SFadExprTag< T, Num >, ExprSpecDefault >::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 229 of file Sacado_Fad_SFad.hpp.

◆ expand()

template<typename T, int Num>
SACADO_INLINE_FUNCTION void Sacado::Fad::Expr< SFadExprTag< T, Num >, ExprSpecDefault >::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 242 of file Sacado_Fad_SFad.hpp.

◆ zero()

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

Zero out the derivative array.

Definition at line 246 of file Sacado_Fad_SFad.hpp.

◆ setUpdateValue()

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

Set whether this Fad object should update values.

Definition at line 250 of file Sacado_Fad_SFad.hpp.

◆ updateValue()

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

Return whether this Fad object has an updated value.

Definition at line 254 of file Sacado_Fad_SFad.hpp.

◆ cache()

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

Cache values.

Definition at line 258 of file Sacado_Fad_SFad.hpp.

◆ SACADO_ENABLE_EXPR_FUNC()

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

Returns whether two Fad objects have the same values.

Definition at line 263 of file Sacado_Fad_SFad.hpp.

◆ val() [1/2]

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

Returns value.

Definition at line 281 of file Sacado_Fad_SFad.hpp.

◆ val() [2/2]

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

Returns value.

Definition at line 285 of file Sacado_Fad_SFad.hpp.

◆ size()

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

Returns number of derivative components.

Definition at line 296 of file Sacado_Fad_SFad.hpp.

◆ availableSize()

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

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

Definition at line 303 of file Sacado_Fad_SFad.hpp.

◆ hasFastAccess()

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

Returns true if derivative array is not empty.

Definition at line 307 of file Sacado_Fad_SFad.hpp.

◆ isPassive()

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

Returns true if derivative array is empty.

Definition at line 311 of file Sacado_Fad_SFad.hpp.

◆ setIsConstant()

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

Set whether variable is constant.

Definition at line 315 of file Sacado_Fad_SFad.hpp.

◆ dx() [1/2]

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

Returns derivative array.

Definition at line 319 of file Sacado_Fad_SFad.hpp.

◆ dx() [2/2]

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

Returns derivative component i with bounds checking.

Definition at line 323 of file Sacado_Fad_SFad.hpp.

◆ fastAccessDx() [1/2]

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

Returns derivative component i without bounds checking.

Definition at line 327 of file Sacado_Fad_SFad.hpp.

◆ fastAccessDx() [2/2]

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

Returns derivative component i without bounds checking.

Definition at line 331 of file Sacado_Fad_SFad.hpp.

◆ SACADO_ENABLE_VALUE_FUNC()

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

Assignment operator with constant right-hand-side.

Member Data Documentation

◆ val_

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

Value.

Definition at line 503 of file Sacado_Fad_SFad.hpp.


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