gemseo / core / mdofunctions

A quadratic function defined from coefficients and offset matrices.

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.$

Initialize self. See help(type(self)) for accurate signature.

Parameters:
• quad_coeffs (ArrayType) – The second-order coefficients.

• name (str) – The name of the function.

• f_type (str | None) – The type of the linear function among MDOFunction.FunctionType. If None, the linear function will have no type.

• input_names (Sequence[str] | None) – The names of the inputs of the linear function. If None, the inputs of the linear function will have no names.

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

• value_at_zero (OutputType) –

The zero-order coefficient. If None, the value at zero will be zero.

By default it is set to 0.0.

force_real: bool

Whether to cast the results to real value.

has_default_name: bool

Whether the name has been set with a default value.

last_eval: OutputType | None

The value of the function output at the last evaluation.

None if it has not yet been evaluated.

property linear_coeffs: ndarray[Any, dtype[Number]]

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: ndarray[Any, dtype[Number]]

The second-order coefficients of the function.

Raises:

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

special_repr: str

The string representation of the function overloading its default string ones.