I’m confused by these seemingly contradicting facts:
-
From
eachindex
docstring:Create an iterable object for visiting each index of an AbstractArray A in an efficient manner
(emphasize mine)
-
A transposed view of a
Matrix
, which has a row-major layout, haseachindex
yielding indexes in a column-major way:
julia> A = collect(reshape(1:6, 2, 3))
2×3 Matrix{Int64}:
1 3 5
2 4 6
julia> AA = transpose(A)
3×2 LinearAlgebra.Transpose{Int64, Matrix{Int64}}:
1 2
3 4
5 6
julia> for i in eachindex(AA)
print(AA[i], " ")
end
1 3 5 2 4 6
Is there a constraint that eachindex
must follow column-major order? If so, where is it documented?