Skip to content
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

[WIP] Ring type (issue #349, #234) #350

Merged
merged 11 commits into from
Jul 7, 2021
Merged

Conversation

jverzani
Copy link
Member

@jverzani jverzani commented Jul 2, 2021

In response to issue #329 and an earlier -- much more intrusive -- PR #234, this
relaxes T in AbstractPolynomial{T,X}to be any type, not just T <: Number.

The main operations should mostly work, but we use some assumptions on methods for T that
get exposed below.

At a minimum, it seems the following should work for this to be useful when T has +,* defined for it:

p::Polynomial{T,:x}
q::Polynomial{T,:x}
s::Number
c::T

# scalar mult (note c::S * p::Polynomial{T,X} is not defined, even if it may make sense for some T)
s*p
p*s
c*p
p*c

# poly add
p + q

# poly mult
p * q

# poly powers
p^2

# implicit promotion
p + s
p + c # possible error, but p + P([c]) should work

# evaluaion a + b*x + c*x^2 (left multiply by coefficients)
p(s)
p(c)

# ∂, ∫
derivative(p)
integrate(p)

# matrix element
[p q]
[p s] # not always

See the new tests for details.

@codecov
Copy link

codecov bot commented Jul 2, 2021

Codecov Report

Merging #350 (b47325f) into master (11457cf) will decrease coverage by 0.52%.
The diff coverage is 69.23%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #350      +/-   ##
==========================================
- Coverage   78.79%   78.26%   -0.53%     
==========================================
  Files          23       23              
  Lines        2650     2719      +69     
==========================================
+ Hits         2088     2128      +40     
- Misses        562      591      +29     
Impacted Files Coverage Δ
src/polynomials/factored_polynomial.jl 0.00% <0.00%> (ø)
src/show.jl 76.99% <0.00%> (-1.39%) ⬇️
src/polynomials/standard-basis.jl 87.89% <42.22%> (-6.31%) ⬇️
src/abstract.jl 45.71% <50.00%> (ø)
src/contrib.jl 92.64% <75.00%> (ø)
src/polynomials/ChebyshevT.jl 93.95% <80.00%> (-0.49%) ⬇️
src/polynomials/LaurentPolynomial.jl 89.41% <80.00%> (-0.22%) ⬇️
src/common.jl 89.38% <81.25%> (-0.81%) ⬇️
src/polynomials/SparsePolynomial.jl 98.29% <94.44%> (+0.14%) ⬆️
src/polynomials/ImmutablePolynomial.jl 94.11% <95.00%> (+0.48%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 11457cf...b47325f. Read the comment docs.

@jverzani jverzani merged commit 60ba676 into JuliaMath:master Jul 7, 2021
@jverzani jverzani deleted the ring_type branch July 7, 2021 21:40
This was referenced Jul 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant