![]() |
Prev | Next | link_sparse_hessian |
extern bool link_sparse_hessian(
size_t size ,
size_t repeat ,
CppAD::vector<double>& x ,
const CppAD::vector<size_t>& row ,
const CppAD::vector<size_t>& col ,
CppAD::vector<double>& hessian ,
size_t n_sweep
);
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
has prototype
CppAD::vector<double>& x
and its size 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
has prototype
const CppAD::vector<size_t> row
Its size defines the value @(@
K
@)@.
It contains the row indices for the corresponding function @(@
f(x)
@)@.
All the elements of
row
are between zero and @(@
n-1
@)@.
col
has prototype
const CppAD::vector<size_t> col
Its size must be the same as
row
; i.e., @(@
K
@)@.
It contains the column indices for the corresponding function
@(@
f(x)
@)@.
All the elements of
col
are between zero and @(@
n-1
@)@.
There are no duplicated entries requested, to be specific,
if
k1 != k2
then
( row[k1] , col[k1] ) != ( row[k2] , col[k2] )
Furthermore, the entries are lower triangular; i.e.,
col[k] <= row[k]
.
hessian
has prototype
CppAD::vector<double>& hessian
and its size 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_sweep
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).