Boost logo

Glas :

Re: [glas] dense and sparse vectors

From: Theodore Papadopoulo (Theodore.Papadopoulo_at_[hidden])
Date: 2005-08-02 05:17:05


On Mon, 2005-08-01 at 15:23 +0200, Toon Knapen wrote:
> The Collection concept is inherited from by DenseCollection and
> SparseCollection. The DenseCollection basically adds the begin() and
> end() members to the collection concept. The SparseCollection concept
> on
> the other hand adds iterators over all non-zero's and over all
> elements.
> The members to get the begin and end iterator over all non-zero's are
> called nz_begin() and nz_end(), while the the begin and end iterator
> over all elements are called all_begin() and all_end(). Note thus
> that
> the SparseCollection is not a refinement of the DenseCollection. The
> basic reason for this is that the begin() member of the
> DenseCollection
> would have to be mapped to either the nz_begin() or to the all_begin
> ().
> To which actually the user wants to map it to depends on the
> algorithm.
> So for the sake of flexibility there is no inheritance relationship
> between the DenseCollection and SparseCollection. Later we will see
> however that adaptors allow to adapt a model of SparseCollection to be
> a model of DenseCollection.

        Hi,

I'll certainly have a close look at all of this... as soon as I have
some time ;-(.

Just a quick reaction though. I somewhat dislike the various xx_begin()
and xx_end() functions. In my code, I managed to keep the standard begin
() and end() function differing the call of the actual functions in the
constructors of the iterators. Namely, begin just returns a BEGIN<xx>
structure and the same for end() (and END<xx>) structure, and then the
iterator constructors use the information stored in these structures to
initialize themselves.

Overall, this has worked very nicely and leads to a quite natural
notation. Would it be possible to use it in Glas ??

If yes, I can offer to do some implementation of it (ir would give me an
opportunity to have the close look at the code...).

        Theo.