Class VectorFunction

java.lang.Object
de.labathome.trustconstr.VectorFunction
All Implemented Interfaces:
VectorFunctionLike

public class VectorFunction extends Object implements VectorFunctionLike
Vector function and its derivatives. This class defines a vector function F: R^n->R^m and methods for computing or approximating its first and second derivatives. Notes ----- This class implements a memoization logic. There are methods `fun`, `jac`, hess` and corresponding attributes `f`, `J` and `H`. The following things should be considered: 1. Use only public methods `fun`, `jac` and `hess`. 2. After one of the methods is called, the corresponding attribute will be set. However, a subsequent call with a different argument of *any* of the methods may overwrite the attribute.
  • Field Details

  • Method Details

    • fun

      public Matrix fun(Matrix x)
      Description copied from interface: VectorFunctionLike
      Evaluate the function at x, updating any internal cache.
      Specified by:
      fun in interface VectorFunctionLike
      Parameters:
      x - current iterate (n x 1)
      Returns:
      cached function value f(x) (m x 1)
    • jac

      public Matrix jac(Matrix x)
      Description copied from interface: VectorFunctionLike
      Evaluate the Jacobian at x, updating any internal cache.
      Specified by:
      jac in interface VectorFunctionLike
      Parameters:
      x - current iterate (n x 1)
      Returns:
      cached Jacobian J(x) (m x n)
    • hess

      public Matrix hess(Matrix x, Matrix v)
      Description copied from interface: VectorFunctionLike
      Evaluate the constraint Hessian-of-Lagrangian Sum_i v[i] * H_{f_i}(x) at x for the given multiplier vector v.
      Specified by:
      hess in interface VectorFunctionLike
      Parameters:
      x - current iterate (n x 1)
      v - Lagrange multipliers (m x 1)
      Returns:
      cached Hessian-of-Lagrangian H(x, v) (n x n)
    • numFunctionEvals

      public int numFunctionEvals()
      Specified by:
      numFunctionEvals in interface VectorFunctionLike
      Returns:
      total number of fun evaluations performed so far
    • numJacobianEvals

      public int numJacobianEvals()
      Specified by:
      numJacobianEvals in interface VectorFunctionLike
      Returns:
      total number of Jacobian evaluations performed so far
    • numHessianEvals

      public int numHessianEvals()
      Specified by:
      numHessianEvals in interface VectorFunctionLike
      Returns:
      total number of Hessian evaluations performed so far
    • sparseJacobian

      public boolean sparseJacobian()
      Returns:
      true if the Jacobian return type is sparse
    • f

      public Matrix f()
      Specified by:
      f in interface VectorFunctionLike
      Returns:
      the most recently computed f(x) (m x 1), or null if uncached
    • J

      public Matrix J()
      Specified by:
      J in interface VectorFunctionLike
      Returns:
      the most recently computed Jacobian (m x n), or null if uncached
    • H

      public Matrix H()
      Returns:
      the most recently computed Hessian (n x n), or null if uncached
    • v

      public Matrix v()
      Specified by:
      v in interface VectorFunctionLike
      Returns:
      the most recently set Lagrange multipliers (m x 1), or null
    • m

      public long m()
      Specified by:
      m in interface VectorFunctionLike
      Returns:
      number of function dimensions (m in f : R^n -> R^m)
    • n

      public long n()
      Specified by:
      n in interface VectorFunctionLike
      Returns:
      number of input dimensions (n in f : R^n -> R^m)