SparseMatrix API Re: [eigen] SparseMatrix<> constructor

[ Thread Index | Date Index | More Archives ]

Hi Gael,

On Thu, 22 Jul 2010 18:10:04 +0200, Gael Guennebaud

<gael.guennebaud@xxxxxxxxx> wrote:

> Hello Bernard,


> sorry for the delay,

No problem : lurking on the list, I knew that you had much on your plate



> yes such a "triplet" constructor has already been requested/suggested

> a few weeks ago. However, I'm still not sure how to expose it:


> - via a simple ctor

> - via a tiny "TripletSparseWrapper" with some more advanced



> or maybe both, the former being implemented on top of the later...


I'd be interested to know the features of such a TripletSparseWrapper :).

> Also, once we have the triplet it is probably more efficient to run a

> quick sort on them rather than doing random insertions....

Indeed, and that is another reason to push this from client code to the



Wrt SparseMatrix API, I must confess that I don't feel very confident

using an API

stating " After an insertion session, you should call the finalize()


instead of enforcing it : what if an exception prevents the call to

finalize() ?

I'd rather have an inserter() member function returning a wrapper

enabeling the fill()

and whose destructor would call the finalize. À la RandomSetter<> but with


ordered access.

Maybe a unified Setter concept could be used for

1°) Random Access : the current RandomSetter

2°) Sequential Ordered Access I'm talking about, calling finalize() upon


Your tripletSparseWrapper could use any of those depending on the


(iterating over sorted indices, Random iterators that could be sorted and


Best Regards,


Mail converted by MHonArc 2.6.19+