Skip to content

Bug with promote and adjoint of a vector #154

@odow

Description

@odow

x-ref https://discourse.julialang.org/t/using-eigenvalue-in-jump-constraint/81076/4

julia> using MutableArithmetics

julia> X = big.(rand(2, 2))
2×2 Matrix{BigFloat}:
 0.0515409  0.22944
 0.430906   0.992924

julia> c = big.(rand(2))
2-element Vector{BigFloat}:
 0.785700711531941209386786795221269130706787109375
 0.7146504162325253428633686780813150107860565185546875

julia> @rewrite(X + c * c')
ERROR: MethodError: no method matching promote_array_mul(::Type{Vector{BigFloat}}, ::Type{Adjoint{BigFloat, Vector{BigFloat}}})
Closest candidates are:
  promote_array_mul(::Type{var"#s6"} where var"#s6"<:Union{Adjoint{S, V}, Transpose{S, V}}, ::Type{var"#s2"} where var"#s2"<:AbstractMatrix{T}) where {S, T, V<:(AbstractVector{T} where T)} at /Users/oscar/.julia/packages/MutableArithmetics/BOohi/src/implementations/LinearAlgebra.jl:433
  promote_array_mul(::Type{var"#s2"} where var"#s2"<:AbstractMatrix{S}, ::Type{var"#s1"} where var"#s1"<:AbstractMatrix{T}) where {S, T} at /Users/oscar/.julia/packages/MutableArithmetics/BOohi/src/implementations/LinearAlgebra.jl:188
Stacktrace:
 [1] promote_operation(#unused#::typeof(*), A::Type{Vector{BigFloat}}, B::Type{Adjoint{BigFloat, Vector{BigFloat}}})
   @ MutableArithmetics ~/.julia/packages/MutableArithmetics/BOohi/src/implementations/LinearAlgebra.jl:176
 [2] promote_operation_fallback(op::typeof(add_mul), #unused#::Type{Matrix{BigFloat}}, #unused#::Type{Vector{BigFloat}}, #unused#::Type{Adjoint{BigFloat, Vector{BigFloat}}})
   @ MutableArithmetics ~/.julia/packages/MutableArithmetics/BOohi/src/interface.jl:68
 [3] promote_operation(::typeof(add_mul), ::Type, ::Type, ::Type)
   @ MutableArithmetics ~/.julia/packages/MutableArithmetics/BOohi/src/interface.jl:99
 [4] mutability(::Type, ::Function, ::Type, ::Type, ::Type)
   @ MutableArithmetics ~/.julia/packages/MutableArithmetics/BOohi/src/interface.jl:232
 [5] mutability
   @ ~/.julia/packages/MutableArithmetics/BOohi/src/interface.jl:240 [inlined]
 [6] operate!!(::typeof(add_mul), ::Matrix{BigFloat}, ::Vector{BigFloat}, ::Adjoint{BigFloat, Vector{BigFloat}})
   @ MutableArithmetics ~/.julia/packages/MutableArithmetics/BOohi/src/rewrite.jl:88
 [7] top-level scope
   @ ~/.julia/packages/MutableArithmetics/BOohi/src/rewrite.jl:288
using JuMP
model = Model()
@variable(model, X[1:2, 1:2])
@variable(model, c[1:2])
@expression(model, X + c * c')

Metadata

Metadata

Assignees

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