discretize.tests.get_quadratic#

discretize.tests.get_quadratic(A, b, c=0)[source]#

Return a function that evaluates the given quadratic.

Given A, b and c, this returns a function that evaluates the quadratic for a vector x. Where ARNxN, bRN and c is a constant, this function evaluates the following quadratic:

Q(x)=12xTAx+bTx+c

for a vector x. It also optionally returns the gradient of the above equation, and its Hessian.

Parameters:
A(N, N) numpy.ndarray

A square matrix

b(N) numpy.ndarray

A vector

cfloat

A constant

Returns:
function

The callable function that returns the quadratic evaluation, and optionally its gradient, and Hessian.