numdifftools.nd_algopy.Hessdiag

class numdifftools.nd_algopy.Hessdiag(f, method='forward')[source][source]

Calculate Hessian diagonal with Algorithmic Differentiation method

Parameters:

f : function

function of one array f(x, *args, **kwds)

method : string, optional {‘forward’, ‘reverse’}

defines method used in the approximation

Returns:

hessdiag : ndarray

Hessian diagonal array of partial second order derivatives.

Notes

Algorithmic differentiation is a set of techniques to numerically evaluate the derivative of a function specified by a computer program. AD exploits the fact that every computer program, no matter how complicated, executes a sequence of elementary arithmetic operations (addition, subtraction, multiplication, division, etc.) and elementary functions (exp, log, sin, cos, etc.). By applying the chain rule repeatedly to these operations, derivatives of arbitrary order can be computed automatically, accurately to working precision, and using at most a small constant factor more arithmetic operations than the original program.

__init__(f, method='forward')[source]

Methods

__init__(f[, method])
computational_graph(x, *args, **kwds)

Attributes

f