Skip to content

Commit

Permalink
Fix Vector*Transpose{Vector} (#257)
Browse files Browse the repository at this point in the history
  • Loading branch information
odow authored Feb 14, 2024
1 parent 48569d2 commit 3a1ca9b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/implementations/LinearAlgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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}},
Expand Down
7 changes: 7 additions & 0 deletions test/matmul.jl
Original file line number Diff line number Diff line change
Expand Up @@ -396,3 +396,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

0 comments on commit 3a1ca9b

Please sign in to comment.