bundles / scipy latest / scipy / io / matlab / _mio4 / VarReader4 / read_sparse_array
function
scipy.io.matlab._mio4:VarReader4.read_sparse_array
source: /scipy/io/matlab/_mio4.py :239
Signature
def read_sparse_array ( self , hdr ) Summary
Read and return sparse matrix type
Parameters
hdr: ``VarHeader4`` instance
Returns
arr: coo_arraywith dtype
floatand shape read from the sparse array data
Notes
MATLAB 4 real sparse arrays are saved in a N+1 by 3 array format, where N is the number of non-zero values. Column 1 values [0:N] are the (1-based) row indices of the each non-zero value, column 2 [0:N] are the column indices, column 3 [0:N] are the (real) values. The last values [-1,0:2] of the rows, column indices are shape[0] and shape[1] respectively of the output matrix. The last value for the values column is a padding 0. mrows and ncols values from the header give the shape of the stored matrix, here [N+1, 3]. Complex data are saved as a 4 column matrix, where the fourth column contains the imaginary component; the last value is again 0. Complex sparse data do not have the header imagf field set to True; the fact that the data are complex is only detectable because there are 4 storage columns.
Aliases
-
scipy.io.matlab._mio4.VarReader4.read_sparse_array