Boost logo

Ublas :

From: Markus Weimer (markus.weimer_at_[hidden])
Date: 2008-01-12 18:53:05

thanks for your replies!

> does clear() set all values to 0 for dense and sparse matrices? And if so:
> > Is that efficient for a freshly generated sparse matrix?
> Why would you want to clear freshly generated sparse matrix ?
> I thought it is semantically zero anyway ...

Yes. But the problem in my case is: I really don't know whether I created a
sparse or dense matrix, as that is defined by some typedef which I change
depending on the use of the final binary. After that, I read in data and I
want all values which are not present in the datafile to be zero. In the
case of dense matrices, I would need to clear() it. That's why I wondered
whether clear()ing a sparse matrix does any harm.