Prev Next testvector

@(@\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}} }@)@
Using The CppAD Test Vector Template Class

Syntax
CPPAD_TESTVECTOR(Scalar)

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
# define CPPAD_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>
# define CPPAD_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>
# define CPPAD_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>
# define CPPAD_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