-
Notifications
You must be signed in to change notification settings - Fork 30
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
implement MA negation of a polynomial #285
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -264,6 +264,19 @@ end | |
Base.isapprox(p::_APL, α; kwargs...) = isapprox(promote(p, α)...; kwargs...) | ||
Base.isapprox(α, p::_APL; kwargs...) = isapprox(promote(p, α)...; kwargs...) | ||
|
||
MA.operate!(::typeof(-), ::AbstractTermLike) = error("not implemented yet") | ||
|
||
MA.operate_to!(::AbstractTermLike, ::typeof(-), ::_APL) = error("not implemented yet") | ||
|
||
function MA.operate!(::typeof(-), p::_APL) | ||
negate!! = x -> MA.operate!!(-, x) | ||
return map_coefficients!(negate!!, p, nonzero = true) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I prefer to never use either
In this case this is not an issue, as the closure doesn't capture any variables. |
||
end | ||
|
||
function MA.operate_to!(o::P, ::typeof(-), p::P) where {P<:_APL} | ||
return map_coefficients_to!(o, -, 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 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't we just keep the
MethodError
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AbstractTermLike
subtypes_APL
, so we have to have a separate method. Do you want me to dothrow(MethodError(...))
instead oferror("not implemented yet")
?