Purpose
Many of the CppAD examples
and tests use
the CPPAD_TESTVECTOR template class to pass information to CppAD.
This is not a true template class because it's syntax uses
(Scalar)
instead of
<Scalar>
.
This enables us to use
Eigen::Matrix<Scalar, Eigen::Dynamic, 1>
as one of the possible cases for this 'template class'.
Choice
The user can choose, during the install procedure,
which template class to use in the examples and tests; see below.
This shows that any
simple vector
class can be used in place of
CPPAD_TESTVECTOR(Type)
When writing their own code,
users can choose a specific simple vector they prefer; for example,
CppAD::vector<Type>
CppAD::vector
If in the cmake command
you specify cppad_testvector
to be cppad,
CPPAD_CPPADVECTOR will be true.
In this case,
CPPAD_TESTVECTOR is defined by the following source code:
# if CPPAD_CPPADVECTOR
# defineCPPAD_TESTVECTOR(Scalar) CppAD::vector< Scalar >
# endif
In this case CppAD will use its own vector for
many of its examples and tests.
std::vector
If in the cmake command
you specify
cppad_testvector
to be std,
CPPAD_STDVECTOR will be true.
In this case,
CPPAD_TESTVECTOR is defined by the following source code:
# if CPPAD_STDVECTOR
# include <vector>
# defineCPPAD_TESTVECTOR(Scalar) std::vector< Scalar >
# endif
In this case CppAD will use standard vector for
many of its examples and tests.
boost::numeric::ublas::vector
If in the cmake command
you specify
cppad_testvector
to be boost,
CPPAD_BOOSTVECTOR will be true.
In this case,
CPPAD_TESTVECTOR is defined by the following source code:
# if CPPAD_BOOSTVECTOR
# include <boost/numeric/ublas/vector.hpp>
# defineCPPAD_TESTVECTOR(Scalar) boost::numeric::ublas::vector< Scalar >
# endif
In this case CppAD will use this boost vector for
many of its examples and tests.
Eigen Vectors
If in the cmake command
you specify
cppad_testvector
to be eigen,
CPPAD_EIGENVECTOR will be true.
In this case,
CPPAD_TESTVECTOR is defined by the following source code:
# if CPPAD_EIGENVECTOR
# include <cppad/example/cppad_eigen.hpp>
# defineCPPAD_TESTVECTOR(Scalar) Eigen::Matrix< Scalar , Eigen::Dynamic, 1>
# endif
In this case CppAD will use the Eigen vector
for many of its examples and tests.
Input File: cppad/core/testvector.hpp