Sleipnir Python API
Loading...
Searching...
No Matches
sleipnir.autodiff.Hessian Class Reference

Public Member Functions

None __init__ (self, Real|float expression, Real|float wrt)
 
None __init__ (self, Real|float expression, Matrix|Submatrix wrt)
 
Matrix get (self)
 
scipy.sparse.csc_matrix[numpy.float64] value (self)
 

Detailed Description

This class calculates the Hessian of an expression with respect to a
vector of variables.

The gradient tree is cached so subsequent Hessian calculations are
faster, and the Hessian is only recomputed if the expression is
nonlinear or its quadratic coefficients depend on parameters.

Template Args:
    Scalar: Scalar type.
    UpLo: Which part of the Hessian to compute (Lower or Lower |
          Upper). Default is Lower | Upper.

Constructor & Destructor Documentation

◆ __init__() [1/2]

None sleipnir.autodiff.Hessian.__init__ (   self,
Real | float  expression,
Real | float  wrt 
)

◆ __init__() [2/2]

None sleipnir.autodiff.Hessian.__init__ (   self,
Real | float  expression,
Matrix | Submatrix  wrt 
)
Constructs a Hessian object.

Args:
    expression: Expression of which to compute the Hessian.
    wrt: Variable with respect to which to compute the Hessian.

Member Function Documentation

◆ get()

Matrix sleipnir.autodiff.Hessian.get (   self)
Returns the Hessian as a Matrix.

This is useful when constructing optimization problems with
derivatives in them.

Returns:
    The Hessian as a Matrix.

◆ value()

scipy.sparse.csc_matrix[numpy.float64] sleipnir.autodiff.Hessian.value (   self)
Evaluates the Hessian at wrt's value.

Returns:
    The Hessian at wrt's value.

The documentation for this class was generated from the following file: