CppAD::cg::CG<double>
This is the CppAD
Base
type for the function
cg_fun
.
It is defined by
CppADCodeGen
.
and used to convert the
cg_fun
function object to source code,
compile the source code, and then link the corresponding function evaluation
y = cg_fun.Forward(0, x)
Speed
The conversion to source and linking is expected to take a significant
amount of time and the evaluation of the function is expected to be
much faster; see the following speed tests:
fun_name
This is the name of the code_gen_fun object.
other_fun
This is the name of another code_gen_fun object.
file_name
This is the absolute or relative path for the
file that contains the dynamic library.
It does not include the files extension at the end that is used
for dynamic libraries on this system.
If
cg_fun
is not present in the constructor,
it must have been present in a previous constructor with the same
file_name
.
cg_fun
This is a CppAD function object that corresponds to a function
@(@
f : \B{R}^n \rightarrow \B{R}^m
@)@.
If this arguments is present in the constructor,
a new dynamic library is created.
eval_jac
If this argument is present in the constructor,
it determines which type of Jacobian @(@
f'(x)
@)@ will be enabled.
The possible choices for
eval_jac
are:
eval_jac
Available Jacobian
code_gen_fun::none_enum
none
code_gen_fun::dense_enum
fun_name.jacobian
The default value for
eval_jac
is none.
swap
This exchanges the library in
fun_name
with the library in
other_fun
.
x
is a vector of size
n
specifying the argument value
at which the function will be evaluated.
y
This return value has size
m
and is the value of @(@
f(x)
@)@.
J
This return value has size
m * n
and is the value of
the Jacobian @(@
f'(x)
@)@ where
@[@
J[ i \cdot n + j ] = ( \partial f_i / \partial x_j ) (x)
@]@
Speed
The speed test cppadcg_det_minor.cpp
has the option to pass
the determinant function, or the Jacobian of the determinant function,
to CppADCodeGen (for the same eventual calculation); see
PASS_JACOBIAN_TO_CODE_GEN
.
This test indicates that both methods have similar setup
and derivative calculation times.