![]() |
Sleipnir Python API
|
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) |
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.
Constructs a Gradient object.
Args:
expression: Expression of which to compute the gradient.
wrt: Variable with respect to which to compute the gradient.
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.
| 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.
| 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.