dense_matrix.py#

Define the DenseMatrix class.

class openmdao.matrices.dense_matrix.DenseMatrix(submats)[source]

Bases: Matrix

The underlying matrix may be a COO or a dense array.

The type of the underlying matrix will be COO if the array has repeated indices or dense otherwise.

Used with the SplitJacobian to represent the dr/do and dr/di matrices, to form a matvec product with the d_outputs and d_inputs vectors respectively.

Parameters:
submatsdict

Dictionary of sub-jacobian data keyed by (row_name, col_name).

Attributes:
_coocoo_matrix or None

COO matrix used for conversion to dense in some cases, e.g., when array has repeated indices.

_coo_slicesdict or None

Dictionary of slices into the COO matrix data/rows/cols for each sub-jacobian.

__init__(submats)[source]

Initialize all attributes.

dump(msginfo)[source]

Dump the matrix to stdout.

Parameters:
msginfostr

Message info.

todense()[source]

Return a dense version of the matrix.

Returns:
ndarray

Dense array representation of the matrix.

transpose()[source]

Transpose the matrix.

Returns:
coo_matrix

Transposed matrix.