From f75f3ad5b02fa21089c803795437cbeecffbb022 Mon Sep 17 00:00:00 2001 From: odow Date: Wed, 14 Feb 2024 10:12:27 +1300 Subject: [PATCH] Fix Vector*Transpose{Vector} --- src/implementations/LinearAlgebra.jl | 7 +++++++ test/matmul.jl | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/src/implementations/LinearAlgebra.jl b/src/implementations/LinearAlgebra.jl index 12739314..d577e6c6 100644 --- a/src/implementations/LinearAlgebra.jl +++ b/src/implementations/LinearAlgebra.jl @@ -216,6 +216,13 @@ function promote_array_mul( return Matrix{promote_sum_mul(S, T)} end +function promote_array_mul( + ::Type{<:AbstractVector{S}}, + ::Type{<:LinearAlgebra.Transpose{T,<:AbstractVector{T}}}, +) where {S,T} + return Matrix{promote_sum_mul(S, T)} +end + function promote_array_mul( ::Type{<:AbstractMatrix{S}}, ::Type{<:AbstractVector{T}}, diff --git a/test/matmul.jl b/test/matmul.jl index 2c26a51f..3f542d09 100644 --- a/test/matmul.jl +++ b/test/matmul.jl @@ -401,3 +401,10 @@ end @test MA.operate(*, x22, y) == x22 * y @test MA.operate(*, y, x22) == y * x22 end + +@testset "Vector*Transpose{Vector}_issue_256" begin + x = BigInt[1 2; 3 4] + A = [1 2; 3 4] + y = MA.@rewrite sum(A[i, :] * LinearAlgebra.transpose(x[i, :]) for i in 1:2) + @test y == BigInt[10 14; 14 20] +end