[Changeset] Re: AW: cannot read/write sparse matrices to matlab v4
John W. Eaton
jwe at bevo.che.wisc.edu
Thu Jul 10 10:16:59 CDT 2008
On 9-Jul-2008, David Bateman wrote:
| 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.
I applied the patch to the main branch in my archive.
Thanks,
jwe
More information about the Bug-octave
mailing list