30 #ifndef SACADO_FAD_SIMPLEFAD_HPP 31 #define SACADO_FAD_SIMPLEFAD_HPP 50 template <
typename ValueT>
107 SimpleFad(
const int sz,
const int i,
const ValueT & x) :
117 for (
int i=0; i<this->
size(); i++)
129 if (x.
size() != this->
size())
return false;
130 bool eq = IE::eval(x.
val(), this->
val());
131 for (
int i=0; i<this->
size(); i++)
132 eq = eq && IE::eval(x.
dx(i), this->
dx(i));
137 template <
typename S>
139 GeneralFadType::operator=(v);
145 GeneralFadType::operator=(static_cast<const GeneralFadType&>(x));
150 template <
typename S>
153 GeneralFadType::operator+=(x);
158 template <
typename S>
161 GeneralFadType::operator-=(x);
166 template <
typename S>
169 GeneralFadType::operator*=(x);
174 template <
typename S>
177 GeneralFadType::operator/=(x);
184 GeneralFadType::operator+=(static_cast<const GeneralFadType&>(x));
191 GeneralFadType::operator-=(static_cast<const GeneralFadType&>(x));
198 GeneralFadType::operator*=(static_cast<const GeneralFadType&>(x));
205 GeneralFadType::operator/=(static_cast<const GeneralFadType&>(x));
218 #endif // SACADO_FAD_SIMPLEFAD_HPP
SimpleFad(const SimpleFad &x, const ValueT &v, const ValueT &partial)
Tangent copy constructor.
ScalarType< value_type >::type scalar_type
Typename of scalar's (which may be different from T)
#define SACADO_ENABLE_VALUE_CTOR_DECL
GeneralFadType::scalar_type scalar_type
Typename of scalar's (which may be different from value_type)
RemoveConst< T >::type value_type
Typename of values.
GeneralFad< ValueT, StorageType > GeneralFadType
ScalarType< ValueT >::type ScalarT
Typename of scalar's (which may be different from ValueT)
SimpleFad(const SimpleFad &x)
Copy constructor.
KOKKOS_INLINE_FUNCTION const T & val() const
Returns value.
Forward-mode AD class using dynamic memory allocation but no expression templates.
KOKKOS_INLINE_FUNCTION int size() const
Returns number of derivative components.
SimpleFad()
Default constructor.
#define KOKKOS_INLINE_FUNCTION
SimpleFad(const int sz, const ValueT &x, const DerivInit zero_out=InitDerivArray)
Constructor with size sz and value x.
#define SACADO_ENABLE_VALUE_FUNC(RETURN_TYPE)
KOKKOS_INLINE_FUNCTION const U * dx() const
Returns derivative array.
Base template specification for testing equivalence.
Turn SimpleFad into a meta-function class usable with mpl::apply.
DerivInit
Enum use to signal whether the derivative array should be initialized in AD object constructors...
bool isEqualTo(const SimpleFad &x) const
Returns whether two Fad objects have the same values.
GeneralFadType::value_type value_type
Typename of values.
KOKKOS_INLINE_FUNCTION DynamicStorage & operator=(const DynamicStorage &x)
Assignment.
Initialize the derivative array.
SimpleFad(const int sz, const int i, const ValueT &x)
Constructor with size sz, index i, and value x.
DynamicStorage< ValueT > StorageType
Base classes.
KOKKOS_INLINE_FUNCTION ValueT & fastAccessDx(int i)
Returns derivative component i without bounds checking.
SimpleFad(const S &x, SACADO_ENABLE_VALUE_CTOR_DECL)
Constructor with supplied value x convertible to ValueT.
Forward-mode AD class templated on the storage for the derivative array.