\(\newcommand{\W}[1]{ \; #1 \; }\) \(\newcommand{\R}[1]{ {\rm #1} }\) \(\newcommand{\B}[1]{ {\bf #1} }\) \(\newcommand{\D}[2]{ \frac{\partial #1}{\partial #2} }\) \(\newcommand{\DD}[3]{ \frac{\partial^2 #1}{\partial #2 \partial #3} }\) \(\newcommand{\Dpow}[2]{ \frac{\partial^{#1}}{\partial {#2}^{#1}} }\) \(\newcommand{\dpow}[2]{ \frac{ {\rm d}^{#1}}{{\rm d}\, {#2}^{#1}} }\)
atomic_three_hes_sparsity¶
View page sourceAtomic Function Hessian Sparsity Patterns¶
Syntax¶
hes_sparsity
(Prototype¶
template <class Base>
bool atomic_three<Base>::hes_sparsity(
const vector<Base>& parameter_x ,
const vector<ad_type_enum>& type_x ,
const vector<bool>& select_x ,
const vector<bool>& select_y ,
sparse_rc< vector<size_t> >& pattern_out )
Implementation¶
This function must be defined if afun is used to define an ADFun object f , and Hessian sparsity patterns are computed for f .
Base¶
See Base .
parameter_x¶
See parameter_x .
type_x¶
See type_x .
select_x¶
This argument has size equal to the number of arguments to this atomic function; i.e. the size of ax . It specifies which domain components are included in the calculation of pattern_out . If select_x [ j ] is false, then there will be no indices k such that either of the following hold:
row
()[ k ] == jcol
()[ k ] == j.
select_y¶
This argument has size equal to the number of results to this atomic function; i.e. the size of ay . It specifies which range component functions \(g_i (x)\) are included in of pattern_out .
pattern_out¶
This input value of pattern_out does not matter. Upon return it is the union, with respect to i such that select_y [ i ] is true, of the sparsity pattern for Hessian of \(g_i (x)\). To be specific, there are non-negative indices i , r , c , and k such that
row
()[ k ] == rcol
()[ k ] == cif and only if select_y [ i ] is true, select_x [ r ] is true, select_x [ c ] is true, and
is possibly non-zero. Note that the sparsity pattern should be symmetric.
ok¶
If this calculation succeeded, ok is true. Otherwise it is false.
Examples¶
The file atomic_three_hes_sparsity.cpp contains an example and test that uses this routine.