Skip to content

Commit e98da23

Browse files
committed
closes #240. Adds numerical gcd of Zeng, scaled GCD of Noda and Sasaki, rearranges calling interface a bit.
1 parent 5221953 commit e98da23

File tree

5 files changed

+784
-5
lines changed

5 files changed

+784
-5
lines changed

src/Polynomials.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ include("polynomials/Polynomial.jl")
1818
include("polynomials/ImmutablePolynomial.jl")
1919
include("polynomials/SparsePolynomial.jl")
2020
include("polynomials/LaurentPolynomial.jl")
21+
include("polynomials/ngcd.jl")
2122

2223
include("polynomials/ChebyshevT.jl")
2324

src/common.jl

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -536,11 +536,17 @@ Polynomial(4.0 - 6.0*x + 2.0*x^2)
536536
537537
```
538538
"""
539-
function Base.gcd(p1::AbstractPolynomial{T}, p2::AbstractPolynomial{S};
540-
atol::Real=zero(real(promote_type(T,S))),
541-
rtol::Real=Base.rtoldefault(real(promote_type(T,S)))
542-
) where {T,S}
543-
r₀, r₁ = promote(p1, p2)
539+
function Base.gcd(p1::AbstractPolynomial{T}, p2::AbstractPolynomial{S}; kwargs...) where {T,S}
540+
gcd(promote(p1, p2)...; kwargs...)
541+
end
542+
543+
function Base.gcd(p1::P, p2::Q;
544+
atol::Real=zero(real(T)),
545+
rtol::Real=Base.rtoldefault(real(T))
546+
) where {T, P <: AbstractPolynomial{T}, Q <: AbstractPolynomial{T}}
547+
548+
549+
r₀, r₁ = p1, p2
544550
iter = 1
545551
itermax = length(r₁)
546552

0 commit comments

Comments
 (0)