MCPcopy Create free account
hub / github.com/coin-or/CppAD / store

Function store

example/cppad_code_gen/file.cpp:23–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21
22namespace {
23 void store(const std::string& file_name)
24 { //
25 typedef CppAD::cg::CG<double> c_double;
26 typedef CppAD::AD<c_double> ac_double;
27 typedef CppAD::vector<ac_double> ac_vector;
28 //
29
30 // domain space vector
31 size_t n = 2;
32 ac_vector ac_x(n);
33 for(size_t j = 0; j < n; ++j)
34 ac_x[j] = 1.0 / double(j + 1);
35
36 // declare independent variables and start tape recording
37 CppAD::Independent(ac_x);
38
39 // range space vector
40 size_t m = 3;
41 ac_vector ac_y(m);
42 for(size_t i = 0; i < m; ++i)
43 ac_y[i] = double(i + 1) * sin( ac_x[i % n] );
44
45 // create c_f: x -> y and stop tape recording
46 CppAD::ADFun<c_double> c_f(ac_x, ac_y);
47
48 // create compiled version of c_f
49 code_gen_fun f(file_name, c_f);
50 }
51}
52
53bool file(void)

Callers 1

fileFunction · 0.85

Calls 1

IndependentFunction · 0.50

Tested by

no test coverage detected