# Should slices of Adjoint/Transpose be StridedVectors?

**URL:** <https://discourse.julialang.org/t/should-slices-of-adjoint-transpose-be-stridedvectors/98297>\
**Category:** Internals & Design\
**Tags:** array, linearalgebra\
**Created:** [May 4, 2023, 6:31am UTC](https://discourse.julialang.org/t/should-slices-of-adjoint-transpose-be-stridedvectors/98297 "2023-05-04T06:31:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jishnub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jishnub/32/33620_2.png) [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Post date:** [May 4, 2023, 6:31am UTC](https://discourse.julialang.org/t/should-slices-of-adjoint-transpose-be-stridedvectors/98297/1 "2023-05-04T06:31:46Z")

</div>

```julia
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

---

<div class="post-metadata">

**Author:** ![oxinabox](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oxinabox/32/206603_2.png) [@oxinabox](https://discourse.julialang.org/u/oxinabox)\
**Post date:** [May 4, 2023, 6:57am UTC](https://discourse.julialang.org/t/should-slices-of-adjoint-transpose-be-stridedvectors/98297/2 "2023-05-04T06:57:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jishnub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jishnub/32/33620_2.png) [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Post date:** [May 4, 2023, 8:19am UTC](https://discourse.julialang.org/t/should-slices-of-adjoint-transpose-be-stridedvectors/98297/3 "2023-05-04T08:19:05Z")

</div>

I seem to have overlooked the underlying issue

```julia
julia> X = rand(2,2);

julia> X isa StridedArray
true

julia> X' isa StridedArray
false

```

---

<div class="post-metadata">

**Author:** ![oxinabox](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oxinabox/32/206603_2.png) [@oxinabox](https://discourse.julialang.org/u/oxinabox)\
**Post date:** [May 4, 2023, 8:45am UTC](https://discourse.julialang.org/t/should-slices-of-adjoint-transpose-be-stridedvectors/98297/4 "2023-05-04T08:45:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mcabbott](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mcabbott/32/6603_2.png) [@mcabbott](https://discourse.julialang.org/u/mcabbott)\
**Post date:** [May 4, 2023, 11:55am UTC](https://discourse.julialang.org/t/should-slices-of-adjoint-transpose-be-stridedvectors/98297/5 "2023-05-04T11:55:06Z")

</div>

These views should just be views of the parent matrix.

Fixed in [39467](https://github.com/JuliaLang/julia/pull/39467), which got reverted because some other PR worked around a bug by exploiting the old behaviour.
