Boost logo

Glas :

Re: [glas] dense and sparse vectors

From: Theodore Papadopoulo (Theodore.Papadopoulo_at_[hidden])
Date: 2005-08-02 10:45:42

On Tue, 2005-08-02 at 14:38 +0200, Toon Knapen wrote:
> Theodore Papadopoulo wrote:

> So IIUC 'begin()' returns a structure and this structure on this
> structure is passed on to the constructor of an iterator? So 'begin()'
> and 'end()' do not return an iterator, right?


> Could you enlighten me with e.g. a 5-line pseudo-code that shows how you
> create an iterator over all non-zero's of a sparse matrix and an
> iterator over all (including the structural zero's) elements in the
> sparse matrix.

For this to be meaningful, I have to have a look at your code. Basically
it looks like this:

struct BEGIN {
        BEGIN(some parameters) {
            Keep a copy of the parameters.
   All parameters that are needed in the current function
   nz_begin to do its job.


struct iterator {

        iterator(BEGIN& beg) {
             Here is the code of the current nz_begin

The same for end of course.

> >
> > 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...).
> Sure by all means. I'm interested to see what you mean exactly. I do not
> really like 'nz_begin()' and 'all_begin()' either but I could not come
> up with a viable alternative.
> You can checkout my current code from the CVS for instance (it's on a
> branch called 'tk1'), adapt some files according to your ideas and post
> these to the ml.

I'll try that, but:

cvs -z3 -d:pserver:anonymous_at_[hidden]:/cvsroot/glas co glas
-r tk1

gives me an error. I suceeded in doing:

cvs -z3 -d:pserver:anonymous_at_[hidden]:/cvsroot/glas co glas

I suppose modifying those sources should be OK.