![]() |
Blitz Support : |
From: Julian Cummings (cummings_at_[hidden])
Date: 2004-08-24 18:08:11
Hello Simon,
Yes, you are quite right, and I think my earlier statement was not
precise enough. The point I was trying to make was that the storage
ordering does not change. However, the sense in which the index numbers
are running is reversed. Therefore, the boolean value
isRankStoredAscending should be flipped. I don't think you can make the
statement that ascendingFlag_[rank] is always equal to
(stride_[rank]>0). You can imagine an Array with indices labeled
(0,-1,-2,...), in which case the stride would be -1 but the storage
would still be ascending. But in fact, blitz does not allow you to
create an Array with such an indexing scheme. The indicies are required
to be ascending and contiguous (unit stride). In any case, it is
sufficient to simply flip the value of ascendingFlag_[rank] whenever the
index direction is reversed. You can see in the code for the Array
method reverseSelf() that this was done. I think it was just an
oversight not to do this for the case of slicing with a descending
Range, which has a similar effect.
I have updated the code in <blitz/array/slicing.cc> to fix this. I also
found a bug in the sign of the adjustment made to the zeroOffset_ value,
which is used to move from the beginning of the data block to the
location of Array element (0,0,...,0). This zeroOffset_ value is mainly
used to reset the data_ pointer when an Array is assigned to refer to a
new data block (e.g., in the Array reference() method).
Thanks for pointing out this problem!
Regards, Julian C.
Simon Perreault wrote:
>Hi Julian,
>
>On Monday August 23 2004 22:28, Julian C. Cummings wrote:
>
>
>>The stride is set to the stride of the Range, which is -2. The storage in
>>memory does not change, it remains in ascending order (i.e., memory storage
>>order is in the same direction as ascending index number).
>>
>>
>
>I believe this is not true, or that the ascending flag doesn't mean what I
>think it means. In ascending index order, the new array is:
>
>[ 6 4 2 0 ]
>
>while in memory storage order it would be the contrary.
>
>What I now think the ascending flag means is "The true stride is the negative
>of the stored stride." That would make sense in all observed cases. However,
>I think it is useless. Can you tell me why we wouldn't want "ascending =
>stride < 0" (except as a cache for the computation, of course)?
>
>
>
-- Dr. Julian C. Cummings E-mail: cummings_at_[hidden] California Institute of Technology Phone: 626-395-2543 1200 E. California Blvd., Mail Code 158-79 Fax: 626-584-5917 Pasadena, CA 91125