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

Add more base_ring_type methods #1426

Merged
merged 1 commit into from
Sep 13, 2023
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
2 changes: 2 additions & 0 deletions src/AbsMSeries.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@

parent(a::MSeriesElem) = a.parent

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

Check warning on line 45 in src/AbsMSeries.jl

View check run for this annotation

Codecov / codecov/patch

src/AbsMSeries.jl#L45

Added line #L45 was not covered by tests

function base_ring(R::MSeriesRing{T}) where T <: RingElement
return base_ring(poly_ring(R))::parent_type(T)
end
Expand Down
1 change: 1 addition & 0 deletions src/AbstractAlgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,7 @@ export AllPerms
export allow_unicode
export base_field
export base_ring
export base_ring_type
export basis
export block_diagonal_matrix
export cached
Expand Down
2 changes: 2 additions & 0 deletions src/Fraction.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#
###############################################################################

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

Check warning on line 13 in src/Fraction.jl

View check run for this annotation

Codecov / codecov/patch

src/Fraction.jl#L13

Added line #L13 was not covered by tests

base_ring(a::FracField{T}) where T <: RingElem = a.base_ring::parent_type(T)

base_ring(a::FracElem) = base_ring(parent(a))
Expand Down
1 change: 1 addition & 0 deletions src/Generic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ import ..AbstractAlgebra: add!
import ..AbstractAlgebra: addeq!
import ..AbstractAlgebra: addmul!
import ..AbstractAlgebra: base_ring
import ..AbstractAlgebra: base_ring_type
import ..AbstractAlgebra: CacheDictType
import ..AbstractAlgebra: can_solve_with_solution_fflu
import ..AbstractAlgebra: can_solve_with_solution_lu
Expand Down
2 changes: 2 additions & 0 deletions src/Matrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#
###############################################################################

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

Check warning on line 13 in src/Matrix.jl

View check run for this annotation

Codecov / codecov/patch

src/Matrix.jl#L13

Added line #L13 was not covered by tests

base_ring(a::MatSpace{T}) where {T <: NCRingElement} = a.base_ring::parent_type(T)

base_ring(a::MatrixElem{T}) where {T <: NCRingElement} = a.base_ring::parent_type(T)
Expand Down
2 changes: 2 additions & 0 deletions src/MatrixAlgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#
###############################################################################

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

Check warning on line 13 in src/MatrixAlgebra.jl

View check run for this annotation

Codecov / codecov/patch

src/MatrixAlgebra.jl#L13

Added line #L13 was not covered by tests

function base_ring(a::MatAlgebra{T}) where {T <: NCRingElement}
a.base_ring::parent_type(T)
end
Expand Down
2 changes: 2 additions & 0 deletions src/NCPoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#
###############################################################################

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

Check warning on line 13 in src/NCPoly.jl

View check run for this annotation

Codecov / codecov/patch

src/NCPoly.jl#L13

Added line #L13 was not covered by tests

base_ring(R::NCPolyRing{T}) where T <: NCRingElem = R.base_ring::parent_type(T)

