BitMatrixCSR#
-
class cuquantum.
stabilizer. BitMatrixCSR(
)[source]#
CSR representation of a binary (GF(2)) matrix.
All nonzero entries are implicitly 1. Storage-agnostic: holds numpy or cupy arrays depending on how it was constructed.
Attributes
- row_offsets#
Row pointer array, shape
(num_rows + 1,), dtype int64.
- col_indices#
Column index array, shape
(nnz,), dtype int64.
- nnz#
Number of nonzero entries.
- shape#
(num_rows, num_cols)of the logical matrix.
Methods
- classmethod from_sparse(mat: SparseCSR) BitMatrixCSR[source]#
Create from a
scipy.sparseorcupyx.scipy.sparseCSR matrix.Accepts
csr_array,csr_matrix(scipy), orcsr_matrix(cupyx). Thedataarray is ignored – all stored entries are treated as 1.
- to_cupyx_sparse() cupyx.scipy.sparse.csr_matrix[source]#
Convert to
cupyx.scipy.sparse.csr_matrix. Transfers to GPU if needed.
- to_scipy_sparse() scipy.sparse.csr_array[source]#
Convert to
scipy.sparse.csr_array. Transfers to CPU if needed.