Prev Next

AD<Base> Requirements for Base Type

Syntax
include <cppad/base_require.hpp>


Warning
This is a preliminary version of these specifications and it is subject to change in future versions of CppAD.

Purpose
This section lists the requirements that the type Base so that the type AD<Base> can be used.

Standard Base Types
In the case where Base is float, double, std::complex<float>, std::complex<double>, or AD<Other> , these requirements are provided by including the file cppad/cppad.hpp.

Include Order
If you are linking a non-standard base type to CppAD, you must first include the file cppad/base_require.hpp/, then provide the specifications below, and then include the file cppad/cppad.hpp.

Numeric Type
The type Base must support all the operations for a NumericType .

Integer
The type Base must support the syntax
     
i = CppAD::Integer(x)
which converts x to an int. The argument x has prototype
     const 
Basex
and the return value i has prototype
     int 
i

Suggestion
In many cases, the 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 float , double , and complex .

epsilon
The template specialization
     
Base CppAD::epsilon<Base>()
must return machine epsilon for the type Base . For example, see float , float , and float ,

isnan
If Base defines the isnan function, you may also have to provide a definition in the CppAD namespace (to avoid a function ambiguity). For example, complex isnan .

Contents
base_cond_expBase Type Requirements for Conditional Expressions
base_identicalBase Type Requirements for Identically Equal Comparisons
base_orderedBase Type Requirements for Ordered Comparisons
base_std_mathBase Type Requirements for Standard Math Functions
base_float.hppEnable use of AD<Base> where Base is float
base_double.hppEnable use of AD<Base> where Base is double
base_complex.hppEnable use of AD<Base> where Base is std::complex<double>
base_adolc.hppEnable use of AD<Base> where Base is Adolc's adouble Type

Input File: cppad/base_require.hpp