Interface VectorFunctionLike

All Known Implementing Classes:
IdentityVectorFunction, LinearVectorFunction, NonlinearVectorFunction, VectorFunction

public interface VectorFunctionLike
Common surface implemented by every vector-valued function carrier the trust-constr code passes around: the full VectorFunction (objective wrapper with caching and finite-difference fallbacks), LinearVectorFunction (constant Jacobian A), and IdentityVectorFunction (Jacobian I).

Mirrors the duck-typed contract scipy relies on -- in _constraints.py:PreparedConstraint the fun attribute can be any of the three Python classes, and downstream code only calls fun(x) / jac(x) / hess(x, v) or reads the cached f / J / m / n.

  • Method Details

    • fun

      Matrix fun(Matrix x)
      Evaluate the function at x, updating any internal cache.
      Parameters:
      x - current iterate (n x 1)
      Returns:
      function value (m x 1)
    • jac

      Matrix jac(Matrix x)
      Evaluate the Jacobian at x, updating any internal cache.
      Parameters:
      x - current iterate (n x 1)
      Returns:
      Jacobian (m x n)
    • hess

      Matrix hess(Matrix x, Matrix v)
      Evaluate the constraint Hessian-of-Lagrangian Sum_i v[i] * H_{f_i}(x) at x for the given multiplier vector v.
      Parameters:
      x - current iterate (n x 1)
      v - multipliers (m x 1)
      Returns:
      summed Hessian (n x n)
    • f

      Matrix f()
      Returns:
      most recently computed f(x) (m x 1), or null if uncached
    • J

      Matrix J()
      Returns:
      most recently computed Jacobian (m x n), or null if uncached
    • m

      long m()
      Returns:
      number of output components (m in f : R^n -> R^m)
    • n

      long n()
      Returns:
      number of input components (n in f : R^n -> R^m)
    • numFunctionEvals

      default int numFunctionEvals()
      Returns:
      total number of function evaluations performed so far
    • numJacobianEvals

      default int numJacobianEvals()
      Returns:
      total number of Jacobian evaluations performed so far
    • numHessianEvals

      default int numHessianEvals()
      Returns:
      total number of Hessian evaluations performed so far
    • v

      Matrix v()
      Returns:
      most recently set Lagrange multipliers (from hess(Matrix, Matrix)); shape m x 1, or null if none ever set