gemseo / problems / scalable / linear

Show inherited members

linear_discipline module

Dummy linear discipline.

class gemseo.problems.scalable.linear.linear_discipline.LinearDiscipline(name, input_names, output_names, inputs_size=1, outputs_size=1, grammar_type=GrammarType.JSON, matrix_format=MatrixFormat.DENSE, matrix_density=0.1, matrix_free_jacobian=False)[source]

Bases: MDODiscipline

A discipline that computes random outputs from inputs.

The output are computed by a product with a random matrix and the inputs. The inputs and outputs names are specified by the user. The size of inputs and outputs can be specified.

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

  • name (str) – The discipline name.

  • input_names (Sequence[str]) – The input data names.

  • output_names (Sequence[str]) – The output data names.

  • inputs_size (int) –

    The size of input data vectors, each input data is of shape (inputs_size,).

    By default it is set to 1.

  • outputs_size (int) –

    The size of output data vectors, each output data is of shape (outputs_size,).

    By default it is set to 1.

  • grammar_type (MDODiscipline.GrammarType) –

    The type of grammars.

    By default it is set to “JSONGrammar”.

  • matrix_format (MatrixFormat) –

    The format of the Jacobian matrix.

    By default it is set to “dense”.

  • matrix_density (float) –

    The percentage of non-zero elements when the matrix is sparse.

    By default it is set to 0.1.

  • matrix_free_jacobian (bool) –

    Whether the Jacobians are casted as linear operators.

    By default it is set to False.


ValueError – if input_names or output_names are empty.

class MatrixFormat(value)[source]

Bases: LowercaseStrEnum

The format of the Jacobian matrix.

DENSE corresponds to numpy.ndarray. CSC, CSR, LIL and DOK correspond to sparse format from scipy.sparse.

CSC = 'csc'
CSR = 'csr'
DENSE = 'dense'
DOK = 'dok'
LIL = 'lil'
DEFAULT_MATRIX_DENSITY: ClassVar[float] = 0.1
cache: AbstractCache | None

The cache containing one or several executions of the discipline according to the cache policy.

data_processor: DataProcessor

A tool to pre- and post-process discipline data.

exec_for_lin: bool

Whether the last execution was due to a linearization.

input_grammar: BaseGrammar

The input grammar.

jac: MutableMapping[str, MutableMapping[str, ndarray | csr_array | JacobianOperator]]

The Jacobians of the outputs wrt inputs.

The structure is {output: {input: matrix}}.

name: str

The name of the discipline.

output_grammar: BaseGrammar

The output grammar.

re_exec_policy: ReExecutionPolicy

The policy to re-execute the same discipline.

residual_variables: dict[str, str]

The output variables mapping to their inputs, to be considered as residuals; they shall be equal to zero.

run_solves_residuals: bool

Whether the run method shall solve the residuals.