csr_matrix.py#
Define the CSRmatrix class.
- class openmdao.matrices.csr_matrix.CSRMatrix(submats)[source]
Bases:
COOMatrixSparse matrix in Compressed Row Storage format.
- Parameters:
- submatsdict
Dictionary of sub-jacobian data keyed by (row_name, col_name).
- Attributes:
- _coo_to_csr_mapndarray of int
Single array of size nnz. Entry i holds the CSR data index for COO entry i. Multiple COO entries may map to the same CSR index when duplicate (row, col) pairs exist across subjacs.
- _has_within_subjac_duplicatesdict
Maps subjac key to bool. True if that subjac has duplicate (row, col) entries within its own COO slice, requiring np.add.at instead of +=.
Methods
dump(msginfo)Dump the matrix to stdout.
todense()Return a dense version of the matrix.
transpose()Transpose the matrix.
- __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:
- csc_matrix
Transposed matrix.