@(@\newcommand{\W}[1]{ \; #1 \; }
\newcommand{\R}[1]{ {\rm #1} }
\newcommand{\B}[1]{ {\bf #1} }
\newcommand{\D}[2]{ \frac{\partial #1}{\partial #2} }
\newcommand{\DD}[3]{ \frac{\partial^2 #1}{\partial #2 \partial #3} }
\newcommand{\Dpow}[2]{ \frac{\partial^{#1}}{\partial {#2}^{#1}} }
\newcommand{\dpow}[2]{ \frac{ {\rm d}^{#1}}{{\rm d}\, {#2}^{#1}} }@)@
This is cppad-20221105 documentation. Here is a link to its
current documentation
.
Enable use of AD<Base> where Base is std::complex<double>
Example
The file complex_poly.cpp
contains an example use of
std::complex<double> type for a CppAD
Base
type.
Include Order
This file is included before <cppad/cppad.hpp>
so it is necessary to define the error handler
in addition to including
base_require.hpp
# include <limits>
# include <complex>
# include <cppad/base_require.hpp>
# include <cppad/core/cppad_assert.hpp>
CondExpOp
The type std::complex<double> does not supports the
<, <=, ==, >=, and > operators; see
not ordered
.
Hence its CondExpOp function is defined by
isnan
The gcc 4.1.1 complier defines the function
int std::complex<double>::isnan( std::complex<double> z )
(which is not specified in the C++ 1998 standard ISO/IEC 14882).
This causes an ambiguity between the function above and the CppAD
isnan
template function.
We avoid this ambiguity by defining a non-template version of
this function in the CppAD namespace.
Valid Unary Math
The following macro invocations define the standard unary
math functions that are valid with complex arguments and are
required to use AD< std::complex<double> >.
Invalid Unary Math
The following macro definition and invocations define the standard unary
math functions that are invalid with complex arguments and are
required to use AD< std::complex<double> >.