File: general.cpp

package info (click to toggle)
cppad 2026.00.00.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,584 kB
  • sloc: cpp: 112,960; sh: 6,146; ansic: 179; python: 71; sed: 12; makefile: 10
file content (286 lines) | stat: -rw-r--r-- 9,870 bytes parent folder | download
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
284
285
286
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
// SPDX-FileCopyrightText: Bradley M. Bell <bradbell@seanet.com>
// SPDX-FileContributor: 2003-25 Bradley M. Bell
// ----------------------------------------------------------------------------

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

// system include files used for I/O
# include <iostream>

// memory leak checker
# 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 AddZero(void);
extern bool Compare(void);
extern bool CondExp(void);
extern bool CondExpAD(void);
extern bool Cos(void);
extern bool Cosh(void);
extern bool Div(void);
extern bool DivEq(void);
extern bool DivZeroOne(void);
extern bool Exp(void);
extern bool ForHess(void);
extern bool Forward(void);
extern bool FromBase(void);
extern bool FunCheck(void);
extern bool Mul(void);
extern bool MulEq(void);
extern bool MulZeroOne(void);
extern bool Neg(void);
extern bool Poly(void);
extern bool Pow(void);
extern bool PowInt(void);
extern bool RevTwo(void);
extern bool RombergOne(void);
extern bool Rosen34(void);
extern bool Runge45(void);
extern bool SimpleVector(void);
extern bool Sin(void);
extern bool SinCos(void);
extern bool Sinh(void);
extern bool Sqrt(void);
extern bool Sub(void);
extern bool SubEq(void);
extern bool SubZero(void);
extern bool Value(void);
extern bool VecAD(void);
extern bool VecADPar(void);
extern bool VecUnary(void);
extern bool abs_normal(void);
extern bool acos(void);
extern bool acosh(void);
extern bool adfun(void);
extern bool alloc_openmp(void);
extern bool asin(void);
extern bool asinh(void);
extern bool assign(void);
extern bool atan(void);
extern bool atan2(void);
extern bool atanh(void);
extern bool atomic_four(void);
extern bool atomic_three(void);
extern bool azmul(void);
extern bool base2ad(void);
extern bool base_adolc(void);
extern bool base_alloc_test(void);
extern bool base_complex(void);
extern bool bool_sparsity(void);
extern bool check_simple_vector(void);
extern bool chkpoint_one(void);
extern bool chkpoint_two(void);
extern bool compare_change(void);
extern bool cond_exp_rev(void);
extern bool copy(void);
extern bool cpp_graph(void);
extern bool cppad_eigen(void);
extern bool cppad_vector(void);
extern bool dbl_epsilon(void);
extern bool dependency(void);
extern bool eigen_mat_inv(void);
extern bool erf(void);
extern bool expm1(void);
extern bool fabs(void);
extern bool for_hes_sparsity(void);
extern bool for_jac_sparsity(void);
extern bool forward_dir(void);
extern bool forward_order(void);
extern bool hes_sparsity(void);
extern bool ipopt_solve(void);
extern bool jacobian(void);
extern bool json_graph(void);
extern bool log(void);
extern bool log10(void);
extern bool log1p(void);
extern bool mul_cond_rev(void);
extern bool mul_cskip(void);
extern bool mul_level(void);
extern bool mul_zdouble(void);
extern bool near_equal_ext(void);
extern bool new_dynamic(void);
extern bool num_limits(void);
extern bool ode_err_control(void);
extern bool optimize(void);
extern bool parameter(void);
extern bool print_for(void);
extern bool rev_sparse_jac(void);
extern bool reverse(void);
extern bool sparse_hessian(void);
extern bool sparse_jac_work(void);
extern bool sparse_jacobian(void);
extern bool sparse_sub_hes(void);
extern bool sparse_vec_ad(void);
extern bool std_math(void);
extern bool subgraph_1(void);
extern bool subgraph_2(void);
extern bool subgraph_hes2jac(void);
extern bool tan(void);
extern bool to_csrc(void);
extern bool to_string(void);
// END_SORT_THIS_LINE_MINUS_1

// tests in local subdirectory
extern bool is_pod(void);
extern bool json_lexer(void);
extern bool json_parser(void);
extern bool temp_file(void);
extern bool vector_set(void);

// main program that runs all the tests
int main(void)
{  std::string group = "test_more/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( AddZero,         "AddZero"        );
   Run( Compare,         "Compare"        );
   Run( CondExp,         "CondExp"        );
   Run( CondExpAD,       "CondExpAD"      );
   Run( Cos,             "Cos"            );
   Run( Cosh,            "Cosh"           );
   Run( Div,             "Div"            );
   Run( DivEq,           "DivEq"          );
   Run( DivZeroOne,      "DivZeroOne"     );
   Run( Exp,             "Exp"            );
   Run( ForHess,         "ForHess"        );
   Run( Forward,         "Forward"        );
   Run( FromBase,        "FromBase"       );
   Run( FunCheck,        "FunCheck"       );
   Run( Mul,             "Mul"            );
   Run( MulEq,           "MulEq"          );
   Run( MulZeroOne,      "MulZeroOne"     );
   Run( Neg,             "Neg"            );
   Run( Poly,            "Poly"           );
   Run( Pow,             "Pow"            );
   Run( PowInt,          "PowInt"         );
   Run( RevTwo,          "RevTwo"         );
   Run( RombergOne,      "RombergOne"     );
   Run( Rosen34,         "Rosen34"        );
   Run( Runge45,         "Runge45"        );
   Run( SimpleVector,    "SimpleVector"   );
   Run( Sin,             "Sin"            );
   Run( SinCos,          "SinCos"         );
   Run( Sinh,            "Sinh"           );
   Run( Sqrt,            "Sqrt"           );
   Run( Sub,             "Sub"            );
   Run( SubEq,           "SubEq"          );
   Run( SubZero,         "SubZero"        );
   Run( Value,           "Value"          );
   Run( VecAD,           "VecAD"          );
   Run( VecADPar,        "VecADPar"       );
   Run( VecUnary,        "VecUnary"       );
   Run( abs_normal,      "abs_normal"     );
   Run( acos,            "acos"           );
   Run( acosh,           "acosh"          );
   Run( adfun,           "adfun"          );
   Run( asin,            "asin"           );
   Run( asinh,           "asinh"          );
   Run( assign,          "assign"         );
   Run( atan,            "atan"           );
   Run( atan2,           "atan2"          );
   Run( atanh,           "atanh"          );
   Run( atomic_four,     "atomic_four"    );
   Run( atomic_three,    "atomic_three"   );
   Run( azmul,           "azmul"          );
   Run( base2ad,         "base2ad"        );
   Run( base_complex,    "base_complex"   );
   Run( bool_sparsity,   "bool_sparsity"  );
   Run( check_simple_vector, "check_simple_vector" );
   Run( chkpoint_one,    "chkpoint_one"   );
   Run( chkpoint_two,    "chkpoint_two"   );
   Run( compare_change,  "compare_change" );
   Run( cond_exp_rev,    "cond_exp_rev"   );
   Run( copy,            "copy"           );
   Run( cpp_graph,       "cpp_graph"      );
   Run( cppad_vector,    "cppad_vector"   );
   Run( dbl_epsilon,     "dbl_epsilon"    );
   Run( dependency,      "dependency"     );
   Run( erf,             "erf"            );
   Run( expm1,           "expm1"          );
   Run( fabs,            "fabs"           );
   Run( for_hes_sparsity, "for_hes_sparsity" );
   Run( for_jac_sparsity, "for_jac_sparsity" );
   Run( forward_dir,     "forward_dir"    );
   Run( forward_order,   "forward_order"  );
   Run( hes_sparsity,    "hes_sparsity"   );
   Run( jacobian,        "jacobian"       );
   Run( json_graph,      "json_graph"     );
   Run( log,             "log"            );
   Run( log10,           "log10"          );
   Run( log1p,           "log1p"          );
   Run( mul_cond_rev,    "mul_cond_rev"   );
   Run( mul_cskip,       "Mul_cskip"      );
   Run( mul_level,       "mul_level"      );
   Run( mul_zdouble,     "mul_zdouble"    );
   Run( near_equal_ext,  "near_equal_ext" );
   Run( new_dynamic,     "new_dynamic"    );
   Run( num_limits,      "num_limits"     );
   Run( ode_err_control, "ode_err_control");
   Run( optimize,        "optimize"       );
   Run( parameter,       "parameter"      );
   Run( print_for,       "print_for"      );
   Run( rev_sparse_jac,  "rev_sparse_jac" );
   Run( reverse,         "reverse"        );
   Run( sparse_hessian,  "sparse_hessian" );
   Run( sparse_jac_work, "sparse_jac_work");
   Run( sparse_jacobian, "sparse_jacobian");
   Run( sparse_sub_hes,  "sparse_sub_hes" );
   Run( sparse_vec_ad,   "sparse_vec_ad"  );
   Run( std_math,        "std_math"       );
   Run( subgraph_1,      "subgraph_1"     );
   Run( subgraph_2,      "subgraph_2"     );
   Run( subgraph_hes2jac, "subgraph_hes2jac" );
   Run( tan,             "tan"            );
   Run( to_string,       "to_string"      );
   // END_SORT_THIS_LINE_MINUS_1
# if CPPAD_C_COMPILER_GNU_FLAGS || CPPAD_C_COMPILER_MSVC_FLAGS
# if ! CPPAD_LINK_FLAGS_HAS_M32
   Run( to_csrc,         "to_csrc"        );
# endif
# endif
#if CPPAD_HAS_ADOLC
   Run( base_adolc,      "base_adolc"     );
# endif
#if CPPAD_HAS_IPOPT
   Run( ipopt_solve,     "ipopt_solve"    );
# endif
# ifdef CPPAD_OPENMP_TEST
   Run( alloc_openmp,    "alloc_openmp"   );
# endif
# if CPPAD_HAS_EIGEN
   Run( cppad_eigen,     "cppad_eigen"    );
   Run( eigen_mat_inv,   "eigen_mat_inv"  );
# endif
   // local sub-directory
   Run( is_pod,         "is_pod"          );
   Run( json_lexer,     "json_lexer"      );
   Run( json_parser,    "json_parser"     );
   Run( temp_file,       "temp_file"      );
   Run( vector_set,      "vector_set"     );
   //
   // check for memory leak
   bool memory_ok = CppAD::thread_alloc::free_all();
   //
   // Run base_alloc after memory leak check because base_alloc.hpp uses
   // thread_alloc to allocate memory for static copies of nan.
   Run( base_alloc_test,  "base_alloc"    );
   //
   // print summary at end
   bool ok = Run.summary(memory_ok);
   //
   return static_cast<int>( ! ok );
}
// END PROGRAM