![]() |
Prev | Next | link_sparse_hessian |
extern bool link_sparse_hessian(
size_t repeat ,
CppAD::vector<double> &x ,
CppAD::vector<size_t> &i ,
CppAD::vector<size_t> &j ,
CppAD::vector<double> &hessian
);
i
and a second index vector
j
,
the corresponding function
f : \R^n \rightarrow \R
is defined by sparse_evaluate
and the index vectors
i
and
j
.
The only non-zero entries in the Hessian of this function have the form
\[
\DD{f}{x[[k]]}{x[j[k]]}
\]
for some
k
between zero and
\ell-1
.
repeat
is the number of different functions
f(x)
that the Hessian 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
.
hessian
is a vector with
n \times n
elements.
The input value of its elements does not matter.
The output value of its elements is the Hessian of the function
f(x)
that corresponds to output values of
i
,
j
, and
x
.
To be more specific, for
k = 0 , \ldots , n-1
,
m = 0 , \ldots , n-1
,
\[
\DD{f}{x[k]}{x[m]} (x) = hessian [ k * n + m ]
\]
package
is double
,
only the first element of
hessian
is used and it is actually
the value of
f(x)
(
f^{(2)} (x)
is not computed).