|
Boost : |
From: jcampbell3_at_[hidden]
Date: 2001-06-12 11:49:29
--- 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.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk