Prev Next

@(@\newcommand{\B}[1]{{\bf #1}} \newcommand{\R}[1]{{\rm #1}}@)@
Driver for Computing Hessian in a Range Direction

Syntax
H = f.hessian(xw)

Purpose
This routine computes the Hessian of the weighted sum @[@ w_0 * F_0 (x) + \cdots + w_{m-1} * F_{m-1} (x) @]@ where @(@ F : \B{R}^n \rightarrow \B{R}^m @)@ is the function corresponding to the adfun object f .

f
The object f must be an adfun object. We use level for the AD ad level of this object.

x
The argument x is a numpy.array with one dimension (i.e., a vector) with length equal to the domain size n for the function f . It specifies the argument value at which the derivative is computed. If the AD level for f is zero, all the elements of x must be either int or instances of float. If the AD level for f is one, all the elements of x must be a_float objects.

w
The argument w is a numpy.array with one dimension (i.e., a vector) with length equal to the range size m for the function f . It specifies the argument value at which the derivative is computed. If the AD level for f is zero, all the elements of w must be either int or instances of float. If the AD level for f is one, all the elements of w must be a_float objects.

H
The return value H is a numpy.array with two dimensions (i.e., a matrix). Both its first and second dimension size (row and column size) are equal to n (the number of domain components in the function f ). It is set to the Hessian; i.e., @[@ H = w_0 * F_0^{(2)} (x) + \cdots + w_{m-1} * F_{m-1}^{(2)} (x) @]@ If the AD level for f is zero, all the elements of H will be instances of float. If the AD level for f is one, all the elements of H will be a_float objects.

Example
The file hessian.py contains an example and test of this operation.
Input File: pycppad/adfun.cpp