Sleipnir Python API
Loading...
Searching...
No Matches
sleipnir.autodiff.Gradient 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 gradient of an expression with respect to a
vector of variables.

The gradient is only recomputed if the expression is quadratic or
higher order.

Template Args:
    Scalar: Scalar type.

Constructor & Destructor Documentation

◆ __init__() [1/2]

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

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

◆ __init__() [2/2]

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

Args:
    expression: Expression of which to compute the gradient.
    wrt: Vector of variables with respect to which to compute the
         gradient.

Member Function Documentation

◆ get()

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

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

Returns:
    The gradient as a Matrix.

◆ value()

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

Returns:
    The gradient at wrt's value.

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