![]() |
Prev | Next | Faq |
Independent(
u);
v =
u[0];
behave differently from the code sequence
v =
u[0];
Independent(
u);
Before the call to Independent
,
u[0
] is a parameter
and after the call it is a variable.
Thus in the first case, v is a variable
and in the second case it is a parameter.
NDEBUG
is true,
you will get an error message stating that
CompareChange
is not a member of the
ADFun
template class.
AD< std::complex<
Base> >
std::complex< AD<
Base> >
Some functions are real differentiable than are not complex differentiable
(for example, the complex abs function
).
If you have to differentiate such functions, you should use
std::complex< AD<
Base >
If you are sure that you will not need to take any real partials
of complex valued function, it is more efficient to use
AD< std::complex<
Base> >
The examples are also used to test the correctness of CppAD
and to check your installation.
For these two uses, it is helpful to run all the tests
and to know which ones failed.
The actual code in CppAD uses the ErrorHandler
utility
to signal exceptions.
Specifications for redefining this action are provided.
Yes (see ForwardZero
).
Yes. The std_math_ad
and MathOther
section contains
a list of the math functions included so far.
Contact the mailing list
cppad@list.coin-or.org
if you need a math function that is has not yet been included.
The example routine LuSolve
can be used to do this
because the inverse is a special case of the solution of linear equations.
The examples
JacLuDet.cpp
and HesLuDet.cpp
use LuSolve to compute derivatives of the
determinant with respect to the components of the matrix.
In general, the best mode depends on the number of domain and range
components in the function that your are differentiating.
Each call to Forward
computes the derivative of all
the range directions with respect to one domain direction.
Each call to Reverse
computes the derivative of one
range direction with respect to all the domain directions.
The times required for (speed of)
calls Forward
and Reverse
are about equal.
The Parameter
function can be used to quickly determine that
some range directions have derivative zero.
CPPAD_TEST_VECTOR
instead of a namespace for
the CppAD test_vector
class ?
The preprocessor symbol
CPPAD_TEST_VECTOR
determines which
SimpleVector
template class is used for extensive testing.
The default definition for CPPAD_TEST_VECTOR
is the
CppAD::vector
template class, but it can be changed.
Note that all the preprocessor symbols that are defined or used
by CppAD begin with either CPPAD
(some old deprecated symbols begin with CppAD
).
using namespace CppAD
is at the global level
(not within a function or some other limited scope).
Some versions of # include <cmath>
for
gcc and Visual C++ define the standard math functions,
(for example double sqrt(double
x)
)
at the global level.
It is necessary to put your using
commands within the scope
of a function,
or some other limited scope,
in order to shadow these improper global definitions.
You should compile your code with optimization, without debugging,
and with the preprocessor symbol NDEBUG
defined.
(The speed_cppad
tests do this.)
Note that defining NDEBUG
will turn off all of the error checking and reporting that
is done using ErrorHandler
.
CppAD uses memory to store a different tape for recording operations
for each AD<
Base>
type that is used.
If you have a very large number calculations that are recorded
on a tape, the tape will keep growing to hold the necessary information.
Eventually, virtual memory may be used to store the tape
and the calculations may slow down because of necessary disk access.