cpp_independent#

View page source

Declare Independent Variables and Start Recording#

Syntax#

ax = cppad_py::independent ( x )
a_both = cppad_py::independent ( x , dynamic )

Purpose#

This starts recording a_double operations. This recording is terminated, and the information is stored, by calling the d_fun_constructor. It can be terminated, and the information is lost, by calling abort_recording.

x#

This argument has prototype

      const vec_double& x

Its specifies the number of independent variables and their values during the recording. We use the notation nx = x.size () to denote the number of independent variables.

dynamic#

This argument has prototype

      const vec_double& dynamic

Its specifies the number of independent dynamic parameters and their values during the recording. We use the notation nd = dynamic.size () to denote the number of independent variables.

ax#

This result has prototype

      vec_a_double& ax

and is the vector of independent variables. It has size nx and for i = 0 to n -1

      ax [ i ] == x [ i ]

a_both#

this result has prototype

      vec_a_double& a_both

and is the vector of both the independent variables and independent dynamic parameters. It has size nx + nd . For i = 0 to nx -1

      a_both [ i ] == x [ i ]

is the i-th independent variable. For i = 0 to nd -1

      a_both [ nx + i ] == dynamic [ i ]

is the i-th independent dynamic parameter.

Example#

Most of the c++ d_fun examples use the ax return syntax. The fun_dynamic_xam.cpp example uses the a_both return syntax.