pygsti.tools.matrixtools.csr_sum_indices

pygsti.tools.matrixtools.csr_sum_indices#

csr_sum_indices(csr_matrices)#

Precomputes the indices needed to sum a set of CSR sparse matrices.

Computes the index-arrays needed for use in csr_sum(), along with the index pointer and column-indices arrays for constructing a “template” CSR matrix to be the destination of csr_sum.

Parameters:

csr_matrices (list) – The SciPy CSR matrices to be summed.

Returns:

  • ind_arrays (list) – A list of numpy arrays giving the destination data-array indices of each element of csr_matrices.

  • indptr, indices (numpy.ndarray) – The row-pointer and column-indices arrays specifying the sparsity structure of a the destination CSR matrix.

  • N (int) – The dimension of the destination matrix (and of each member of csr_matrices)