CppAD: A C++ Algorithmic Differentiation Package  20130102
template<class Base >
template<class VectorBase , class VectorSet , class VectorSize >
size_t ADFun< Base >::SparseHessian ( const VectorBase &  x,
const VectorBase &  w,
const VectorSet &  p,
const VectorSize &  row,
const VectorSize &  col,
VectorBase &  hes,
sparse_hessian_work work 
)

Compute user specified subset of a sparse Hessian.

The C++ source code corresponding to this operation is

	SparceHessian(x, w, p, row, col, hes, work)
Template Parameters:
Baseis the base type for the recording that is stored in this ADFun<Base object.
VectorBaseis a simple vector class with elements of type Base.
VectorSetis a simple vector class with elements of type bool or std::set<size_t>.
VectorSizeis a simple vector class with elements of type size_t.
Parameters:
xis a vector specifing the point at which to compute the Hessian.
wis the weighting vector that defines a scalar valued function by a weighted sum of the components of the vector valued function $latex F(x)$$.
pis the sparsity pattern for the Hessian that we are calculating.
rowis the vector of row indices for the returned Hessian values.
colis the vector of columns indices for the returned Hessian values. It must have the same size are r.
hesis the vector of Hessian values. It must have the same size are r. The return value hes[k] is the second partial of $ w^{\rm T} F(x)$ with respect to the row[k] and col[k] component of $ x$.
workcontains information that depends on the function object, sparsity pattern, row, and col vector. If these values are the same, work does not need to be recomputed. To be more specific, r_sort is sorted copy of row , c_sort is sorted copy of col , k_sort[k] is the original index corresponding to the values r_sort[k] and c_sort[k]. The order for the sort is by columns. Let n the domain dimension, and K the size of row , col , and hes. There is one extra entry in the sorted row array and it has value r_sort[K]=n. The color vector is set and used by SparseHessianCompute.
Returns:
Is the number of first order forward sweeps used to compute the requested Hessian values. (This is also equal to the number of second order reverse sweeps.) The total work, not counting the zero order forward sweep, or the time to combine computations, is proportional to this return value.

Definition at line 921 of file sparse_hessian.hpp.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines