Skip to content

inplace_utils#

Includes utility functions for inplace operations on sparse matrices.

Functions:

compute_update_indices_sparse #

compute_update_indices_sparse(M: csr_matrix, U: csr_matrix, destination_indexes: NDArray = None) -> NDArray

Computes the indices for updating the system matrix.

Parameters:

  • M (csr_matrix) –

    The original system matrix.

  • U (csr_matrix) –

    The update matrix to be applied.

  • destination_indexes (NDArray, default: None ) –

    The indices in the system matrix where the update should be applied.

Returns:

  • target_indices ( NDArray ) –

    The indices in the flattened system matrix corresponding to the update positions.

compute_update_indices_dense #

compute_update_indices_dense(M: csr_matrix, destination_indexes: NDArray = None) -> NDArray

Computes the indices for updating the system matrix.

Parameters:

  • M (csr_matrix) –

    The original system matrix.

  • destination_indexes (NDArray, default: None ) –

    The indices in the system matrix where the update should be applied.

Returns:

  • target_indices ( NDArray ) –

    The indices in the flattened system matrix corresponding to the update positions.