Class Hessian

java.lang.Object
org.wpilib.math.autodiff.Hessian
All Implemented Interfaces:
AutoCloseable

public class Hessian extends Object implements AutoCloseable
This class calculates the Hessian of a variable 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 variable expression is nonlinear.

  • Constructor Details

    • Hessian

      public Hessian(Variable variable, Variable wrt)
      Constructs a Hessian object.
      Parameters:
      variable - Variable of which to compute the Hessian.
      wrt - Variable with respect to which to compute the Hessian.
    • Hessian

      public Hessian(Variable variable, VariableMatrix wrt)
      Constructs a Hessian object.
      Parameters:
      variable - Variable of which to compute the Hessian.
      wrt - Vector of variables with respect to which to compute the Hessian.
    • Hessian

      public Hessian(Variable variable, VariableBlock wrt)
      Constructs a Hessian object.
      Parameters:
      variable - Variable of which to compute the Hessian.
      wrt - Vector of variables with respect to which to compute the Hessian.
  • Method Details

    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • get

      public VariableMatrix get()
      Returns the Hessian as a VariableMatrix.

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

      Returns:
      The Hessian as a VariableMatrix.
    • value

      public org.ejml.simple.SimpleMatrix value()
      Evaluates the Hessian at wrt's value.
      Returns:
      The Hessian at wrt's value.