Skip to content

Commit 62504fa

Browse files
committed
Remove calls to PolyRing(R)
1 parent 65f9956 commit 62504fa

File tree

6 files changed

+15
-10
lines changed

6 files changed

+15
-10
lines changed

src/Matrix.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2259,7 +2259,7 @@ end
22592259

22602260
function det_df(M::MatrixElem{T}) where {T <: RingElement}
22612261
R = base_ring(M)
2262-
S = PolyRing(R)
2262+
S = polynomial_ring_only(R, :x; cached=false)
22632263
n = nrows(M)
22642264
p = charpoly(S, M)
22652265
d = coeff(p, 0)

src/Poly.jl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2936,19 +2936,24 @@ function polynomial_to_power_sums(f::PolyRingElem{T}, n::Int=degree(f)) where T
29362936
end
29372937

29382938
@doc raw"""
2939+
power_sums_to_polynomial(P::Vector{T}) where T <: RingElement -> PolyRingElem{T}
29392940
power_sums_to_polynomial(P::Vector{T};
2940-
parent::PolyRing{T}=PolyRing(parent(P[1])) where T <: RingElement -> PolyRingElem{T}
2941+
parent::PolyRing{T} where T <: RingElement -> PolyRingElem{T}
29412942
29422943
Uses the Newton (or Newton-Girard) identities to obtain the polynomial
29432944
with given sums of powers of roots. The list must be nonempty and contain
29442945
`degree(f)` entries where $f$ is the polynomial to be recovered. The list
29452946
must start with the sum of first powers of the roots.
29462947
"""
2947-
function power_sums_to_polynomial(P::Vector{T};
2948-
parent::PolyRing{T}=PolyRing(parent(P[1]))) where T <: RingElement
2948+
function power_sums_to_polynomial(P::Vector{T}; parent::PolyRing{T}) where T <: RingElement
29492949
return power_sums_to_polynomial(P, parent)
29502950
end
29512951

2952+
function power_sums_to_polynomial(P::Vector{T}) where T <: RingElement
2953+
R = polynomial_ring_only(parent(P[1]), :x; cached=false)
2954+
return power_sums_to_polynomial(P, R)
2955+
end
2956+
29522957
function power_sums_to_polynomial(P::Vector{T}, Rx::PolyRing{T}) where T <: FieldElement
29532958
d = length(P)
29542959
R = base_ring(Rx)

src/generic/Misc/Poly.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ end
2323
################################################################################
2424

2525
function factor(R::Field, f::PolyRingElem)
26-
Rt = AbstractAlgebra.PolyRing(R)
26+
Rt = AbstractAlgebra.polynomial_ring_only(R, :x; cached=false)
2727
f1 = change_base_ring(R, f; parent = Rt)
2828
return factor(f1)
2929
end
@@ -70,7 +70,7 @@ end
7070
Returns the roots of the polynomial `f` in the field `R` as an array.
7171
"""
7272
function roots(R::Field, f::PolyRingElem)
73-
Rt = AbstractAlgebra.PolyRing(R)
73+
Rt = AbstractAlgebra.polynomial_ring_only(R, :x; cached=false)
7474
f1 = change_base_ring(R, f, parent = Rt)
7575
return roots(f1)
7676
end

src/generic/Misc/Rings.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function is_power(a::RingElem, n::Int)
1212
return true, a
1313
end
1414
R = parent(a)
15-
Rt = AbstractAlgebra.PolyRing(R)
15+
Rt = AbstractAlgebra.polynomial_ring_only(R, :x; cached=false)
1616
x = gen(Rt)
1717
r = roots(x^n - a)
1818
if length(r) == 0

src/generic/SparsePoly.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ function gcd(a::SparsePoly{T}, b::SparsePoly{T}, ignore_content::Bool = false) w
564564
# if we are in univariate case, convert to dense, take gcd, convert back
565565
if constant_coeffs
566566
# convert polys to univariate dense
567-
R = AbstractAlgebra.PolyRing(base_ring(base_ring(a)))
567+
R = AbstractAlgebra.polynomial_ring_only(base_ring(base_ring(a)), :x; cached=false)
568568
f = R()
569569
g = R()
570570
fit!(f, reinterpret(Int, a.exps[a.length] + 1))

test/generic/Poly-test.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
end
2323

2424
@testset "Generic.Poly.constructors" begin
25-
S1 = PolyRing(ZZ)
26-
S2 = PolyRing(ZZ)
25+
S1 = AbstractAlgebra.polynomial_ring_only(ZZ, :x; cached=false)
26+
S2 = AbstractAlgebra.polynomial_ring_only(ZZ, :x; cached=false)
2727

2828
@test S1 !== S2
2929
@test isa(S1, Generic.PolyRing)

0 commit comments

Comments
 (0)