Class QuadraticFunction
java.lang.Object
org.hipparchus.optim.nonlinear.vector.constrained.TwiceDifferentiableFunction
org.hipparchus.optim.nonlinear.vector.constrained.QuadraticFunction
- All Implemented Interfaces:
MultivariateFunction
Given P, Q, d, implements \(\frac{1}{2}x^T P X + Q^T x + d\).
The gradient is P x + Q^T, and the Hessian is P
- Since:
- 3.1
-
Constructor Summary
ConstructorDescriptionQuadraticFunction
(double[][] h, double[] c, double d) Construct quadratic function \(\frac{1}{2}x^T P X + Q^T x + d\).QuadraticFunction
(RealMatrix p, RealVector q, double d) Construct quadratic function \(\frac{1}{2}x^T P X + Q^T x + d\). -
Method Summary
Modifier and TypeMethodDescriptionint
dim()
Returns the dimensionality of the function domain.double
getD()
Get constant term.getP()
Get square matrix of weights for quadratic terms.getQ()
Get vector of weights for linear terms.Returns the gradient of this function at (x)The Hessian of this function at (x)double
value
(RealVector x) Returns the value of this function at (x)Methods inherited from class org.hipparchus.optim.nonlinear.vector.constrained.TwiceDifferentiableFunction
gradient, hessian, value
-
Constructor Details
-
QuadraticFunction
Construct quadratic function \(\frac{1}{2}x^T P X + Q^T x + d\).- Parameters:
p
- square matrix of weights for quadratic terms. Typically expected to be positive definite or positive semi-definite.q
- vector of weights for linear terms.d
- constant term
-
QuadraticFunction
public QuadraticFunction(double[][] h, double[] c, double d) Construct quadratic function \(\frac{1}{2}x^T P X + Q^T x + d\).- Parameters:
h
- square matrix of weights for quadratic terms. Typically expected to be positive definite or positive semi-definite.c
- vector of weights for linear terms.d
- constant term
-
-
Method Details
-
getP
Get square matrix of weights for quadratic terms.- Returns:
- square matrix of weights for quadratic terms
-
getQ
Get vector of weights for linear terms.- Returns:
- vector of weights for linear terms
-
getD
public double getD()Get constant term.- Returns:
- constant term
-
dim
public int dim()Returns the dimensionality of the function domain. If dim() returns (n) then this function expects an n-vector as its input.- Specified by:
dim
in classTwiceDifferentiableFunction
- Returns:
- the expected dimension of the function's domain
-
value
Returns the value of this function at (x)- Specified by:
value
in classTwiceDifferentiableFunction
- Parameters:
x
- a point to evaluate this function at.- Returns:
- the value of this function at (x)
-
gradient
Returns the gradient of this function at (x)- Specified by:
gradient
in classTwiceDifferentiableFunction
- Parameters:
x
- a point to evaluate this gradient at- Returns:
- the gradient of this function at (x)
-
hessian
The Hessian of this function at (x)- Specified by:
hessian
in classTwiceDifferentiableFunction
- Parameters:
x
- a point to evaluate this Hessian at- Returns:
- the Hessian of this function at (x)
-