CppAD: A C++ Algorithmic Differentiation Package  20171217
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
testvector.hpp
Go to the documentation of this file.
1 // $Id$
2 # ifndef CPPAD_CORE_TESTVECTOR_HPP
3 # define CPPAD_CORE_TESTVECTOR_HPP
4 
5 /* --------------------------------------------------------------------------
6 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-17 Bradley M. Bell
7 
8 CppAD is distributed under multiple licenses. This distribution is under
9 the terms of the
10  Eclipse Public License Version 1.0.
11 
12 A copy of this license is included in the COPYING file of this distribution.
13 Please visit http://www.coin-or.org/CppAD/ for information on other licenses.
14 -------------------------------------------------------------------------- */
15 
16 /*
17 $begin testvector$$
18 $spell
19  CppAD
20  cmake
21  testvector
22  cppad
23  Eigen
24  ifdef
25  hpp
26  std
27  endif
28  ublas
29 $$
30 
31 
32 $section Using The CppAD Test Vector Template Class$$
33 $mindex CPPAD_TESTVECTOR$$
34 
35 $head Syntax$$
36 $codei%CPPAD_TESTVECTOR(%Scalar%)
37 %$$
38 
39 $head Purpose$$
40 Many of the CppAD $cref/examples/example/$$ and tests use
41 the $code CPPAD_TESTVECTOR$$ template class to pass information to CppAD.
42 This is not a true template class because it's syntax uses
43 $codei%(%Scalar%)%$$ instead of $codei%<%Scalar%>%$$.
44 This enables us to use
45 $codei%
46  Eigen::Matrix<%Scalar%, Eigen::Dynamic, 1>
47 %$$
48 as one of the possible cases for this 'template class'.
49 
50 $head Choice$$
51 The user can choose, during the install procedure,
52 which template class to use in the examples and tests; see below.
53 This shows that any
54 $cref/simple vector/SimpleVector/$$ class can be used in place of
55 $codei%
56  CPPAD_TESTVECTOR(%Type%)
57 %$$
58 When writing their own code,
59 users can choose a specific simple vector they prefer; for example,
60 $codei%
61  CppAD::vector<%Type%>
62 %$$
63 
64 
65 $head CppAD::vector$$
66 If in the $cref/cmake command/cmake/CMake Command/$$
67 you specify $cref cppad_testvector$$ to be $code cppad$$,
68 $code CPPAD_CPPADVECTOR$$ will be true.
69 In this case,
70 $code CPPAD_TESTVECTOR$$ is defined by the following source code:
71 $srccode%cpp% */
72 # if CPPAD_CPPADVECTOR
73 # define CPPAD_TESTVECTOR(Scalar) CppAD::vector< Scalar >
74 # endif
75 /* %$$
76 In this case CppAD will use its own vector for
77 many of its examples and tests.
78 
79 $head std::vector$$
80 If in the cmake command
81 you specify $icode cppad_testvector$$ to be $code std$$,
82 $code CPPAD_STDVECTOR$$ will be true.
83 In this case,
84 $code CPPAD_TESTVECTOR$$ is defined by the following source code:
85 $srccode%cpp% */
86 # if CPPAD_STDVECTOR
87 # include <vector>
88 # define CPPAD_TESTVECTOR(Scalar) std::vector< Scalar >
89 # endif
90 /* %$$
91 In this case CppAD will use standard vector for
92 many of its examples and tests.
93 
94 $head boost::numeric::ublas::vector$$
95 If in the cmake command
96 you specify $icode cppad_testvector$$ to be $code boost$$,
97 $code CPPAD_BOOSTVECTOR$$ will be true.
98 In this case,
99 $code CPPAD_TESTVECTOR$$ is defined by the following source code:
100 $srccode%cpp% */
101 # if CPPAD_BOOSTVECTOR
102 # include <boost/numeric/ublas/vector.hpp>
103 # define CPPAD_TESTVECTOR(Scalar) boost::numeric::ublas::vector< Scalar >
104 # endif
105 /* %$$
106 In this case CppAD will use this boost vector for
107 many of its examples and tests.
108 
109 $head Eigen Vectors$$
110 If in the cmake command
111 you specify $icode cppad_testvector$$ to be $code eigen$$,
112 $code CPPAD_EIGENVECTOR$$ will be true.
113 In this case,
114 $code CPPAD_TESTVECTOR$$ is defined by the following source code:
115 $srccode%cpp% */
116 # if CPPAD_EIGENVECTOR
118 # define CPPAD_TESTVECTOR(Scalar) Eigen::Matrix< Scalar , Eigen::Dynamic, 1>
119 # endif
120 /* %$$
121 In this case CppAD will use the Eigen vector
122 for many of its examples and tests.
123 
124 $end
125 ------------------------------------------------------------------------
126 */
127 
128 # endif