Boost logo

Boost :

From: Toon Knapen (toon_at_[hidden])
Date: 2001-06-10 05:25:27


"Peter Schmitteckert (boost)" wrote:
> > One thing that we need to decide on is the interface for traversing
> > vectors and matrices. I see a couple options:
> >
> > 1. MTL-style iterators
> >
> > *i // return a matrix/vector element
> > i.index() // return the index of the element pointed to (for vectors)
> > i.row() // return the row index (for matrices)
> > i.colummn() // return the column indexn (for matrices)
> >
> > 2. iterator over "matrix elements" or "vector elements"
> > *i // returns a matrix or vector element object.
> > value(*i) // return the element value
> > row(*i) // returns the row index
> > column(*i) // return the column index
> > index(*i) // return the index (for vectors)
> >

AFAIK this does not seem compatible with the multi-dimensional approach
taken so far. There has been a lot of discussion and effort (on your
part in development of the prototype) to take a real n-dimensional
generic approach.
Using `row()` and `column()` renders this effort meaningless since how
will you get the index for the 3th, 4th, ... dimension.

I certainly prefer the 'richer' iterator and thus the MTL approach but
how about : i.index(dim) and maybe also i.distance() if you want more
information about linear-memory-mapping.

I also would like add another issue to the boost.numeric iterators : For
matrices e.g. will you have iterators of iterators or true 2D-iterators.
The latter would e.g. allow you to go the next row or column (both
operations supported by the same iterator object). I'm not sure about
this as this might destroy performance (too much hopping in memory)
compared to the iterator of iterator concept.

toon


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk