diff --git a/src/operators.jl b/src/operators.jl index 22dbf3d9..e67aec9b 100644 --- a/src/operators.jl +++ b/src/operators.jl @@ -264,6 +264,13 @@ end Base.isapprox(p::_APL, α; kwargs...) = isapprox(promote(p, α)...; kwargs...) Base.isapprox(α, p::_APL; kwargs...) = isapprox(promote(p, α)...; kwargs...) +MA.operate!(::typeof(-), p::AbstractTermLike) = error("not implemented yet") + +function MA.operate!(::typeof(-), p::_APL) + negate!! = x -> MA.operate!!(-, x) + map_coefficients!(negate!!, p, nonzero = true) +end + # `MA.operate(-, p)` redirects to `-p` as it assumes that `-p` can be modified # through the MA API without modifying `p`. We should either copy the monomial # here or implement a `MA.operate(-, p)` that copies it. We choose the first