coo_matrix.py#
Define the COOmatrix class.
- class openmdao.matrices.coo_matrix.COOMatrix(submats)[source]
Bases:
Matrix
Sparse matrix in Coordinate list format.
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
COO matrix. Used as a basis for conversion to CSC, CSR, Dense in inherited classes.
- _matrix_Tsparse matrix
Transpose of the matrix. Only computed if needed for reverse mode for CSC or CSR matrices.
- _coo_slicesdict
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.