Should slices of Adjoint/Transpose be StridedVectors?

julia> X = rand(2,2);

julia> view(X', :, 1) == view(X, 1, :)
true

julia> view(X,1,:) isa StridedVector
true

julia> view(X',:,1) isa StridedVector
false

Ideally, view(X',:,1) would also be a StridedVector and access the more efficient matrix-multiplication methods

3 Likes

I feel like the answer is yes, and that this is best discussed in a GitHub issue.

2 Likes

I seem to have overlooked the underlying issue

julia> X = rand(2,2);

julia> X isa StridedArray
true

julia> X' isa StridedArray
false

AFAIK, it doesn’t matter that X' isn’t strided, I believe that particular slice of it always is.
But maybe we can’t identify that from the type. I feel like we can though.

These views should just be views of the parent matrix.

Fixed in 39467, which got reverted because some other PR worked around a bug by exploiting the old behaviour.

2 Likes