From 545d9f55224589160822c4857b551be6751a2f2a Mon Sep 17 00:00:00 2001 From: Alex Arslan Date: Mon, 20 May 2019 16:03:45 -0700 Subject: [PATCH] Amend matrix * vector specialization for strided arrays This restricts the element type of the input vector to be `<:Real` and only converts in case the promoted type is concrete. Fixes #32092. --- stdlib/LinearAlgebra/src/matmul.jl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/stdlib/LinearAlgebra/src/matmul.jl b/stdlib/LinearAlgebra/src/matmul.jl index c9cf328eeb294..d3a3a6a5bdaa9 100644 --- a/stdlib/LinearAlgebra/src/matmul.jl +++ b/stdlib/LinearAlgebra/src/matmul.jl @@ -41,9 +41,10 @@ function *(transx::Transpose{<:Any,<:StridedVector{T}}, y::StridedVector{T}) whe end # Matrix-vector multiplication -function (*)(A::StridedMatrix{T}, x::StridedVector{S}) where {T<:BlasFloat,S} +function (*)(A::StridedMatrix{T}, x::StridedVector{S}) where {T<:BlasFloat,S<:Real} TS = promote_op(matprod, T, S) - mul!(similar(x, TS, size(A,1)), A, convert(AbstractVector{TS}, x)) + y = isconcretetype(TS) ? convert(AbstractVector{TS}, x) : x + mul!(similar(x, TS, size(A,1)), A, y) end function (*)(A::AbstractMatrix{T}, x::AbstractVector{S}) where {T,S} TS = promote_op(matprod, T, S)