Sorry, I should have included this in the email I just sent. To expand on my comment about affine slices and on what Craig said, the first two methods for getting element $i from $t give affine slices. When the threading engine sees an affine slice, it lets the kernel of the threaded operation operate directly on the original memory. In contrast, the $t->at($i) creates a new perl scalar and copies the value into it and pdl($t->at($i)) essentially does the same thing. (The perl scalar gets PDLified before entering the threadloop, so these two are identical except that the PDLificiation is explicit in the second.)
Finally, we come to the NiceSlice mechanism. In this case, NiceSlice sees your expression and decides that the result will be a non-affine slice. Upon entering the threading engine for the subtraction operation, PDL makes a copy of the current state of $t($i)---which is how PDL handles non-affine slices in general---and this copied value is used throughout. Thus the copy also occurs in this case, but at a different point in the execution of the operation than the two previously mentioned cases. At least, I'm pretty sure that's what happens. :-) David
_______________________________________________ Perldl mailing list [email protected] http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
