-
Notifications
You must be signed in to change notification settings - Fork 74
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
work on polynomial_composition. Close #520 #524
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportPatch coverage has no change and project coverage change:
Additional details and impacted files@@ Coverage Diff @@
## master #524 +/- ##
==========================================
- Coverage 76.59% 75.18% -1.42%
==========================================
Files 35 34 -1
Lines 3739 3534 -205
==========================================
- Hits 2864 2657 -207
- Misses 875 877 +2
☔ View full report in Codecov by Sentry. |
@@ -106,8 +106,18 @@ function polynomial_composition(p::ImmutableDensePolynomial{B,T,X,N}, q::Immutab | |||
cs = evalpoly(q, p.coeffs) | |||
convert(P, cs) | |||
end | |||
function polynomial_composition(p::AbstractUnivariatePolynomial{B,T,X}, q::ImmutableDensePolynomial{B,S,Y,0}) where {B<:StandardBasis,T,S,X,Y} | |||
P = ImmutableDensePolynomial{B,promote_type(T,S), Y,0} | |||
zero(P) |
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.
A polynomial composed with zero is the polynomial's constant term, not always zero. For example, if we have f(x) = 1
and g(x) = 0
, f∘g
is 1
, not 0
.
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.
Apart from that, I don't think the promotion is necessary, that is, I think you could just ignore S
, because the value of q
is always zero, independently of S
.
Could you also add fallback methods for Something like: polynomial_composition(p::Polynomial, r::ImmutablePolynomial) = p(Polynomial(r)) |
Start on some special cases for polynomial composition that improve inferrability.