From 5dc0bf323976aa3bdccf35743bca93399a2d8903 Mon Sep 17 00:00:00 2001 From: Matt Bauman Date: Fri, 14 Sep 2018 19:06:50 -0400 Subject: [PATCH] Split definitions for vectors and matrices --- stdlib/LinearAlgebra/src/adjtrans.jl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/stdlib/LinearAlgebra/src/adjtrans.jl b/stdlib/LinearAlgebra/src/adjtrans.jl index 3c5e3b6568c8c..8145b8b71a5e6 100644 --- a/stdlib/LinearAlgebra/src/adjtrans.jl +++ b/stdlib/LinearAlgebra/src/adjtrans.jl @@ -139,8 +139,11 @@ convert(::Type{Adjoint{T,S}}, A::Adjoint) where {T,S} = Adjoint{T,S}(convert(S, convert(::Type{Transpose{T,S}}, A::Transpose) where {T,S} = Transpose{T,S}(convert(S, A.parent)) # Strides for transposed strided arrays — but only if the elements are actually stored in memory -Base.strides(A::Adjoint{<:Real, <:StridedArray}) = reverse(strides(A.parent)) -Base.strides(A::Transpose{<:Any, <:StridedArray}) = reverse(strides(A.parent)) +Base.strides(A::Adjoint{<:Real, <:StridedVector}) = (stride(A.parent, 2), stride(A.parent, 1)) +Base.strides(A::Transpose{<:Any, <:StridedVector}) = (stride(A.parent, 2), stride(A.parent, 1)) +# For matrices it's slightly faster to use reverse and avoid calling stride twice +Base.strides(A::Adjoint{<:Real, <:StridedMatrix}) = reverse(strides(A.parent)) +Base.strides(A::Transpose{<:Any, <:StridedMatrix}) = reverse(strides(A.parent)) # for vectors, the semantics of the wrapped and unwrapped types differ # so attempt to maintain both the parent and wrapper type insofar as possible