Well, Julia doesn’t internally distinguish between column-major and row-major matrices like some languages do (internally, everything’s column-major), and we shouldn’t try to shove that distinction in through the back door. So only the argument’s raw linearly ordered data should matter, not whether we are thinking of it as a row-major or column-major matrix.
With that in mind, I don’t see how col_major(X, size...)
would be any different from reshape(X, size...)
, so I don’t think we need it. I think the only useful function would be
row_major_reshape(X::AbstractArray, size...) = permutedims(reshape(X, reverse([size...])...), length(size):-1:1)
(I think it’d be better to require an explicit size
argument, since I don’t think most use cases would necessarily want to keep the matrix size the same.)