Skip to content

Commit

Permalink
Fix performance of MA.add_mul for NonlinearExpr (#3475)
Browse files Browse the repository at this point in the history
  • Loading branch information
odow authored Sep 1, 2023
1 parent 10a7ce5 commit 6553341
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/nlp_expr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -370,14 +370,14 @@ end
function _MA.operate!!(
::typeof(_MA.add_mul),
x::GenericNonlinearExpr,
y::AbstractJuMPScalar,
)
args::Vararg{Any,N},
) where {N}
_throw_if_not_real(x)
if x.head == :+
push!(x.args, y)
push!(x.args, *(args...))
return x
end
return +(x, y)
return +(x, *(args...))
end

"""
Expand Down

0 comments on commit 6553341

Please sign in to comment.