Using The CppAD Test Vector Template Class
Keywords: using the cppad test vector template class Cppad_testvector syntax introduction cppad::vector std::vector boost::numeric::ublas::vector eigen vectors

| Prev | Next |  |  |  |  | testvector |

Using The CppAD Test Vector Template Class
Syntax
`CPPAD_TESTVECTOR(Scalar)
`
Introduction
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'.
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/local/testvector.hpp