# SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.analysis.function.rn2r1

• All Implemented Interfaces:
Function<Vector,Double>, RealScalarFunction
Direct Known Subclasses:
QPProblemOnlyEqualityConstraints

public class QuadraticFunction
extends AbstractRealScalarFunction
A quadratic function takes this form: $$f(x) = \frac{1}{2} \times x'Hx + x'p + c$$.
• "Andreas Antoniou, Wu-Sheng Lu, "Section 13.2, Convex QP Problems with Equality Constraints," Practical Optimization: Algorithms and Engineering Applications."

• ### Nested classes/interfaces inherited from interface com.numericalmethod.suanshu.analysis.function.Function

Function.EvaluationException
• ### Constructor Summary

Constructors
Constructor and Description
QuadraticFunction(Matrix H, Vector p)
Construct a quadratic function of this form: $$f(x) = \frac{1}{2} \times x'Hx + x'p$$.
QuadraticFunction(Matrix H, Vector p, double c)
Construct a quadratic function of this form: $$f(x) = \frac{1}{2} \times x'Hx + x'p + c$$.
QuadraticFunction(QuadraticFunction f)
Copy constructor.
• ### Method Summary

All Methods
Modifier and Type Method and Description
Double evaluate(Vector z)
Evaluate the function f at x, where x is from the domain.
ImmutableMatrix Hessian()
ImmutableVector p()
String toString()
• ### Methods inherited from class com.numericalmethod.suanshu.analysis.function.rn2r1.AbstractRealScalarFunction

dimensionOfDomain, dimensionOfRange
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
• ### Constructor Detail

public QuadraticFunction(Matrix H,
Vector p,
double c)
Construct a quadratic function of this form: $$f(x) = \frac{1}{2} \times x'Hx + x'p + c$$.
Parameters:
H - a symmetric, positive semi-definite matrix
p - a vector
c - a constant

public QuadraticFunction(Matrix H,
Vector p)
Construct a quadratic function of this form: $$f(x) = \frac{1}{2} \times x'Hx + x'p$$.
Parameters:
H - a symmetric, positive semi-definite matrix
p - a vector

public QuadraticFunction(QuadraticFunction f)
Copy constructor.
Parameters:
f - a quadratic function
• ### Method Detail

• #### Hessian

public ImmutableMatrix Hessian()
• #### p

public ImmutableVector p()
• #### evaluate

public Double evaluate(Vector z)
Description copied from interface: Function
Evaluate the function f at x, where x is from the domain.
Parameters:
z - x
Returns:
f(x)
• #### toString

public String toString()
Overrides:
toString in class Object