Prev Next

@(@\newcommand{\B}[1]{ {\bf #1} } \newcommand{\R}[1]{ {\rm #1} }@)@
Jacobian Sparsity Patterns

Syntax
af.for_jac_sparsity(pattern_inpattern_out)
af.rev_jac_sparsity(pattern_inpattern_out)

Purpose
We use @(@ F : \B{R}^n \rightarrow \B{R}^m @)@ to denote the function corresponding to the operation sequence stored in af .

for_jac_sparsity
Fix @(@ R \in \B{R}^{n \times \ell} @)@ and define the function @[@ J(x) = F^{(1)} ( x ) * R @]@ Given a sparsity pattern for @(@ R @)@, for_jac_sparsity computes a sparsity pattern for @(@ J(x) @)@.

rev_jac_sparsity
Fix @(@ R \in \B{R}^{\ell \times m} @)@ and define the function @[@ J(x) = R * F^{(1)} ( x ) @]@ Given a sparsity pattern for @(@ R @)@, rev_jac_sparsity computes a sparsity pattern for @(@ J(x) @)@.

x
Note that a sparsity pattern for @(@ J(x) @)@ corresponds to the operation sequence stored in af and does not depend on the argument x .

af
The object af has prototype
     a_fun 
af
The object af is not const when using for_jac_sparsity. After a call to for_jac_sparsity, a sparsity pattern for each of the variables in the operation sequence is held in af for possible later use during reverse Hessian sparsity calculations.

pattern_in
The argument pattern_in has prototype
     const sparse_rc& 
pattern_in
see sparse_rc . This is a sparsity pattern for @(@ R @)@.

pattern_out
This argument has prototype
     sparse_rc<
SizeVector>& pattern_out
This input value of pattern_out does not matter. Upon return pattern_out is a sparsity pattern for @(@ J(x) @)@.

Sparsity for Entire Jacobian
Suppose that @(@ R @)@ is the identity matrix. In this case, pattern_out is a sparsity pattern for @(@ F^{(1)} ( x ) @)@.

Example
C++ , Octave , Perl , Python .
Input File: lib/sparse.cpp