Class Gradient
java.lang.Object
org.wpilib.math.autodiff.Gradient
- All Implemented Interfaces:
AutoCloseable
This class calculates the gradient of a variable with respect to a vector of variables.
The gradient is only recomputed if the variable expression is quadratic or higher order.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a Gradient object.Gradient(Variable variable, VariableBlock wrt) Constructs a Gradient object.Gradient(Variable variable, VariableMatrix wrt) Constructs a Gradient object. -
Method Summary
-
Constructor Details
-
Gradient
-
Gradient
Constructs a Gradient object.- Parameters:
variable- Variable of which to compute the gradient.wrt- Vector of variables with respect to which to compute the gradient.
-
Gradient
Constructs a Gradient object.- Parameters:
variable- Variable of which to compute the gradient.wrt- Vector of variables with respect to which to compute the gradient.
-
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable
-
get
Returns the gradient as a VariableMatrix.This is useful when constructing optimization problems with derivatives in them.
- Returns:
- The gradient as a VariableMatrix.
-
value
Evaluates the gradient at wrt's value.- Returns:
- The gradient at wrt's value.
-