Hello all, it’s nice to be using and posting about Julia.
I need to use the maximum() function on SubArrays, and have observed some results which confuse me based on the shape of the original array. Essentially, I have a large m and small n, and would have thought that an m by n matrix would yield the better performance due to the column major ordering. However, that is not what I’m observing in terms of memory when using the maximum() function, as in the below example.
function test() x = rand(512,2) # Array is 512 by 2 y = x' # Array is 2 by 512 @time results1 = maximum(view(x,1:128,:)) @time results2 = maximum(view(y,:,1:128)) # Check the calculation was the same with the percentage error println(maximum(abs,100.0*(results1-results2)/results1)) end
0.000003 seconds (4 allocations: 144 bytes)
0.000002 seconds (1 allocation: 48 bytes)
I have tried using 0.5.0 and 0.6.0-rc3 on two different Windows machines, using the Atom IDE.
Is there something that I’m overlooking?