help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sparse part2


From: Andy Adler
Subject: Re: Sparse part2
Date: Tue, 25 May 2004 14:49:16 -0400 (EDT)

On Mon, 24 May 2004, Andre Viljoen wrote:

> Anyway, I have installed the sparse arrays from /main/sparse manually
> and it works. I can create sparse matrices by "A = sparse(20,20);" for
> example. Now I try to load a variable from MATLAB h.mat by "load h.mat"
> and the compiler still spits at me that sparse matrices are not
> supported.
>
> This is bad.
>
> Any ideas? :)

Yes. Matlab defines the storage of its sparse matrix
types here:
www.mathworks.com/access/helpdesk/help/pdf_doc/matlab/matfile_format.pdf
(starting at page 20).

You should be able to implement code to read the file with
fopen and fread, and then create a sparse matrix with
S = sparse(i,j,s,m,n)  where
        i,j   are integer index vectors (1 x nnz)
        s     is the vector of real or complex entries (1 x nnz)
        m,n   are the scalar dimentions of S


A further improvement would be to add a method
octave_sparse::load_binary( ) to the files
sparse_ops.cc and complex_sparse_ops.cc.

Andy




-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]