gemseo / core / mdofunctions

Show inherited members

function_restriction module

A function mapping another one from some input components.

class gemseo.core.mdofunctions.function_restriction.FunctionRestriction(frozen_indexes, frozen_values, input_dim, mdo_function, name='', f_type=FunctionType.NONE, expr='', input_names=())[source]

Bases: MDOFunction

Take an MDOFunction and apply a given restriction to its inputs.

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

Parameters:
  • frozen_indexes (ndarray[int]) – The indexes of the inputs that will be frozen

  • frozen_values (NumberArray) – The values of the inputs that will be frozen.

  • input_dim (int) – The dimension of input space of the function before restriction.

  • mdo_function (MDOFunction) – The function to restrict.

  • name (str) –

    The name of the function after restriction. If empty, create a default name based on the name of the current function and on the argument input_names.

    By default it is set to “”.

  • f_type (MDOFunction.FunctionType) –

    The type of the function.

    By default it is set to “”.

  • expr (str) –

    The expression of the function, e.g. “2*x”, if any.

    By default it is set to “”.

  • input_names (Iterable[str]) –

    The names of the inputs of the function. If empty, the inputs of the function will have no names.

    By default it is set to ().

Raises:

ValueError – If the frozen_indexes and the frozen_values arrays do not have the same shape.

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.

special_repr: str

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