CUTEstProblem.hprod
- CUTEstProblem.hprod(p, x=None, v=None)
Calculate Hessian-vector product H*p, where H is Hessian of objective (unconstrained) or Lagrangian (constrained). For constrained problems, the Hessian is L_{x,x}(x,v).
# use last computed Hessian to compute H*p r = problem.hprod(p) # use Hessian of Lagrangian L_{x,x}(x,v) to compute H*p (constrained only) r = problem.hprod(p, x=x, v=v) # use Hessian of objective at x to compute H*p (unconstrained only) r = problem.hprod(p, x=x)
For unconstrained problems, v must be None. For constrained problems, v must be specified.
This calls CUTEst routine CUTEST_chprod or CUTEST_uhprod
Note: in CUTEst, the sign convention is such that the Lagrangian = objective + lagrange_multipliers * constraints
- Parameters:
p (numpy.ndarray with shape (n,)) – vector to be multiplied by the Hessian
x (numpy.ndarray with shape (n,), optional) – input vector for the Hessian
v (numpy.ndarray with shape (m,), optional) – vector of Lagrange multipliers (must be specified for constrained problems)
- Returns:
Hessian-vector product H*p
- Return type:
numpy.ndarray(n,)