|
Prev | Next | link_sparse_jacobian |
extern bool link_sparse_jacobian(
size_t repeat ,
CppAD::vector<double> &x ,
CppAD::vector<size_t> &i ,
CppAD::vector<size_t> &j ,
CppAD::vector<double> &jacobian
);
i
and a second index vector
j
,
the corresponding function
g : \R^n \rightarrow \R^\ell
is defined by sparse_evaluate
and the index vectors
i
and
j
.
The function
g(x)
is defined by
\[
g_k (x) = \D{f}{x_{i[k]}}
\]
The non-zero entries in the Jacobian of this function have the form
\[
\D{g_k}{x[j[k]]}
\]
or
\[
\D{g_k}{x[i[k]]}
\]
for some
k
between zero and
\ell-1
.
All the other terms of the Jacobian are zero.
repeat
is the number of different functions
g(x)
that the Jacobian is computed for.
Each function corresponds to a randomly chosen index vectors, i.e.,
for each repetition a random choice is made for
i[k]
and
j[k]
for
k = 0 , \ldots , \ell-1
.
x
has prototype
CppAD::vector<double> &x
The size of the vector
x
determines
and is equal to the value of
n
.
The input value of the elements of
x
does not matter.
On output, it has been set to the
argument value for which the function,
or its derivative, is being evaluated.
The value of this vector need not change with each repetition.
i
determines and is equal to
the value of
\ell
.
The input value of the elements of
i
does not matter.
On output, it has been set the first index vector
for the last repetition.
All the elements of
i
must are between zero and
n-1
.
j
is a vector with size
\ell
.
The input value of its elements does not matter.
On output, it has been set the second index vector
for the last repetition.
All the elements of
i
must are between zero and
n-1
.
jacobian
is a vector with
\ell \times n
elements.
The input value of its elements does not matter.
The output value of its elements is the Jacobian of the function
g(x)
that corresponds to output values of
i
,
j
, and
x
.
To be more specific, for
k = 0 , \ldots , \ell - 1
,
m = 0 , \ldots , n-1
,
\[
\D{g_k}{x[m]} (x) = jacobian [ k * \ell + m ]
\]
package
is double,
only the first
\ell
elements of
jacobian
are used and they are set to
the value of
g(x)
(
g'(x)
is not computed).