Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
odow committed Mar 24, 2024
1 parent 07da160 commit 62c8f4d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
8 changes: 3 additions & 5 deletions src/interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -288,13 +288,11 @@ function mutability(
op::typeof(*),
args::Vararg{Any,N},
) where {N}
if mutability(typeof(x), op, typeof.(args)...) == IsNotMutable()
return IsNotMutable()
elseif size(x) == _size_after_multiply(size.(args)...)
is_mutable = mutability(typeof(x), op, typeof.(args)...)
if is_mutable && size(x) == _size_after_multiply(size.(args)...)
return IsMutable()
else
return IsNotMutable()
end
return IsNotMutable()
end

function _size_after_multiply(x::NTuple{M,Int}, y::NTuple{N,Int}) where {N,M}
Expand Down
6 changes: 3 additions & 3 deletions test/matmul.jl
Original file line number Diff line number Diff line change
Expand Up @@ -424,14 +424,14 @@ Base.:*(m::Monomial, ::Monomial) = m
end

@testset "Issue_271" begin
A = [1; 2;;]
A = reshape([1, 2], (2, 1))
B = [1 2]
C = MA.operate!!(*, A, B)
@test A == [1; 2;;]
@test A == reshape([1, 2], (2, 1))
@test B == [1 2]
@test C == A * B
D = MA.operate!!(*, B, A)
@test A == [1; 2;;]
@test A == reshape([1, 2], (2, 1))
@test B == [1 2]
@test D == B * A
end

0 comments on commit 62c8f4d

Please sign in to comment.