loading matlab sparse matrix (matlab v 7.3) in python -


i have data file storing large matlab sparse matrix (matlab 7.3) needs used in python program. use h5py load sparse matrix , find there 3 data structures associated sparse matrix.

suppose name of sparse matrix m , 3 data structures m['data'], m['ir'], m['jc']. thought m['ir'] , m['jc'] store row indices , column indices nonzero items, have found there exist values in m['jc'] larger row number of sparse matrix. can explain kinds of information stored in 3 data structure?

ir is, guessed, row-index of non-empty rows. column-index things more complicated documented in mathworks mex-function documentation.

pasted http://www.mathworks.de/de/help/matlab/apiref/mxsetir.html:

if jth column of sparse mxarray has nonzero elements:  jc[j] index in ir, pr, , pi (if exists) of first nonzero element in jth column. jc[j+1]-1 index of last nonzero element in jth column. jth column of sparse matrix, jc[j] total number of nonzero elements in preceding columns. number of nonzero elements in jth column of sparse mxarray is:  jc[j+1] - jc[j]; 

also check documention on mxsetir. assuming have access matlab, should check mex examples linked docs.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -