gemseo.core.mdo_functions.mdo_quadratic_function module#

A quadratic function defined from coefficients and offset matrices.

class MDOQuadraticFunction(quad_coeffs, name, f_type=FunctionType.NONE, input_names=(), linear_coeffs=None, value_at_zero=0.0)[source]#

Bases: MDOFunction

Scalar-valued quadratic multivariate function defined by.

  • a square matrix \(A\) of second-order coefficients \((a_{ij})_{\substack{i = 1, \dots n \\ j = 1, \dots n}}\)

  • a vector \(b\) of first-order coefficients \((b_i)_{i = 1, \dots n}\)

  • and a scalar zero-order coefficient \(c\)

\[f(x) = c + \sum_{i = 1}^n b_i \, x_i + \sum_{i = 1}^n \sum_{j = 1}^n a_{ij} \, x_i \, x_j.\]
Parameters:
  • quad_coeffs (NumberArray) -- The second-order coefficients.

  • linear_coeffs (NumberArray | None) -- The first-order coefficients. If None, the first-order coefficients will be zero.

  • value_at_zero (OutputType) --

    The zero-order coefficient.

    By default it is set to 0.0.

  • name (str)

  • f_type (MDOFunction.FunctionType) --

    By default it is set to "".

  • input_names (Sequence[str]) --

    By default it is set to ().

property linear_coeffs: NumberArray#

The first-order coefficients of the function.

Raises:

ValueError -- If the number of first-order coefficients is not consistent with the dimension of the input space.

property quad_coeffs: NumberArray#

The second-order coefficients of the function.

Raises:

ValueError -- If the coefficients are not passed as a 2-dimensional square ndarray.