Prev Next Index-> contents reference index search external Up-> CppAD Example testvector CppAD-> Install Introduction AD ADFun preprocessor multi_thread utility ipopt_solve Example speed Appendix Example-> get_started.cpp General ExampleUtility ListAllExamples testvector wno_conversion testvector Headings-> Syntax Purpose Choice CppAD::vector std::vector boost::numeric::ublas::vector Eigen Vectors

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> 
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:

# 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
# endif