-
Notifications
You must be signed in to change notification settings - Fork 63
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
Better unsafe funcs for UnivPoly and a few others #1838
Conversation
src/generic/UnivPoly.jl
Outdated
@@ -1013,21 +1028,40 @@ function add!(a::UnivPoly{T}, b::UnivPoly{T}, c::UnivPoly{T}) where {T <: RingEl | |||
return a | |||
end | |||
|
|||
function add!(a::UnivPoly{T}, b::UnivPoly{T}, c::Integer) where {T <: RingElement} |
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.
What I really need is this but for ZZRingElem
instead of Integer
.
Come to think of, it also would make a lot of sense to have this for c::T
.
And easy way to cover all those would be to just do
function add!(a::UnivPoly{T}, b::UnivPoly{T}, c::Integer) where {T <: RingElement} | |
function add!(a::UnivPoly{T}, b::UnivPoly{T}, c) where {T <: RingElement} |
There shouldn't be too much issues with ambiguity as long as two of the arguments have identical type.
But I still wonder if such a signature is really a good idea?
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.
I've now changed it to this (i.e. dropped the restriction on one of the arguments completely).
Wondering if @fieker or @thofma forsee any potential problems with this?
(We would like these functions for GenericCharacterTables.jl so we can speed up things there w/o relying on implementation details for UnivPoly
)
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.
no objection from me
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1838 +/- ##
==========================================
- Coverage 88.13% 88.09% -0.04%
==========================================
Files 119 119
Lines 29982 30008 +26
==========================================
+ Hits 26426 26437 +11
- Misses 3556 3571 +15 ☔ View full report in Codecov by Sentry. |
end | ||
|
||
function neg!(z::UnivPoly{T}, a::UnivPoly{T}) where {T <: RingElement} | ||
z.p = neg!(a.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.
Not yet quite complete (I want addmul/submul for UnivPoly, too) and also unsure about some things (see inline comments)