[CppAD] Sparse Hessians and Jacobians

Brad Bell bradbell at seanet.com
Tue May 8 10:45:05 EDT 2012


I am considering adding sparse Jacobian and Hessians returns to CppAD as 
per the sparsity discussion under
     http://list.coin-or.org/pipermail/cppad/2012q1/thread.html

Reading over the discussion, it seems to me that the format used by 
ADOL-C is reasonable; i.e. three vectors rind[], cind[], and values[] 
all of the same length could be used to represent Sparse Hessians and 
Jacobians (where the corresponding element types are size_t, size_t, and 
Base).

For example, the sparse Jacobian driver
     http://www.coin-or.org/CppAD/Doc/sparse_jacobian.xml
could be extended to have the syntax
     jac = f.SparseJacobian(x, p, r, c)
where
     x is the point where the Jacobian is being evaluated
     p is the CppAD sparsity pattern (for the entire Jacobian)
     r is the row indices
     c is the column indices
     jac is the Jacobian values at the corresponding row and column indices.

Note that the sparsity pattern p can be computed by either
     http://www.coin-or.org/CppAD/Doc/forsparsejac.xml
     http://www.coin-or.org/CppAD/Doc/revsparsejac.xml
Then the users can decide which non-zero indices they want back and in 
what order. For example, if the Jacobian is know to be symmetric, one 
only needs to ask for the upper or lower triangle.

A similar approach be used for the sparse Hessians.
     http://www.coin-or.org/CppAD/Doc/sparse_hessian.xml



More information about the CppAD mailing list