pytaco.to_sp_csr

pytaco.to_sp_csr(t)

Converts a taco tensor to a scipy csr_matrix.

Takes a matrix from taco in any format and converts the matrix to a scipy sparse csr matrix. This method removes explicit zeros from the original taco tensor during the conversion.

Parameters
t: tensor

A taco tensor to convert to a scipy.csr_matrix array. The tensor must be of order 2 (i.e it must be a matrix). If the order of the tensor is not equal to 2, a value error is thrown.

Returns
matrix: scipy.sparse.csr_matrix

A matrix containing a copy of the data from the original order 2 tensor t.

Notes

The data and index values are always copied when making the scipy sparse array