Prev | Next |
# include <cppad/base_require.hpp>
Base
so that the type
AD<Base>
can be used.
Base
type is an advanced use of CppAD.
This part of the CppAD API changes with time. The most common change
is adding more requirements.
Search for base_require
in the
current whats_new
section for these changes.
Base
is
float
,
double
,
std::complex<float>
,
std::complex<double>
,
or
AD<Other>
,
these requirements are provided by including the file
cppad/cppad.hpp
.
In the documentation, The notation @(@
\B{R}
@)@ denotes
the field corresponding to the base type.
Multiplication must be commutative for this field,
but it need not be the reals; e.g., the complex numbers.
cppad/base_require.hpp
,
then provide the specifications below,
and then include the file cppad/cppad.hpp
.
Base
must support all the operations for a
NumericType
.
Base
must support the syntax
os << x
where
os
is an std::ostream&
and
x
is a const base_alloc&
.
For example, see
base_alloc
.
Base
must support the syntax
i = CppAD::Integer(x)
which converts
x
to an int
.
The argument
x
has prototype
const Base& x
and the return value
i
has prototype
int i
Base
version of the Integer
function
can be defined by
namespace CppAD {
inline int Integer(const Base& x)
{ return static_cast<int>(x); }
}
For example, see
base_float
and
base_alloc
.
Base
must support the syntax
z = azmul(x, y)
see; azmul
.
The following preprocessor macro invocation suffices
(for most
Base
types):
namespace CppAD {
CPPAD_AZMUL(Base)
}
where the macro is defined by
# define CPPAD_AZMUL(Base) \ inline Base azmul(const Base& x, const Base& y) \ { Base zero(0.0); \ if( x == zero ) \ return zero; \ return x * y; \ }
base_member | Required Base Class Member Functions |
base_cond_exp | Base Type Requirements for Conditional Expressions |
base_identical | Base Type Requirements for Identically Equal Comparisons |
base_ordered | Base Type Requirements for Ordered Comparisons |
base_std_math | Base Type Requirements for Standard Math Functions |
base_limits | Base Type Requirements for Numeric Limits |
base_to_string | Extending to_string To Another Floating Point Type |
base_hash | Base Type Requirements for Hash Coding Values |
base_example | Example AD Base Types That are not AD<OtherBase> |