|
Boost : |
From: Jeremy Siek (jsiek_at_[hidden])
Date: 2001-03-25 14:25:32
Hi Larry,
Sounds like there are some interesting ideas here, though I must admit I'm
having trouble getting though all the abbreviations and strange semi-colon
placement.
Here's what I got out of it:
from(s) equivalent to Blitz's Range(s,all)
upto(f) equivalent to Blitz's Range(all,f)
frto(s,f) equivalent to Blitz's Range(s,f)
nextAx() not sure what this does...
And an expansion vector is basically a utility class that includes all the
information necessary to specify an arbitrary sub-array of some multi-dim
array?
What I like here is the ability to string-along slicing information in a
convenient manner. I've been thinking along the same lines. However, I
think we can find a notation that will be understood more easily by
main-stream programmers.
Cheers,
Jeremy
On Thu, 22 Mar 2001, Larry Evans wrote:
jcampb>
jcampb> I used to be an apl fan, and tried emulating some of apl's
jcampb> interface's with some c++ classes using expansion vectors
jcampb> described in _An APL Compiler_ by Timothy Budd(1988).
jcampb> Operations on the expansion vector (size = rank) can be
jcampb> used to take a slice, rotate the axes.
jcampb>
jcampb> Attached are a test driver _conslivar.c and a header file,
jcampb> varslirnk.h, declaring a class used to manipulate the
jcampb> expansion vector. You may find the test driver cryptic,
jcampb> so I'll give some explanation.
jcampb>
jcampb> ; sout<<"===>ConSliOwn CTOR() via SliceOp: From(1)<<UpTo(2)"<<endl
jcampb> ; ConSliOwn<double> ownSl(testArr<<From(1)<<UpTo(2)<<EndSli())
jcampb> ; sout<<ownSl<<endl
jcampb>
jcampb> I think this takes a slice out of testArr which drops the
jcampb> 1st element in axis 1, and then takes the 1st 2 elements
jcampb> of axis 2. This is equivlent to the apl:
jcampb>
jcampb> ownS1 <- 2take[2]1drop[1]testArr
jcampb>
jcampb> For example if:
jcampb>
jcampb> testArr =
jcampb> {{ 11 , 12, 13}
jcampb> , { 21, 22, 23}
jcampb> , { 31, 32, 33}
jcampb> }
jcampb>
jcampb> then:
jcampb>
jcampb> ownS1 =
jcampb> {{ 21, 22}
jcampb> , { 31, 32}
jcampb> }
jcampb>
jcampb> The actual data in the array is stored in a T* for the template arg (e.g. double).
jcampb> Indexing uses the expansion vector and successive operator[](int) to index into this T*.
jcampb>
jcampb> I found apl's interface very useful; so, I'm suggesting something similar for boost.
jcampb>
jcampb>
jcampb> To unsubscribe, send email to: <mailto:boost-unsubscribe_at_[hidden]>
jcampb>
jcampb>
jcampb> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
jcampb>
jcampb>
----------------------------------------------------------------------
Jeremy Siek www: http://www.lsc.nd.edu/~jsiek/
Ph.D. Candidate email: jsiek_at_[hidden]
Univ. of Notre Dame work phone: (219) 631-3906
----------------------------------------------------------------------
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk