File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -991,11 +991,15 @@ function operate(
991991 append! (out, scalarize (a))
992992 end
993993 end
994- # We need to `copy` the rows hre, because if `a` are mutable
995- # AbstractScalarFunction then mutating the return value will mutate the
996- # inputs. This _is_ what Base.vcat does, but it doesn't fit with the general
997- # assumption that `Utilities.operate(` returns a new object.
998- return MOI. VectorNonlinearFunction (copy .(out))
994+ _to_new_snf (f:: MOI.ScalarNonlinearFunction ) = copy (f)
995+ _to_new_snf (f) = convert (MMOI. ScalarNonlinearFunction, f)
996+ # We need to `copy` the ScalarNonlinearFunction rows here, everything else
997+ # will be `convert(ScalarNonlinearFunction, row)` into a new object, but the
998+ # ScalarNonlinearFunction rows won't be, so mutating the return value of
999+ # this `operate` method will mutate the inputs. This _is_ what Base.vcat
1000+ # does, but it doesn't fit with the general assumption that
1001+ # `Utilities.operate(` returns a new object.
1002+ return MOI. VectorNonlinearFunction (_to_new_snf .(out))
9991003end
10001004
10011005# ## 6a: operate(::typeof(imag), ::Type{T}, ::F)
You can’t perform that action at this time.
0 commit comments