![]() |
Prev | Next | link_sparse_hessian |
ok = link_sparse_hessian(
size, repeat, row, col, x, hessian, n_color
)
extern bool link_sparse_hessian( size_t size , size_t repeat , const CppAD::vector<size_t>& row , const CppAD::vector<size_t>& col , CppAD::vector<double>& x , CppAD::vector<double>& hessian , size_t& n_color );
link_sparse_hessian
is in the global namespace,
not the CppAD
namespace.
row
and
col
determine
the sparsity pattern for the Hessian that is computed.
The calculation of this sparsity pattern,
if necessary to compute the Hessian,
is intended to be part of the timing for this test.
size
, referred to as
n
below,
is the dimension of the domain space for
f(x)
.
repeat
is the number of times
to repeat the test
(with a different value for
x
corresponding to
each repetition).
x
is
n
; i.e.,
x.size() == size
.
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.
row
defines the value
K
.
The input value of its elements does not matter.
On output,
all the elements of
row
are between zero and
n-1
.
col
is a vector with size
K
.
The input value of its elements does not matter.
On output,
all the elements of
col
are between zero and
n-1
.
row
and
col
are in row major order; i.e.,
for each
k < row.size()-2
row[k] <= row[k+1]
and if
row[k] == row[k+1]
then
col[k] < col[k+1]
col[k] <= row[k]
.
hessian
is
K
.
The input value of its elements does not matter.
The output value of its elements is the Hessian of the function
f(x)
.
To be more specific, for
k = 0 , \ldots , K-1
,
\DD{f}{ x[ \R{row}[k] ] }{ x[ \R{col}[k] ]} = \R{hessian} [k]
n_color
does not matter. On output,
it is the value n_sweep
corresponding
to the evaluation of
hessian
.
This is also the number of colors corresponding to the
coloring method
,
which can be set to colpack
,
and is otherwise cppad
.
package
is double
,
only the first element of
hessian
is used and it is actually
the value of
f(x)
(derivatives are not computed).