source: trunk/example/general/general.cpp @ 3941

Last change on this file since 3941 was 3941, checked in by bradbell, 2 years ago

merge to branch: trunk
from repository: https://github.com/coin-or/CppAD
start hash code: b7056a15a1028d7be587b70a3ecc44b1f42dc05e
end hash code: c8c4cc081accff3628e7e66370ec01e4c99afe8d

commit c8c4cc081accff3628e7e66370ec01e4c99afe8d
Author: Brad Bell <bradbell@…>
Date: Thu Jun 1 23:16:39 2017 -0600

Changes automatically generated by the autotools.

commit f4392bc3eee8f6d0ccd45a0bb3be51181e211680
Author: Brad Bell <bradbell@…>
Date: Thu Jun 1 23:11:56 2017 -0600

  1. Add colpack_jac.cpp example (rename colpack_jac.cpp->colpack_jacobian.cpp).
  2. Add colpack_hescpp example (rename colpack_hes.cpp->colpack_hessian.cpp).


test_one.sh.in: adapt to using test_boolofvoid for testing.
sparse_hes.hpp: fix bug in cppad.symmetric case.

commit 086b8a8709b0c9cb01ce2cf8bc7910e903105ff7
Author: Brad Bell <bradbell@…>
Date: Thu Jun 1 08:54:59 2017 -0600

  1. Fix bug in use of colpack (see kludge in comments).
  2. Fix colpack.symmetric (not general) and add colpack.general.
  3. Deprecate colpack.star.
  4. More autotools from install to deprecated.
  5. Advance to cppad-20170601.

commit 23f26c060648f5c6fc62a1598c659aeccc5ca46f
Author: Brad Bell <bradbell@…>
Date: Tue May 30 08:14:04 2017 -0700

Advance to cppad-20170530.

commit 97f8c08509865d1bfb7ec2e5cd557ddc979f8412
Author: Brad Bell <bradbell@…>
Date: Tue May 30 07:38:47 2017 -0700

debug_rel branch:
There is a problem with speed sparse_hessian debug that goes back to master.
Supresss debug in cppad speed tests until it is fixed.

commit 39ea0d7d9c041784ccd26ce80d19a7ab02752818
Author: Brad Bell <bradbell@…>
Date: Mon May 29 22:34:22 2017 -0700

debug_rel branch:
run_cmake.sh: fix debug_none case.
CMakeLists.txt: use cppad_debug_which to determine debug or release.
CMakeLists.txt: let set_compile_flags determkine build type.

commit 191553e54dca407207789cf0d7c6c27fe6188775
Author: Brad Bell <bradbell@…>
Date: Mon May 29 19:53:08 2017 -0700

debug_rel branch:
Use set_compile_flags in introduction.

commit fba276a84e58d9a0d0944168d5706b7446beb32c
Author: Brad Bell <bradbell@…>
Date: Mon May 29 19:46:30 2017 -0700

debug_rel branch:
Use set_compile_flags in eample/multi_thread subdirectories.

commit 66c8cdb266fa3af29b211b8c870a3aed7a13b021
Author: Brad Bell <bradbell@…>
Date: Mon May 29 18:56:48 2017 -0700

debug_rel branch:
Use set_compile_flags in speed directory.

commit c431b15ee7714d3106234bc527ba2f9a836750e1
Author: Brad Bell <bradbell@…>
Date: Mon May 29 18:36:51 2017 -0700

debug_rel branch:
Convert cppad_ipopt to use set_compile_flags and cppad_debug_which.


CMakeLists.txt: alwasy compile for release to reduce testing time.

commit 2c95b0019f1b665fb14b9f00b049e8b5fb11f89d
Author: Brad Bell <bradbell@…>
Date: Mon May 29 16:55:07 2017 -0700

debug_rel branch:
Add cppad_debug_which to the cmake command line.

commit fd8d1498cf6dc092deca41f764cbb2a001a4cc88
Author: Brad Bell <bradbell@…>
Date: Mon May 29 08:14:23 2017 -0700

