Purpose
We use @(@
F : \B{R}^n \rightarrow \B{R}^m
@)@ to denote the
AD function
corresponding to
the operation sequence stored in
f
.
Fix @(@
R \in \B{R}^{n \times \ell}
@)@, @(@
s \in \B{R}^m
@)@
and define the function
@[@
H(x) = ( s^\R{T} F )^{(2)} ( x ) R
@]@
Given a sparsity pattern
for @(@
R
@)@
and for the vector @(@
s
@)@,
rev_hes_sparsity computes a sparsity pattern for @(@
H(x)
@)@.
x
Note that the sparsity pattern @(@
H(x)
@)@ corresponds to the
operation sequence stored in
f
and does not depend on
the argument
x
.
R
The sparsity pattern for the matrix @(@
R
@)@ is specified by
pattern_in
in the previous call
f.for_jac_sparsity( pattern_in, transpose, dependency, internal_bool, pattern_out
)
select_range
The argument
select_range
has prototype
const BoolVector& select_range
It has size @(@
m
@)@ and specifies which components of the vector
@(@
s
@)@ are non-zero; i.e.,
select_range[i]
is true
if and only if @(@
s_i
@)@ is possibly non-zero.
internal_bool
If this is true, calculations are done with sets represented by a vector
of boolean values. Otherwise, a vector of sets of integers is used.
This must be the same as in the previous call to
f.for_jac_sparsity
.
pattern_out
This argument has prototype
sparse_rc<SizeVector>& pattern_out
This input value of
pattern_out
does not matter.
If
transpose
it is false (true),
upon return
pattern_out
is a sparsity pattern for
@(@
H(x)
@)@ (@(@
H(x)^\R{T}
@)@).
Sparsity for Entire Hessian
Suppose that @(@
R
@)@ is the @(@
n \times n
@)@ identity matrix.
In this case,
pattern_out
is a sparsity pattern for
@(@
(s^\R{T} F) F^{(2)} ( x )
@)@.
Example
The file
rev_hes_sparsity.cpp
contains an example and test of this operation.
Input File: include/cppad/core/rev_hes_sparsity.hpp