pygsti.tools.matrixtools.csr_sum_flat

Contents

pygsti.tools.matrixtools.csr_sum_flat#

csr_sum_flat(data, coeffs, flat_dest_index_array, flat_csr_mx_data, mx_nnz_indptr)#

Computation of the summation of several CSR-format sparse matrices.

csr_sum_flat_indices() precomputes the necessary indices for summing directly into the data-array of a destination CSR sparse matrix. If data is the data-array of matrix D (for “destination”), then this method performs:

D += sum_i( coeff[i] * csr_mxs[i] )

Note that D is not returned; the sum is done internally into D’s data-array.

Parameters:
  • data (numpy.ndarray) – The data-array of the destination CSR-matrix.

  • coeffs (ndarray) – The weight coefficients which multiply each summed matrix.

  • flat_dest_index_array (ndarray) – The index array generated by csr_sum_flat_indices().

  • flat_csr_mx_data (ndarray) – The data array generated by csr_sum_flat_indices().

  • mx_nnz_indptr (ndarray) – The number-of-nonzero-elements pointer array generated by csr_sum_flat_indices().

Return type:

None