coefficient_ring(R::NCPolyRing) = base_ring(R)
Expand Down
5 changes: 0 additions & 5 deletions src/NemoStuff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -781,8 +781,3 @@ function (R::PolyRing{T})(x::AbstractAlgebra.Generic.RationalFunctionFieldElem{T
@assert parent(numerator(x)) === R
return numerator(x)
end

export base_ring_type

base_ring_type(::Type{AbstractAlgebra.Generic.PolyRing{T}}) where {T} = parent_type(T)

2 changes: 2 additions & 0 deletions src/Poly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#
###############################################################################

base_ring_type(::Type{PolyRing{T}}) where {T} = parent_type(T)

Check warning on line 13 in src/Poly.jl

View check run for this annotation

Codecov / codecov/patch

src/Poly.jl#L13

Added line #L13 was not covered by tests

base_ring(R::PolyRing{T}) where T <: RingElement = R.base_ring::parent_type(T)

base_ring(a::PolynomialElem) = base_ring(parent(a))
Expand Down
2 changes: 2 additions & 0 deletions src/RelSeries.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

parent(a::SeriesElem) = a.parent

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

Check warning on line 28 in src/RelSeries.jl

View check run for this annotation

Codecov / codecov/patch

src/RelSeries.jl#L28

Added line #L28 was not covered by tests

base_ring(R::SeriesRing{T}) where T <: RingElement = R.base_ring::parent_type(T)

base_ring(a::SeriesElem) = base_ring(parent(a))
Expand Down
2 changes: 2 additions & 0 deletions src/Residue.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#
###############################################################################

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

Check warning on line 13 in src/Residue.jl

View check run for this annotation

Codecov / codecov/patch

src/Residue.jl#L13

Added line #L13 was not covered by tests

base_ring(S::ResidueRing{T}) where {T <: RingElement} = S.base_ring::parent_type(T)

base_ring(r::ResElem) = base_ring(parent(r))
Expand Down
2 changes: 2 additions & 0 deletions src/ResidueField.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#
###############################################################################

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

Check warning on line 13 in src/ResidueField.jl

View check run for this annotation

Codecov / codecov/patch

src/ResidueField.jl#L13

Added line #L13 was not covered by tests

base_ring(S::ResidueField{T}) where {T <: RingElement} = S.base_ring::parent_type(T)

base_ring(r::ResFieldElem) = base_ring(parent(r))
Expand Down
4 changes: 3 additions & 1 deletion src/generic/FactoredFraction.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@
return FactoredFrac{T}
end

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

Check warning on line 25 in src/generic/FactoredFraction.jl

View check run for this annotation

Codecov / codecov/patch

src/generic/FactoredFraction.jl#L25

Added line #L25 was not covered by tests

function base_ring(F::FactoredFracField{T}) where T <: RingElement
return F.base_ring::AbstractAlgebra.parent_type(T)
return F.base_ring::parent_type(T)
end

function base_ring(a::FactoredFrac{T}) where T <: RingElement
Expand Down
6 changes: 4 additions & 2 deletions src/generic/FreeAssAlgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
return a.parent
end

function base_ring(a::FreeAssAlgebra)
return a.base_ring
base_ring_type(::Type{FreeAssAlgebra{T}}) where T <: RingElement = parent_type(T)

Check warning on line 27 in src/generic/FreeAssAlgebra.jl

View check run for this annotation

Codecov / codecov/patch

src/generic/FreeAssAlgebra.jl#L27

Added line #L27 was not covered by tests

function base_ring(a::FreeAssAlgebra{T}) where T <: RingElement
return a.base_ring::parent_type(T)
end

function symbols(a::FreeAssAlgebra)
Expand Down
2 changes: 2 additions & 0 deletions src/generic/FreeModule.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

parent_type(::Type{FreeModuleElem{T}}) where T <: Union{RingElement, NCRingElem} = FreeModule{T}

base_ring_type(::Type{FreeModule{T}}) where T <: Union{RingElement, NCRingElem} = parent_type(T)

Check warning on line 15 in src/generic/FreeModule.jl

View check run for this annotation

Codecov / codecov/patch

src/generic/FreeModule.jl#L15

Added line #L15 was not covered by tests

base_ring(M::FreeModule{T}) where T <: Union{RingElement, NCRingElem} = M.base_ring::parent_type(T)

base_ring(v::FreeModuleElem{T}) where T <: Union{RingElement, NCRingElem} = base_ring(parent(v))
Expand Down
5 changes: 5 additions & 0 deletions src/generic/FunctionField.jl
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,11 @@

elem_type(::Type{FunctionField{T}}) where T <: FieldElement = FunctionFieldElem{T}

function base_ring_type(::Type{FunctionField{T}}) where T <: FieldElement
U = dense_poly_type(T)
return RationalFunctionField{T, U}

Check warning on line 532 in src/generic/FunctionField.jl

View check run for this annotation

Codecov / codecov/patch

src/generic/FunctionField.jl#L530-L532

Added lines #L530 - L532 were not covered by tests
end

function base_ring(R::FunctionField{T}) where T <: FieldElement
U = dense_poly_type(T)
return R.base_ring::RationalFunctionField{T, U}
Expand Down
4 changes: 4 additions & 0 deletions src/generic/LaurentSeries.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@

elem_type(::Type{T}) where {S <: FieldElement, T <: LaurentSeriesField{S}} = LaurentSeriesFieldElem{S}

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

Check warning on line 36 in src/generic/LaurentSeries.jl

View check run for this annotation

Codecov / codecov/patch

src/generic/LaurentSeries.jl#L36

Added line #L36 was not covered by tests

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

Check warning on line 38 in src/generic/LaurentSeries.jl

View check run for this annotation

Codecov / codecov/patch

src/generic/LaurentSeries.jl#L38

Added line #L38 was not covered by tests

base_ring(R::LaurentSeriesRing{T}) where T <: RingElement = R.base_ring::parent_type(T)

base_ring(R::LaurentSeriesField{T}) where T <: FieldElement = R.base_ring::parent_type(T)
Expand Down
2 changes: 2 additions & 0 deletions src/generic/MPoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

elem_type(::Type{MPolyRing{T}}) where T <: RingElement = MPoly{T}

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

Check warning on line 19 in src/generic/MPoly.jl

View check run for this annotation

Codecov / codecov/patch

src/generic/MPoly.jl#L19

Added line #L19 was not covered by tests

base_ring(R::MPolyRing{T}) where T <: RingElement = R.base_ring::parent_type(T)

@doc raw"""
Expand Down
2 changes: 2 additions & 0 deletions src/generic/RationalFunctionField.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

elem_type(::Type{RationalFunctionField{T, U}}) where {T <: FieldElement, U <: Union{PolyRingElem, MPolyRingElem}} = RationalFunctionFieldElem{T, U}

base_ring_type(::Type{RationalFunctionField{T, U}}) where {T <: FieldElement, U <: Union{PolyRingElem, MPolyRingElem}} = parent_type(T)

Check warning on line 19 in src/generic/RationalFunctionField.jl

View check run for this annotation

Codecov / codecov/patch

src/generic/RationalFunctionField.jl#L19

Added line #L19 was not covered by tests

base_ring(a::RationalFunctionField{T, U}) where {T <: FieldElement, U <: Union{PolyRingElem, MPolyRingElem}} = a.base_ring::parent_type(T)

base_ring(a::RationalFunctionFieldElem) = base_ring(parent(a))
Expand Down
4 changes: 3 additions & 1 deletion src/generic/SparsePoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,12 @@
return n
end

base_ring(a::SparsePoly) = base_ring(parent(a))
base_ring_type(::Type{SparsePolyRing{T}}) where T <: RingElement = parent_type(T)

Check warning on line 63 in src/generic/SparsePoly.jl

View check run for this annotation

Codecov / codecov/patch

src/generic/SparsePoly.jl#L63

Added line #L63 was not covered by tests

base_ring(R::SparsePolyRing{T}) where {T <: RingElement} = R.base_ring::parent_type(T)

base_ring(a::SparsePoly) = base_ring(parent(a))

parent(a::SparsePoly) = a.parent

function Base.deepcopy_internal(a::SparsePoly{T}, dict::IdDict) where {T <: RingElement}
Expand Down
2 changes: 2 additions & 0 deletions src/generic/TotalFraction.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#
###############################################################################

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

Check warning on line 25 in src/generic/TotalFraction.jl

View check run for this annotation

Codecov / codecov/patch

src/generic/TotalFraction.jl#L25

Added line #L25 was not covered by tests

base_ring(a::TotFracRing{T}) where T <: RingElem = a.base_ring::parent_type(T)

base_ring(a::TotFrac) = base_ring(parent(a))
Expand Down
Loading