Skip to content

Bug in operate!!(*, A, B) #271

@odow

Description

@odow
julia> A = [1; 2;;]
2×1 Matrix{Int64}:
 1
 2

julia> B = [1 2]
1×2 Matrix{Int64}:
 1  2

julia> A * B
2×2 Matrix{Int64}:
 1  2
 2  4

julia> B * A
1×1 Matrix{Int64}:
 5

julia> MutableArithmetics.operate!!(*, A, B)
ERROR: DimensionMismatch: array could not be broadcast to match destination
Stacktrace:
  [1] check_broadcast_shape
    @ ./broadcast.jl:579 [inlined]
  [2] check_broadcast_shape
    @ ./broadcast.jl:580 [inlined]
  [3] check_broadcast_axes
    @ ./broadcast.jl:582 [inlined]
  [4] instantiate
    @ ./broadcast.jl:309 [inlined]
  [5] materialize!
    @ ./broadcast.jl:914 [inlined]
  [6] materialize!
    @ ./broadcast.jl:911 [inlined]
  [7] operate!(::typeof(*), x::Matrix{Int64}, y::Matrix{Int64})
    @ MutableArithmetics ~/.julia/dev/MutableArithmetics/src/rewrite_generic.jl:9
  [8] operate_fallback!!
    @ ~/.julia/dev/MutableArithmetics/src/interface.jl:601 [inlined]
  [9] operate!!(::typeof(*), ::Matrix{Int64}, ::Matrix{Int64})
    @ MutableArithmetics ~/.julia/dev/MutableArithmetics/src/interface.jl:585
 [10] top-level scope
    @ REPL[70]:1

julia> A
2×1 Matrix{Int64}:
 1
 2

julia> B
1×2 Matrix{Int64}:
 1  2

julia> MutableArithmetics.operate!!(*, B, A)
1×2 Matrix{Int64}:
 5  5

julia> A
2×1 Matrix{Int64}:
 1
 2

julia> B
1×2 Matrix{Int64}:
 5  5

x-ref https://discourse.julialang.org/t/dimensionmismatch-error-in-creating-semidefinite-constraint-in-jump-jl/111969

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions