File: general.cpp

package info (click to toggle)
cppad 2025.00.00.2-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 11,552 kB
  • sloc: cpp: 112,594; sh: 5,972; ansic: 179; python: 71; sed: 12; makefile: 10
file content (283 lines) | stat: -rw-r--r-- 9,865 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
// SPDX-FileCopyrightText: Bradley M. Bell <bradbell@seanet.com>
// SPDX-FileContributor: 2003-22 Bradley M. Bell
// ----------------------------------------------------------------------------
/*
{xrst_begin general.cpp}

General Examples and Tests Driver
#################################

Running These Tests
*******************
After executing the :ref:`cmake-name` command
form the :ref:`download@Distribution Directory`,
you can build and run these tests with the commands::

   cd build
   make check_example_general

Note that your choice of :ref:`cmake@generator` may require using
an different version of make; e.g., ``ninja`` .

{xrst_literal
   // BEGIN C++
   // END C++
}

{xrst_end general.cpp}
-------------------------------------------------------------------------------
*/
// BEGIN C++

// CPPAD_HAS_* defines
# include <cppad/configure.hpp>

// standard string
# include <string>

// memory utility
# include <cppad/utility/thread_alloc.hpp>

// test runner
# include <cppad/utility/test_boolofvoid.hpp>

// BEGIN_SORT_THIS_LINE_PLUS_1
extern bool Add(void);
extern bool AddEq(void);
extern bool BenderQuad(void);
extern bool BoolFun(void);
extern bool Compare(void);
extern bool CondExp(void);
extern bool Cos(void);
extern bool Cosh(void);
extern bool Div(void);
extern bool DivEq(void);
extern bool EqualOpSeq(void);
extern bool ForOne(void);
extern bool ForTwo(void);
extern bool Forward(void);
extern bool FunCheck(void);
extern bool HesLagrangian(void);
extern bool HesLuDet(void);
extern bool HesMinorDet(void);
extern bool HesTimesDir(void);
extern bool Hessian(void);
extern bool Independent(void);
extern bool Integer(void);
extern bool Interface2C(void);
extern bool JacLuDet(void);
extern bool JacMinorDet(void);
extern bool Jacobian(void);
extern bool LuRatio(void);
extern bool Mul(void);
extern bool MulEq(void);
extern bool NumericType(void);
extern bool OdeStiff(void);
extern bool RevOne(void);
extern bool RevTwo(void);
extern bool Sin(void);
extern bool Sinh(void);
extern bool Sqrt(void);
extern bool StackMachine(void);
extern bool Sub(void);
extern bool SubEq(void);
extern bool Tan(void);
extern bool Tanh(void);
extern bool TapeIndex(void);
extern bool Value(void);
extern bool Var2Par(void);
extern bool abort_recording(void);
extern bool acos(void);
extern bool acosh(void);
extern bool ad_assign(void);
extern bool ad_ctor(void);
extern bool ad_fun(void);
extern bool ad_in_c(void);
extern bool ad_input(void);
extern bool ad_output(void);
extern bool asin(void);
extern bool asinh(void);
extern bool atan(void);
extern bool atan2(void);
extern bool atanh(void);
extern bool azmul(void);
extern bool base2ad(void);
extern bool base2vec_ad(void);
extern bool base_require(void);
extern bool capacity_order(void);
extern bool change_param(void);
extern bool check_for_nan(void);
extern bool complex_poly(void);
extern bool con_dyn_var(void);
extern bool eigen_array(void);
extern bool eigen_det(void);
extern bool erf(void);
extern bool erfc(void);
extern bool exp(void);
extern bool expm1(void);
extern bool fabs(void);
extern bool forward_dir(void);
extern bool forward_order(void);
extern bool fun_assign(void);
extern bool fun_property(void);
extern bool function_name(void);
extern bool interp_onetape(void);
extern bool interp_retape(void);
extern bool log(void);
extern bool log10(void);
extern bool log1p(void);
extern bool lu_vec_ad_ok(void);
extern bool mul_level(void);
extern bool mul_level_adolc(void);
extern bool mul_level_adolc_ode(void);
extern bool mul_level_ode(void);
extern bool near_equal_ext(void);
extern bool new_dynamic(void);
extern bool num_limits(void);
extern bool number_skip(void);
extern bool opt_val_hes(void);
extern bool pow(void);
extern bool pow_nan(void);
extern bool print_for(void);
extern bool rev_checkpoint(void);
extern bool reverse_one(void);
extern bool reverse_three(void);
extern bool reverse_two(void);
extern bool sign(void);
extern bool taylor_ode(void);
extern bool unary_minus(void);
extern bool unary_plus(void);
extern bool vec_ad(void);
// END_SORT_THIS_LINE_MINUS_1

// main program that runs all the tests
int main(void)
{  std::string group = "example/general";
   size_t      width = 20;
   CppAD::test_boolofvoid Run(group, width);

   // This line is used by test_one.sh

   // BEGIN_SORT_THIS_LINE_PLUS_1
   Run( Add,               "Add"              );
   Run( AddEq,             "AddEq"            );
   Run( BenderQuad,        "BenderQuad"       );
   Run( BoolFun,           "BoolFun"          );
   Run( Compare,           "Compare"          );
   Run( CondExp,           "CondExp"          );
   Run( Cos,               "Cos"              );
   Run( Cosh,              "Cosh"             );
   Run( Div,               "Div"              );
   Run( DivEq,             "DivEq"            );
   Run( EqualOpSeq,        "EqualOpSeq"       );
   Run( ForOne,            "ForOne"           );
   Run( ForTwo,            "ForTwo"           );
   Run( Forward,           "Forward"          );
   Run( FunCheck,          "FunCheck"         );
   Run( HesLagrangian,     "HesLagrangian"    );
   Run( HesLuDet,          "HesLuDet"         );
   Run( HesMinorDet,       "HesMinorDet"      );
   Run( HesTimesDir,       "HesTimesDir"      );
   Run( Hessian,           "Hessian"          );
   Run( Independent,       "Independent"      );
   Run( Integer,           "Integer"          );
   Run( Interface2C,       "Interface2C"      );
   Run( JacLuDet,          "JacLuDet"         );
   Run( JacMinorDet,       "JacMinorDet"      );
   Run( Jacobian,          "Jacobian"         );
   Run( LuRatio,           "LuRatio"          );
   Run( Mul,               "Mul"              );
   Run( MulEq,             "MulEq"            );
   Run( NumericType,       "NumericType"      );
   Run( OdeStiff,          "OdeStiff"         );
   Run( RevOne,            "RevOne"           );
   Run( RevTwo,            "RevTwo"           );
   Run( Sin,               "Sin"              );
   Run( Sinh,              "Sinh"             );
   Run( Sqrt,              "Sqrt"             );
   Run( StackMachine,      "StackMachine"     );
   Run( Sub,               "Sub"              );
   Run( SubEq,             "SubEq"            );
   Run( Tan,               "Tan"              );
   Run( Tanh,              "Tanh"             );
   Run( TapeIndex,         "TapeIndex"        );
   Run( Value,             "Value"            );
   Run( Var2Par,           "Var2Par"          );
   Run( abort_recording,   "abort_recording"  );
   Run( acos,              "acos"             );
   Run( acosh,             "acosh"            );
   Run( ad_assign,         "ad_assign"        );
   Run( ad_ctor,           "ad_ctor"          );
   Run( ad_fun,            "ad_fun"           );
   Run( ad_in_c,           "ad_in_c"          );
   Run( ad_input,          "ad_input"         );
   Run( ad_output,         "ad_output"        );
   Run( asin,              "asin"             );
   Run( asinh,             "asinh"            );
   Run( atan,              "atan"             );
   Run( atan2,             "atan2"            );
   Run( atanh,             "atanh"            );
   Run( azmul,             "azmul"            );
   Run( base2ad,           "base2ad"          );
   Run( base2vec_ad,       "base2vec_ad"      );
   Run( base_require,      "base_require"     );
   Run( capacity_order,    "capacity_order"   );
   Run( change_param,      "change_param"     );
   Run( complex_poly,      "complex_poly"     );
   Run( con_dyn_var,       "con_dyn_var"      );
   Run( erf,               "erf"              );
   Run( erfc,              "erfc"             );
   Run( exp,               "exp"              );
   Run( expm1,             "expm1"            );
   Run( fabs,              "fabs"             );
   Run( forward_dir,       "forward_dir"      );
   Run( forward_order,     "forward_order"    );
   Run( fun_assign,        "fun_assign"       );
   Run( fun_property,      "fun_property"     );
   Run( function_name,     "function_name"    );
   Run( interp_onetape,    "interp_onetape"   );
   Run( interp_retape,     "interp_retape"    );
   Run( log,               "log"              );
   Run( log10,             "log10"            );
   Run( log1p,             "log1p"            );
   Run( lu_vec_ad_ok,      "lu_vec_ad_ok"     );
   Run( mul_level,         "mul_level"        );
   Run( mul_level_ode,     "mul_level_ode"    );
   Run( near_equal_ext,    "near_equal_ext"   );
   Run( new_dynamic,       "new_dynamic"      );
   Run( num_limits,        "num_limits"       );
   Run( number_skip,       "number_skip"      );
   Run( opt_val_hes,       "opt_val_hes"      );
   Run( pow,               "pow"              );
   Run( pow_nan,           "pow_nan"          );
   Run( rev_checkpoint,    "rev_checkpoint"   );
   Run( reverse_one,       "reverse_one"      );
   Run( reverse_three,     "reverse_three"    );
   Run( reverse_two,       "reverse_two"      );
   Run( sign,              "sign"             );
   Run( taylor_ode,        "ode_taylor"       );
   Run( unary_minus,       "unary_minus"      );
   Run( unary_plus,        "unary_plus"       );
   Run( vec_ad,            "vec_ad"           );
   // END_SORT_THIS_LINE_MINUS_1
# if ! CPPAD_DEBUG_AND_RELEASE
   Run( check_for_nan,     "check_for_nan"    );
# endif
# if CPPAD_HAS_ADOLC
   Run( mul_level_adolc,      "mul_level_adolc"     );
   Run( mul_level_adolc_ode,  "mul_level_adolc_ode" );
# endif
# if CPPAD_HAS_EIGEN
   Run( eigen_array,       "eigen_array"      );
   Run( eigen_det,         "eigen_det"        );
# endif
   //
   // check for memory leak
   bool memory_ok = CppAD::thread_alloc::free_all();
   // print summary at end
   bool ok = Run.summary(memory_ok);
   //
   return static_cast<int>( ! ok );
}
// END C++