Boost logo

Ublas :

Subject: Re: [ublas] csr triplets
From: Umut Tabak (u.tabak_at_[hidden])
Date: 2011-01-12 09:35:17


On 01/12/2011 03:01 PM, Ralf Denzer wrote:
> Hello Umut,
>
> some guesses (not checked with your code!!)
> There are two values for the number of nonzeros in ublas
> m.nnz() and m.nnz_capacity().
> 1. m.nnz_capacity() gives you the size of the array m.value_data().
> 2. m.nnz() gives you the size of the actually used number of nonzeros.
>
Hi Ralf,

Thanks for the reply, indeed the nnz_capacity returns 8 for the nnz
count. Explains why I get 8 values in the vectors instead...

But I still did not understand the reasoning in the codes of ublas where
(it seems) there is not a check for the completion of the fill of the
elements of a matrix...

The problem is that I have an assembled stiffness matrix in a FE
application and I wrote a matrix market interface to export matrices to
MATLAB however I iterate over the nonzeros now, which is pretty fast,
however I guess If I understand you right now, I can allocate the arrays
in my code with number of nnz and then assign to them somehow, not
tested though, but many thanks for the explanation. I guess the best bet
is to continue in this direction...

Best ,
Umut