octave-maintainers
[Top][All Lists]
Advanced

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

Re: problem with fem-fenics


From: Kai Torben Ohlhus
Subject: Re: problem with fem-fenics
Date: Mon, 29 Jul 2013 10:25:36 +0200

On 29 July 2013 08:59, c. <address@hidden> wrote:
In the meantime I was wondering if anyone has an idea about how to incremntally fill and allocate a sparse
matrix in Octave without being too inefficient?

c.


In [1] the chapters 2 and 6 are a very useful reference. As far as I have figured out so far, the fastest way to fill a matrix in octave is:
1. To know the number of non-zeros (NNZ)
2. To be able to access the data in column-wise order

When you are working with oct-files (chapter 6), there is a way to not being too inefficient with reallocation, when you know an upper estimate for NNZ. One can first allocate a bigger sparse matrix structure

   SparseMatrix sm ( nr , nc , nnz_upper_estimate ) ;

and after filling sm remove the unneeded memory with

   sm.maybe compress ( ) ;

But either reallocation, nor compression is recommended. And I can imagine that you are working with real big problems, so it would be necessary to understand how your input from dolfin looks like before one can make good suggestions how to convert your matrices to octaves format.

[1] Sparse Matrix Implementation in Octave http://arxiv.org/abs/cs/0604006 

reply via email to

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