Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions experimental/ActionPolyRing/src/Content.jl
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ one(apr::ActionPolyRing) = apr(one(__upr(apr)))

base_ring_type(::Type{<:ActionPolyRing{T}}) where {T} = parent_type(T)

coefficient_ring_type(::Type{<:ActionPolyRing{T}}) where {T} = parent_type(T)

is_square(apre::ActionPolyRingElem) = is_square(data(apre))

Base.sqrt(apre::ActionPolyRingElem; check::Bool = true) = parent(apre)(sqrt(data(apre); check = check))
Expand Down Expand Up @@ -227,6 +229,8 @@ factor(apr::ActionPolyRingElem) = __wrap_factorization_apr(factor(data(apr)), pa

base_ring(apr::ActionPolyRing) = base_ring(__upr(apr))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact I'd argue that "right" definition here would be

Suggested change
base_ring(apr::ActionPolyRing) = base_ring(__upr(apr))
base_ring(apr::ActionPolyRing) = __upr(apr)

Or rather: __upr should be replaced by base_ring. The "base ring" or a ring R is a ring from which R was constructed.


coefficient_ring(apr::ActionPolyRing) = coefficient_ring(__upr(apr))

@doc raw"""
n_elementary_symbols(A::ActionPolyRing) -> Int

Expand Down Expand Up @@ -353,7 +357,7 @@ function to_univariate(apre::ActionPolyRingElem)
end
apr = parent(apre)
x = symbols(apr)[var]
R, _ = base_ring(apr)[x]
R, _ = coefficient_ring(apr)[x]
return to_univariate(R, apre)
end

Expand Down Expand Up @@ -948,7 +952,7 @@ Base.iterate(x::ActionPolyTerms, state=0) = __iter_helper(term, x.poly, state)

Base.length(x::Union{ActionPolyCoeffs, ActionPolyExponentVectors, ActionPolyMonomials, ActionPolyTerms}) = length(x.poly)

Base.eltype(::Type{ActionPolyCoeffs{PolyT}}) where {PolyT<:ActionPolyRingElem} = elem_type(base_ring_type(PolyT))
Base.eltype(::Type{ActionPolyCoeffs{PolyT}}) where {PolyT<:ActionPolyRingElem} = elem_type(coefficient_ring_type(PolyT))
Base.eltype(::Type{ActionPolyExponentVectors{PolyT}}) where {PolyT<:ActionPolyRingElem} = Vector{Int}
Base.eltype(::Type{ActionPolyMonomials{PolyT}}) where {PolyT<:ActionPolyRingElem} = PolyT
Base.eltype(::Type{ActionPolyTerms{PolyT}}) where {PolyT<:ActionPolyRingElem} = PolyT
Expand Down
8 changes: 4 additions & 4 deletions experimental/ActionPolyRing/src/IO.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function Base.show(io::IO, ::MIME"text/plain", dpr::DifferencePolyRing)
print(io, "\n")
print(io, "with $(n_action_maps(dpr)) commuting endomorphisms\n")
print(io, Indent())
print(io, "over ", Lowercase(), base_ring(dpr))
print(io, "over ", Lowercase(), coefficient_ring(dpr))
print(io, Dedent())
end

Expand All @@ -23,7 +23,7 @@ function Base.show(io::IO, dpr::DifferencePolyRing)
print(io, "Difference polynomial ring")
else
print(io, "Difference polynomial ring in $(n_elementary_symbols(dpr)) elementary symbols over ")
print(terse(io), Lowercase(), base_ring(dpr))
print(terse(io), Lowercase(), coefficient_ring(dpr))
end
end

Expand All @@ -36,7 +36,7 @@ function Base.show(io::IO, ::MIME"text/plain", dpr::DifferentialPolyRing)
print(io, "\n")
print(io, "with $(n_action_maps(dpr)) commuting derivations\n")
print(io, Indent())
print(io, "over ", Lowercase(), base_ring(dpr))
print(io, "over ", Lowercase(), coefficient_ring(dpr))
print(io, Dedent())
end

Expand All @@ -46,7 +46,7 @@ function Base.show(io::IO, dpr::DifferentialPolyRing)
print(io, "Differential polynomial ring")
else
print(io, "Differential polynomial ring in $(n_elementary_symbols(dpr)) elementary symbols over ")
print(terse(io), Lowercase(), base_ring(dpr))
print(terse(io), Lowercase(), coefficient_ring(dpr))
end
end

Expand Down
16 changes: 8 additions & 8 deletions experimental/ActionPolyRing/test/ActionPolyRing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ using Test

@testset "Check types" begin

@test base_ring_type(DifferencePolyRing{QQFieldElem}) == QQField
@test coefficient_ring_type(DifferencePolyRing{QQFieldElem}) == QQField
@test elem_type(DifferencePolyRing{QQFieldElem}) == DifferencePolyRingElem{QQFieldElem}
@test parent_type(DifferencePolyRingElem{QQFieldElem}) == DifferencePolyRing{QQFieldElem}

@test base_ring_type(DifferentialPolyRing{QQFieldElem}) == QQField
@test coefficient_ring_type(DifferentialPolyRing{QQFieldElem}) == QQField
@test elem_type(DifferentialPolyRing{QQFieldElem}) == DifferentialPolyRingElem{QQFieldElem}
@test parent_type(DifferentialPolyRingElem{QQFieldElem}) == DifferentialPolyRing{QQFieldElem}

Expand Down Expand Up @@ -164,8 +164,8 @@ using Test
end

@testset "Check public fields at construction" begin
@test base_ring(dpr) == ZZ
@test all(var -> base_ring(var) == ZZ, vars)
@test coefficient_ring(dpr) == ZZ
@test all(var -> coefficient_ring(var) == ZZ, vars)
@test elementary_symbols(dpr) == [:u1, :u2, :u3]
@test n_action_maps(dpr) == 3
@test n_elementary_symbols(dpr) == 3
Expand Down Expand Up @@ -267,8 +267,8 @@ using Test
end

@testset "Check public fields after adding variables" begin
@test base_ring(dpr) == ZZ
@test all(var -> base_ring(var) == ZZ, vars)
@test coefficient_ring(dpr) == ZZ
@test all(var -> coefficient_ring(var) == ZZ, vars)
@test elementary_symbols(dpr) == [:u1, :u2, :u3]
@test n_action_maps(dpr) == 3
@test n_elementary_symbols(dpr) == 3
Expand Down Expand Up @@ -525,8 +525,8 @@ using Test
end

@testset "Check public fields after changing ranking" begin
@test base_ring(dpr) == ZZ
@test all(var -> base_ring(var) == ZZ, vars)
@test coefficient_ring(dpr) == ZZ
@test all(var -> coefficient_ring(var) == ZZ, vars)
@test elementary_symbols(dpr) == [:u1, :u2, :u3]
@test n_action_maps(dpr) == 3
@test n_elementary_symbols(dpr) == 3
Expand Down
Loading