![]() |
Prev | Next |
ok = afun.jac_sparsity(
parameter_x, type_x, dependency, select_x, select_y, pattern_out
)
template <class Base> bool atomic_three<Base>::jac_sparsity( const vector<Base>& parameter_x , const vector<ad_type_enum>& type_x , bool dependency , const vector<bool>& select_x , const vector<bool>& select_y , sparse_rc< vector<size_t> >& pattern_out )
f
,
and Jacobian sparsity patterns are computed for
f
.
(Computing Hessian sparsity patterns and optimizing
requires Jacobian sparsity patterns.)
dependency
is true,
then
pattern_out
is a
dependency pattern
for this atomic function.
Otherwise it is a
sparsity pattern
for the
derivative of the atomic function.
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
pattern_out.col()[k] == j
.
ay
.
It specifies which range components are included in
the calculation of
pattern_out
.
If
select_y[i]
is false, then there will be no indices
k
such that
pattern_out.row()[k] == i
.
pattern_out
does not matter.
Upon return it is a
dependency or sparsity pattern for the Jacobian of
g(x)
,
the function corresponding to
afun
;
dependency
above.
To be specific, there are non-negative indices
i
,
j
,
k
such that
pattern_out.row()[k] == i
pattern_out.col()[k] == j
if and only if
select_x[j]
is true,
select_y[j]
is true,
and
g_i(x)
depends on the value of
x_j
(and the partial of
g_i(x)
with respect to
x_j
is possibly non-zero).
ok
is true.
Otherwise it is false.