On Friday, March 27, 2015 at 8:21:10 AM UTC-4, Sebastian Good wrote:
>
> Forgive my ignorance, but what is Cartesian indexing?
>

There are two ways to iterate over all elements of an array: Linear 
indexing and Cartesian indexing. For example, given a 2x3 matrix, linear 
indexing would use just one index from 1:6, whereas Cartesian indexing 
specifies indices for both dimensions: (1,1), (1,2), (2,1), ...


If an array isn't stored continuously in memory for linear indexing, 
converting to the Cartesian indices is very expensive (because it requires 
integer division, which is a surprising slow). The new `eachindex` method 
in 0.4 returns an iterator to go over all the Cartesian indices very 
quickly.

Reply via email to