# dimension aligment Classic List Threaded 4 messages Open this post in threaded view
|

## dimension aligment

 dimension aligment Hi all, just a simple question regarding the alignment of dimensions: given a 3d array a = numpy.array([[[1,2,3],[4,5,6]],[[7,8,9],[10,11,12]],[[13,14,15],[16,17,18]],[[19,20,21],[22,23,24]]]) a.shape returns (4,2,3) so I assume the first digit is the 3rd dimension, second is 2nd dim and third is the first. how is the data aligned in memory now? according to the strides it should be 1,2,3,4,5,6,7,8,9,10,... right? if I had an array of more dimensions, the first digit returned by shape should always be the highest dim. feel free to confirm / correct my assumptions best thomas _______________________________________________ Numpy-discussion mailing list [hidden email] http://projects.scipy.org/mailman/listinfo/numpy-discussion
Open this post in threaded view
|

## Re: dimension aligment

 On Tue, May 20, 2008 at 11:47 AM, Thomas Hrabe <[hidden email]> wrote: Hi all, just a simple question regarding the alignment of dimensions: given a 3d array a = numpy.array([[[1,2,3],[4,5,6]],[[7,8,9],[10,11,12]],[[13,14,15],[16,17,18]],[[19,20,21],[22,23,24]]]) a.shape returns (4,2,3) so I assume the first digit is the 3rd dimension, second is 2nd dim and third is the first. Only if you count from the right. I would call the first digit the first dimension. how is the data aligned in memory now? according to the strides it should be 1,2,3,4,5,6,7,8,9,10,... right? Like a C array, contiguous and the rightmost dimension varies fastest. if I had an array of more dimensions, the first digit returned by shape should always be the highest dim. Yes. Athough first is less ambiguous than highestChuck _______________________________________________ Numpy-discussion mailing list [hidden email] http://projects.scipy.org/mailman/listinfo/numpy-discussion