Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sum with init and dims #309

Closed
matbesancon opened this issue Oct 14, 2024 · 2 comments · Fixed by #310
Closed

sum with init and dims #309

matbesancon opened this issue Oct 14, 2024 · 2 comments · Fixed by #310
Assignees
Labels
bug Something isn't working

Comments

@matbesancon
Copy link

I can't pin-point when this stop working, but this is probably a breaking accidental change:
MathOptInterface v1.31.2
MA 1.5.1

julia> import MathOptInterface as MOI

julia> X = reshape(MOI.VariableIndex.(1:12), 3, 4)

julia> sum(X; init=0.0, dims=1)
ERROR: MethodError: no method matching operate(::typeof(sum), ::Matrix{MathOptInterface.VariableIndex}; init::Float64, dims::Int64)
This error has been manually thrown, explicitly, so the method may exist but be intentionally marked as unimplemented.

Closest candidates are:
  operate(::typeof(sum), ::AbstractArray; init) got unsupported keyword argument "dims"
   @ MutableArithmetics ~/.julia/packages/MutableArithmetics/6jxVC/src/reduce.jl:53
  operate(::typeof(-), ::Any) got unsupported keyword arguments "init", "dims"
   @ MutableArithmetics ~/.julia/packages/MutableArithmetics/6jxVC/src/interface.jl:191
  operate(::typeof(one), ::Any) got unsupported keyword arguments "init", "dims"
   @ MutableArithmetics ~/.julia/packages/MutableArithmetics/6jxVC/src/interface.jl:238
  ...

Stacktrace:
 [1] kwerr(::@NamedTuple{init::Float64, dims::Int64}, ::Function, ::Function, ::Matrix{MathOptInterface.VariableIndex})
   @ Base ./error.jl:165
 [2] sum(a::Matrix{MathOptInterface.VariableIndex}; kwargs::@Kwargs{init::Float64, dims::Int64})
   @ MutableArithmetics ~/.julia/packages/MutableArithmetics/6jxVC/src/dispatch.jl:17
 [3] top-level scope
   @ REPL[8]:1
@odow
Copy link
Member

odow commented Oct 14, 2024

It stopped working yesterday 😄

Cause is #306

@odow odow added the bug Something isn't working label Oct 14, 2024
@odow odow self-assigned this Oct 14, 2024
@odow
Copy link
Member

odow commented Oct 14, 2024

This is a bit annoying to fix because keyword arguments don't participate in dispatch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

2 participants