[Changeset] Re: AW: cannot read/write sparse matrices to matlab v4

David Bateman adb014 at gmail.com
Wed Jul 9 15:38:22 CDT 2008


Daniel Heiserer wrote:
> Hi,
> 
> I "reverse" engineered it. The format is fairyl simple:
> 
> matlab v4 Sparse matrix format:
> 
> The matlab v4 format for sparse matrices is as follows:
> - The T-flag "sparse" (=2) is set in the M0PT header. (0 stands for real
>   matrices. 1 for text)
> - The matrix is stored with its indices as a full Nx3 (real) or Nx4 (complex) matrix:
> The columns have the following meanings:
> 1st column: row indices
> 2nd column: column indices
> 3rd column: real values
> (4th column: imaginary values)
> remarks:
> - the indices are stored as 8byte doubles.
> - a last entry is given to indicate the size of the sparse matrix:
> nrow,ncol,0. for real or nrow,ncol,0.,0. for sparse matrices
> N the number of rows of the storage scheme is NNZ+1.
> Where NNZ is the amount of nonzero entries and the 1 stands for the
> last zero entry indicating the size of the sparse matrix.
> 
> 
> I attach some small examples.
> 


Well given that you went to the effort of reverse engineering this file
format and that the work isn't much to add it after that, here is the
patch that adds matlab v4 sparse matrix file load/save to Octave. Still
not sure it'll really be used.

D.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch8273
Url: https://www.cae.wisc.edu/pipermail/bug-octave/attachments/20080709/1b29f274/attachment.ksh 


More information about the Bug-octave mailing list