Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: create large sparse FEM matrix --> out of memory
Date: Tue, 11 Aug 2009 06:50:21 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 22
Message-ID: <h5r4bd$rk5$1@fred.mathworks.com>
References: <h5pbe7$nc2$1@fred.mathworks.com> <h5pf1k$qit$1@fred.mathworks.com> <h5pm76$ou1$1@fred.mathworks.com> <h5pn7m$3po$1@fred.mathworks.com> <h5pomg$acs$1@fred.mathworks.com> <h5pp33$67h$1@fred.mathworks.com> <h5q7u0$60t$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1249973421 28293 172.30.248.38 (11 Aug 2009 06:50:21 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 11 Aug 2009 06:50:21 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1337510
Xref: news.mathworks.com comp.soft-sys.matlab:562304


Hi,

currently speed of the assembly isn't my primary issue, but I'll look into it to increase the speed.

I know that I can store the sparse matrix i another format like compressed column. However interfacing it with MATLAB is the problem, because as far as I have seen it in the documentation sparse only works with row and column indices. Internally it then is treated in a different storage format to use less memory.

One of the most simple solution to save some memory is to make use of the symmetry of the matrices. That can save me almost one half of the required memory, but still I think that more can be achieved.

"Thomas Clark" <t.clark@remove.spamcantab.net> wrote in message <h5q7u0$60t$1@fred.mathworks.com>...
> A B
> 
> I have two hints.
> 
> The first is to search for an author on the file exchange named Tim Davis. He does a lot of work with sparse matrices, and has published mex functions in C (and I believe c++ in places?) which make MATLAB about as fast as any other system for handling sparse matrices. His Sparse2 command might be very useful is speed of assembly is your issue.
> 
> The second is to have a look at the way in which MATLAB stores sparse matrices (comb through the sparse documentation for 'ir', 'jc', 'pr' vectors). You don't need to store both row and column indices. For most sparsity patterns (i.e. anything where you have on average more than one element per column), it is more memory-efficient to store just the row index. Then, store a vector of length ncolumns+1, containing the cumulative number of elements in each column.
> 
> Storing like that could save you almost 1/3 of the memory space you're currently allocating.
> 
> Kind regards, and good luck!
> 
> Tom Clark