Prev Next test_vector

Choosing The Vector Testing Template Class

Syntax
CPPAD_TEST_VECTOR<Scalar>

Introduction
Many of the CppAD examples and tests use the CPPAD_TEST_VECTOR template class to pass information. The default definition for this template class is CppAD::vector .

MS Windows
The include path for boost is not defined in the Windows project files. If we are using Microsofts compiler, the following code overrides the setting of CPPAD_BOOSTVECTOR:
// The next 7 lines are C++ source code.
# ifdef _MSC_VER
# if CPPAD_BOOSTVECTOR
# undef  CPPAD_BOOSTVECTOR
# define CPPAD_BOOSTVECTOR 0
# define CPPAD_CPPADVECTOR 1
# endif
# endif

CppAD::vector
By default CPPAD_CPPADVECTOR is true and CPPAD_TEST_VECTOR is defined by the following source code
// The next 3 line are C++ source code.
# if CPPAD_CPPADVECTOR
# define CPPAD_TEST_VECTOR CppAD::vector
# endif
You can replace this definition of the preprocessor symbol CPPAD_TEST_VECTOR by any other SimpleVector template class. This will test using your replacement template vector class with CppAD.

std::vector
If you specify --with-stdvector on the configure command line during CppAD installation, CPPAD_STDVECTOR is true and CPPAD_TEST_VECTOR is defined by the following source code
// The next 4 lines are C++ source code.
# if CPPAD_STDVECTOR
# include <vector>
# define CPPAD_TEST_VECTOR std::vector
# endif
In this case CppAD will use std::vector for its examples and tests. Use of CppAD::vector, std::vector, and std::valarray with CppAD is always tested to some degree. Specifying --with-stdvector will increase the amount of std::vector testing.

boost::numeric::ublas::vector
If you specify a value for BoostDir on the configure command line during CppAD installation, CPPAD_BOOSTVECTOR is true and CPPAD_TEST_VECTOR is defined by the following source code
// The next 4 lines are C++ source code.
# if CPPAD_BOOSTVECTOR
# include <boost/numeric/ublas/vector.hpp>
# define CPPAD_TEST_VECTOR boost::numeric::ublas::vector
# endif
In this case CppAD will use Ublas vectors for its examples and tests. Use of CppAD::vector, std::vector, and std::valarray with CppAD is always tested to some degree. Specifying BoostDir will increase the amount of Ublas vector testing.

Deprecated
The preprocessor symbol CppADvector is defined to have the same value as CPPAD_TEST_VECTOR but its use is deprecated
# define CppADvector CPPAD_TEST_VECTOR

Input File: cppad/local/test_vector.hpp