Boost logo

Boost :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2001-03-28 00:19:12


On Tue, 27 Mar 2001, Larry Evans wrote:

jcampb> Suppose C is rank 3. What would the following mean:
jcampb>
jcampb> C[0<=stride(1)<3][3][all]
jcampb>
jcampb> I would guess that it would be a rank 2 subarray since a
jcampb> scalar was used as 2nd index? What I uncertain about is

Yes, it would be rank 2.

jcampb> when an expression denotes a "script proxy thing" (see
jcampb> Jeremy's Mon, 26 Mar 2001 12:40:12 -0500 (EST) post) or a
jcampb> subarray. If a proxy, then is scalar index valid? If a
jcampb> subarray, then does the all apply to the 1st axis (which
jcampb> has length 3) or to the 2nd axis of the subarray (which
jcampb> used to be the 3ird axis of C)?

Don't worry, it does the right thing ;) But to explain, here's
what I'm currently thinking, and hopefully, what I've written
in the subarray access section of

http://www.lsc.nd.edu/~jsiek/tlc/multi_array/libs/numeric/doc/multi_array.html

C[range] returns a "subarray-generator" (sub-gen). The job of the sub-gen
is to collect a range or index specification for each of the dimensions of
the array, via operator[]. Each operator[] returns the sub-gen, until we
get to the last dimension. The operator[] for the last dimension instead
returns a subarray object.

Therefore, in the above example,
 [0<=stride(1)<3] applies to the first dimension of C
 [3] applies to the second dimension of C, causing the
                    dimension of the resulting subarray to be reduced by 1
 [all] applies to the third dimension of C.

Cheers,
Jeremy

----------------------------------------------------------------------
 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