debug_rel branch:
Change random_debug_release -> set_compile_flags.

commit 159f5a5aa09012213a52f4ed1c9f0607129a5fe7
Author: Brad Bell <bradbell@…>
Date: Mon May 29 06:50:43 2017 -0700

debug_rel branch:
Update the autotools automatically generated build files.


batch_edit.sh: Start comments about a plan for editing all the source files.
get_sacado.sh: advance to trilions-12.10.11.
makefile.am: advance to trilinos-12.10.1

commit 302153317cd296ec6f927c3202cf96bf38594bbb
Author: Brad Bell <bradbell@…>
Date: Mon May 29 05:20:00 2017 -0700

debug_rel branch:
Add error message if sacado configuration file does not exist.

commit 3f01a631ae808c3a1359e53e1cd55e9a0ea88711
Author: Brad Bell <bradbell@…>
Date: Mon May 29 04:24:00 2017 -0700

debug_rel branch:
CMakeLists.txt: automate naming of libraries Sacado needs.
checkpoint.cpp: fix warnings.

commit dd240928c0c8b6972a8197c985ccc01f08b8886b
Author: Brad Bell <bradbell@…>
Date: Sun May 28 08:25:20 2017 -0700

debug_rel branch:
sparse_sub_hes.cpp: add missing cases found by clang compiler.

commit 30a0c35f1ac50ec425be9a2b7b026284026eccd7
Author: Brad Bell <bradbell@…>
Date: Sun May 28 07:57:36 2017 -0700

debug_rel branch:
eigen_cholesky.hpp: fix compiler warning.
harmonic_time.cpp: remove include that is not used.
forward_active.cpp: fix compiler warning.

commit 4876d14e49dc235865b1574fb38a55cf5ea7a422
Author: Brad Bell <bradbell@…>
Date: Sun May 28 06:19:48 2017 -0700

debug_rel branch:
random_debug_release.cmake: fix comment, remove message replaced by random_choice_0123 in output.
multiple_solution.cpp: fix warnings with clang compiler.
eigen_cholesky.hpp: fix warnings with clang compiler.
compare_change.cpp: fix CPPAD_DEBUG_AND_RELEASE case.

commit 2c51a18f35188d04d2f94069382439580e23f4ac
Author: Brad Bell <bradbell@…>
Date: Sat May 27 21:04:37 2017 -0700

debug_rel branch:
Advance version to cppad-20170527.

commit 4500887b362537774b05e954ad2a95b65a7b8ba0
Author: Brad Bell <bradbell@…>
Date: Sat May 27 09:04:56 2017 -0700

debug_rel branch:
Ramdomly select debug or release flags in example directory.


CMakeLists.txt: always debug for multi_threed examples.

commit 140b5269a0b1a30643894e5a7a8c9a5eb1310301
Author: Brad Bell <bradbell@…>
Date: Sat May 27 08:10:51 2017 -0700

debug_rel branch:
Changing how we set all debug and release flags.

commit e6fb2639db1288fb75de4030b5906df1e41756f9
Author: Brad Bell <bradbell@…>
Date: Sat May 27 07:30:24 2017 -0700

debug_rel branch:
Replace use of cppad_extra_debug by CPPAD_DEBUG_AND_RELEASE.

commit fbbfd0f6e94862174a8a7a17308489ffddb28084
Author: Brad Bell <bradbell@…>
Date: Sat May 27 05:55:58 2017 -0700

debug_rel branch:
Improve random selection of which files are build for release or debug.


forward.cpp: use new -DCPPAD_DEBUG_AND_RELEASE flag.

commit 284be366fb5e2f685a0c71ea6a0e3f74584bf187
Author: Brad Bell <bradbell@…>
Date: Thu May 25 07:39:32 2017 -0700

debug_rel branch:
Add test that failed before change to player.


player.hpp: Fix so it has the same size in debug and release more.
checkpoint.cpp: fix warning when compiling for release.
run_cmake.sh: prepare to use random number to switch debug and release set.
CMakeLists.txt: switch to only test debug (for now).

commit f32375b77e3825628fee6cb160f691a32c48b796
Author: Brad Bell <bradbell@…>
Date: Wed May 24 12:04:27 2017 -0700

debug_rel branch:
forward.cpp: fix a warning during release build.

commit 5fcc7eb78ae8de9f1dbc6c4f0c76fe38e8aeba95
Author: Brad Bell <bradbell@…>
Date: Wed May 24 10:11:12 2017 -0700

debug_rel branch:
CMakeLists.txt: make easy to mix debug and release builds.
eigen_mat_inv.hpp: fix release version warning.

commit 696266f3d62079f5e3bfb1a0f60a7e4f8134e068
Author: Brad Bell <bradbell@…>
Date: Wed May 24 05:43:29 2017 -0700

push_git2svn.py: user ./build in place of ./build/work.
testvector.hpp: improve comments about replacing CPPAD_TESTVECTOR.

File size: 9.3 KB
Line 
1/* --------------------------------------------------------------------------
2CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-17 Bradley M. Bell
3
4CppAD is distributed under multiple licenses. This distribution is under
5the terms of the
6                    Eclipse Public License Version 1.0.
7
8A copy of this license is included in the COPYING file of this distribution.
9Please visit http://www.coin-or.org/CppAD/ for information on other licenses.
10-------------------------------------------------------------------------- */
11
12/*
13$begin general.cpp$$
14$spell
15        Cpp
16$$
17
18$section CppAD Examples and Tests$$
19
20$head Running Tests$$
21To build this program and run its correctness tests see $cref cmake_check$$.
22
23$code
24$srcfile%example/general/general.cpp%0%// BEGIN C++%// END C++%1%$$
25$$
26
27$end
28*/
29// BEGIN C++
30
31// CPPAD_HAS_* defines
32# include <cppad/configure.hpp>
33
34// system include files used for I/O
35# include <iostream>
36
37// C style asserts
38# include <cassert>
39
40// standard string
41# include <string>
42
43// memory utility
44# include <cppad/utility/thread_alloc.hpp>
45
46// test runner
47# include <cppad/utility/test_boolofvoid.hpp>
48
49// prototype external compiled tests (this line expected by bin/new_test.sh)
50extern bool abort_recording(void);
51extern bool fabs(void);
52extern bool acosh(void);
53extern bool acos(void);
54extern bool ad_assign(void);
55extern bool ad_ctor(void);
56extern bool AddEq(void);
57extern bool Add(void);
58extern bool ad_fun(void);
59extern bool ad_in_c(void);
60extern bool ad_input(void);
61extern bool ad_output(void);
62extern bool asinh(void);
63extern bool asin(void);
64extern bool atan2(void);
65extern bool atanh(void);
66extern bool atan(void);
67extern bool azmul(void);
68extern bool base_require(void);
69extern bool BenderQuad(void);
70extern bool BoolFun(void);
71extern bool capacity_order(void);
72extern bool change_param(void);
73extern bool check_for_nan(void);
74extern bool compare_change(void);
75extern bool Compare(void);
76extern bool complex_poly(void);
77extern bool CondExp(void);
78extern bool Cosh(void);
79extern bool Cos(void);
80extern bool DivEq(void);
81extern bool Div(void);
82extern bool eigen_array(void);
83extern bool eigen_det(void);
84extern bool EqualOpSeq(void);
85extern bool Erf(void);
86extern bool expm1(void);
87extern bool exp(void);
88extern bool ForOne(void);
89extern bool ForTwo(void);
90extern bool forward_dir(void);
91extern bool forward_order(void);
92extern bool Forward(void);
93extern bool fun_assign(void);
94extern bool FunCheck(void);
95extern bool HesLagrangian(void);
96extern bool HesLuDet(void);
97extern bool HesMinorDet(void);
98extern bool Hessian(void);
99extern bool HesTimesDir(void);
100extern bool Independent(void);
101extern bool Integer(void);
102extern bool Interface2C(void);
103extern bool interp_onetape(void);
104extern bool interp_retape(void);
105extern bool JacLuDet(void);
106extern bool JacMinorDet(void);
107extern bool Jacobian(void);
108extern bool log10(void);
109extern bool log1p(void);
110extern bool log(void);
111extern bool LuRatio(void);
112extern bool LuVecADOk(void);
113extern bool MulEq(void);
114extern bool mul_level_adolc_ode(void);
115extern bool mul_level_adolc(void);
116extern bool mul_level_ode(void);
117extern bool mul_level(void);
118extern bool Mul(void);
119extern bool NearEqualExt(void);
120extern bool number_skip(void);
121extern bool NumericType(void);
122extern bool num_limits(void);
123extern bool OdeStiff(void);
124extern bool ode_taylor(void);
125extern bool opt_val_hes(void);
126extern bool ParVar(void);
127extern bool Poly(void);
128extern bool pow_int(void);
129extern bool pow(void);
130extern bool print_for(void);
131extern bool reverse_any(void);
132extern bool reverse_one(void);
133extern bool reverse_three(void);
134extern bool reverse_two(void);
135extern bool RevOne(void);
136extern bool RevTwo(void);
137extern bool Rosen34(void);
138extern bool runge_45_2(void);
139extern bool seq_property(void);
140extern bool sign(void);
141extern bool Sinh(void);
142extern bool Sin(void);
143extern bool Sqrt(void);
144extern bool StackMachine(void);
145extern bool SubEq(void);
146extern bool Sub(void);
147extern bool Tanh(void);
148extern bool Tan(void);
149extern bool TapeIndex(void);
150extern bool UnaryMinus(void);
151extern bool UnaryPlus(void);
152extern bool Value(void);
153extern bool Var2Par(void);
154extern bool vec_ad(void);
155
156// main program that runs all the tests
157int main(void)
158{       std::string group = "example/general";
159        size_t      width = 20;
160        CppAD::test_boolofvoid Run(group, width);
161
162        // This line is used by test_one.sh
163
164        // run external compiled tests (this line expected by bin/new_test.sh)
165        Run( abort_recording,   "abort_recording"  );
166        Run( fabs,              "fabs"             );
167        Run( acos,              "acos"             );
168        Run( acosh,             "acosh"            );
169        Run( ad_assign,         "ad_assign"        );
170        Run( ad_ctor,           "ad_ctor"          );
171        Run( Add,               "Add"              );
172        Run( AddEq,             "AddEq"            );
173        Run( ad_fun,            "ad_fun"           );
174        Run( ad_in_c,           "ad_in_c"          );
175        Run( ad_input,          "ad_input"         );
176        Run( ad_output,         "ad_output"        );
177        Run( asin,              "asin"             );
178        Run( asinh,             "asinh"            );
179        Run( atan2,             "atan2"            );
180        Run( atan,              "atan"             );
181        Run( atanh,             "atanh"            );
182        Run( azmul,             "azmul"            );
183        Run( BenderQuad,        "BenderQuad"       );
184        Run( BoolFun,           "BoolFun"          );
185        Run( capacity_order,    "capacity_order"   );
186        Run( change_param,      "change_param"     );
187        Run( compare_change,    "compare_change"   );
188        Run( Compare,           "Compare"          );
189        Run( complex_poly,      "complex_poly"     );
190        Run( CondExp,           "CondExp"          );
191        Run( Cos,               "Cos"              );
192        Run( Cosh,              "Cosh"             );
193        Run( Div,               "Div"              );
194        Run( DivEq,             "DivEq"            );
195        Run( EqualOpSeq,        "EqualOpSeq"       );
196        Run( Erf,               "Erf"              );
197        Run( exp,               "exp"              );
198        Run( expm1,             "expm1"            );
199        Run( ForOne,            "ForOne"           );
200        Run( ForTwo,            "ForTwo"           );
201        Run( forward_dir,       "forward_dir"      );
202        Run( Forward,           "Forward"          );
203        Run( forward_order,     "forward_order"    );
204        Run( fun_assign,        "fun_assign"       );
205        Run( FunCheck,          "FunCheck"         );
206        Run( HesLagrangian,     "HesLagrangian"    );
207        Run( HesLuDet,          "HesLuDet"         );
208        Run( HesMinorDet,       "HesMinorDet"      );
209        Run( Hessian,           "Hessian"          );
210        Run( HesTimesDir,       "HesTimesDir"      );
211        Run( Independent,       "Independent"      );
212        Run( Integer,           "Integer"          );
213        Run( Interface2C,       "Interface2C"      );
214        Run( interp_onetape,    "interp_onetape"   );
215        Run( interp_retape,     "interp_retape"    );
216        Run( JacLuDet,          "JacLuDet"         );
217        Run( JacMinorDet,       "JacMinorDet"      );
218        Run( Jacobian,          "Jacobian"         );
219        Run( log10,             "log10"            );
220        Run( log1p,             "log1p"            );
221        Run( log,               "log"              );
222        Run( LuRatio,           "LuRatio"          );
223        Run( LuVecADOk,         "LuVecADOk"        );
224        Run( MulEq,             "MulEq"            );
225        Run( mul_level,         "mul_level"        );
226        Run( mul_level_ode,     "mul_level_ode"    );
227        Run( Mul,               "Mul"              );
228        Run( NearEqualExt,      "NearEqualExt"     );
229        Run( number_skip,       "number_skip"      );
230        Run( NumericType,       "NumericType"      );
231        Run( num_limits,        "num_limits"       );
232        Run( OdeStiff,          "OdeStiff"         );
233        Run( ode_taylor,        "ode_taylor"       );
234        Run( opt_val_hes,       "opt_val_hes"      );
235        Run( ParVar,            "ParVar"           );
236        Run( Poly,              "Poly"             );
237        Run( pow_int,           "pow_int"          );
238        Run( pow,               "pow"              );
239        Run( reverse_any,       "reverse_any"      );
240        Run( reverse_one,       "reverse_one"      );
241        Run( reverse_three,     "reverse_three"    );
242        Run( reverse_two,       "reverse_two"      );
243        Run( RevOne,            "RevOne"           );
244        Run( RevTwo,            "RevTwo"           );
245        Run( Rosen34,           "Rosen34"          );
246        Run( runge_45_2,        "runge_45_2"       );
247        Run( seq_property,      "seq_property"     );
248        Run( sign,              "sign"             );
249        Run( Sinh,              "Sinh"             );
250        Run( Sin,               "Sin"              );
251        Run( Sqrt,              "Sqrt"             );
252        Run( StackMachine,      "StackMachine"     );
253        Run( SubEq,             "SubEq"            );
254        Run( Sub,               "Sub"              );
255        Run( Tanh,              "Tanh"             );
256        Run( Tan,               "Tan"              );
257        Run( TapeIndex,         "TapeIndex"        );
258        Run( UnaryMinus,        "UnaryMinus"       );
259        Run( UnaryPlus,         "UnaryPlus"        );
260        Run( Value,             "Value"            );
261        Run( Var2Par,           "Var2Par"          );
262        Run( vec_ad,            "vec_ad"           );
263# ifndef CPPAD_DEBUG_AND_RELEASE
264        Run( check_for_nan,     "check_for_nan"    );
265# endif
266# if CPPAD_HAS_ADOLC
267        Run( mul_level_adolc,      "mul_level_adolc"     );
268        Run( mul_level_adolc_ode,  "mul_level_adolc_ode" );
269# endif
270# if CPPAD_HAS_EIGEN
271        Run( eigen_array,       "eigen_array"      );
272        Run( eigen_det,         "eigen_det"        );
273# endif
274        //
275        // check for memory leak
276        bool memory_ok = CppAD::thread_alloc::free_all();
277        // print summary at end
278        bool ok = Run.summary(memory_ok);
279        //
280        return static_cast<int>( ! ok );
281}
282// END C++
Note: See TracBrowser for help on using the repository browser.