gemseo.problems.mdo.scalable.linear.linear_discipline module#

Dummy linear discipline.

class LinearDiscipline(name, input_names, output_names, inputs_size=1, outputs_size=1, matrix_format=MatrixFormat.DENSE, matrix_density=0.1, matrix_free_jacobian=False)[source]#

Bases: Discipline

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.

Parameters:
  • 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.

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

Raises:

ValueError -- if input_names or output_names are empty.

class MatrixFormat(*values)[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#