Boost logo

Boost :

From: Larry Evans (jcampbell3_at_[hidden])
Date: 2001-06-12 13:16:13


David Abrahams wrote:

> One problem with this is that it requires much more of the iterator in some
> cases than it otherwise might. In an array stored as vectors of vectors
> of... vectors, each iterator would need to have references to all of the
> containing vectors.

Couldn't the iterator just contain a vector of indices of length == rank,
and a pointer to the vector of vectors of... vectors (VofV), and then just index into
the VofV with the vector of indices. I guess bad thing about that is
that it takes longer.
Actually, what I had in mind for dense storage is a single T* with a size
for each axis. Then whenever axis(n) is incremented, T* would be incremented by
size[n], where, for an array with shape, s[n] = {s0,s1,...,sn_1}
size[i] = s0 * s1 * s2 * ... s[i-1].

>
>
> -Dave
>
> ----- Original Message -----
> From: <jcampbell3_at_[hidden]>
> To: <boost_at_[hidden]>
> Sent: Tuesday, June 12, 2001 12:49 PM
> Subject: [boost] Re: matrix and vector iterators
>
> > --- In boost_at_y..., Jeremy Siek <jsiek_at_r...> 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)
> > Since the following:
> >
> > i.index(0) returns the index along "axis" 0 (row?)
> > i.index(1) returns the index along "axis" 1 (col?)
> > i.index(int n) returns index along "axis" n
> >
> > would work for any rank array, I recommend it. As another
> > alternative:
> >
> > i.axis(n)++ would increment the index along axis n
> > i.axis(n).index() would return index along axis n
> >
> > Of course in each of the above cases, the user could input
> > an n>rank, resulting in coredump. Maybe the axis
> > method could be specialized on template<unsigned n>class Axis
> > to somehow avoid this.
> >
> >
> > To unsubscribe, send email to: <mailto:boost-unsubscribe_at_[hidden]>
> >
> >
> > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
> >
> >
>
> To unsubscribe, send email to: <mailto:boost-unsubscribe_at_[hidden]>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/


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