Boost logo

Boost :

From: Jaakko Jarvi (jajarvi_at_[hidden])
Date: 2002-07-16 14:44:03


Just a comment to the discussion about range syntax:

Boost MultiArray uses the syntax

1 <= range() < 5

which might be worth considering for uBLAS as well.
It'd be nice to have consistent range syntax within all (or at least
several) Boost libraries.

Cheers, Jaakko

> On Saturday 13 July 2002 20:10, Joerg Walter wrote:
> > > Would it be hard to support operator() for ranges? If not, I suggest to
> > > do it: it is a short, clear and powerful notation.
> >
> > See below.
> >
> > > > A.project(range(0,3), range(4,6)).assign( prod(
> > >
> > > > B(range(4,6),range(0,10)),
> > >
> > > > C(range(9,19), range(0,2))));
> > > >
> > > > but we then realized, that we could use free functions to achieve the
> > >
> > > > same expressiveness :
> > >
> > > > project (A, range(0,3), range(4,6)).assign( prod(
> > > > B(range(4,6),range(0,10)), C(range(9,19), range(0,2))));
>
> Joerg, in the rhs this example still uses an operator() with 2 range
> arguments (identical to our example). I suppose you mean here :
> project (A, range(0,3), range(4,6)).assign( prod(
> project( B, range(4,6),range(0,10)), project(C,range(9,19), range(0,2))));
>
> > > >
> > > > This is the recommended way currently. The rationale to eliminate the
> > > > earlier member functions was to decouple vector/matrix and vector
> > > > proxies/matrix proxies. See
> > > >
> > > > http://aspn.activestate.com/ASPN/Mail/Message/1156090
> > > >
> > > > > Another suggestion to make life simpler, is to define range() or
> > > > > norange() to indicate the full scope of the range, for example
> > > > > A(range(0,2), norange()) is then equivalent to
> > > > > A(range(0,2),range(0,A.size2()))
> > > >
> > > > Yes, I've seen similar in the past. We'll consider it.
>
> Blitz++ has Range::all() which is pretty clear IMO.
> BTW blitz++ also supports `A(Range(2,2), Range::all());`
>


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