From b871dba7cb001e622ba30e99e82ed32e8c1792f0 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 21 Dec 2024 10:37:45 +0100 Subject: [PATCH] Uniform base_field_type handling (#1706) Also remove redundant dense_poly_type methods. --- src/Hecke.jl | 2 ++ src/LocalField/LocalField.jl | 4 ---- src/Map/NumField.jl | 8 ++------ src/Misc/RelFiniteField.jl | 2 ++ 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/Hecke.jl b/src/Hecke.jl index f93a1996d9..d8810ebfcf 100644 --- a/src/Hecke.jl +++ b/src/Hecke.jl @@ -548,6 +548,8 @@ order_type(T::DataType) = throw(MethodError(order_type, (T,))) embedding_type(x) = embedding_type(typeof(x)) embedding_type(T::DataType) = throw(MethodError(embedding_type, (T,))) +base_field_type(x) = base_field_type(typeof(x)) +base_field_type(T::DataType) = throw(MethodError(base_field_type, (T,))) ################################################################################ # diff --git a/src/LocalField/LocalField.jl b/src/LocalField/LocalField.jl index 20ccf69de5..335626b38a 100644 --- a/src/LocalField/LocalField.jl +++ b/src/LocalField/LocalField.jl @@ -37,14 +37,10 @@ prime(K::LocalField) = prime(base_field(K)) # ################################################################################ -base_field_type(K::LocalField{S, T}) where {S <: FieldElem, T <: LocalFieldParameter} = parent_type(S) base_field_type(::Type{LocalField{S, T}}) where {S <: FieldElem, T <: LocalFieldParameter} = parent_type(S) elem_type(::Type{LocalField{S, T}}) where {S <: FieldElem, T <: LocalFieldParameter} = LocalFieldElem{S, T} -dense_poly_type(K::LocalField{S, T}) where {S <: FieldElem, T <: LocalFieldParameter} = Generic.Poly{LocalFieldElem{S, T}} -dense_poly_type(::Type{LocalField{S, T}}) where {S <: FieldElem, T <: LocalFieldParameter} = Generic.Poly{LocalFieldElem{S, T}} - ################################################################################ # # Basic predicates diff --git a/src/Map/NumField.jl b/src/Map/NumField.jl index 24275814cb..64848a6a80 100644 --- a/src/Map/NumField.jl +++ b/src/Map/NumField.jl @@ -182,13 +182,9 @@ end # ################################################################################ -base_field_type(::AbsSimpleNumField) = QQField +base_field_type(::Type{AbsSimpleNumField}) = QQField -base_field_type(::AbsNonSimpleNumField) = QQField - -base_field_type(::RelSimpleNumField{T}) where {T} = parent_type(T) - -base_field_type(::RelNonSimpleNumField{T}) where {T} = parent_type(T) +base_field_type(::Type{AbsNonSimpleNumField}) = QQField base_field_type(::Type{RelNonSimpleNumField{T}}) where {T} = parent_type(T) diff --git a/src/Misc/RelFiniteField.jl b/src/Misc/RelFiniteField.jl index 2c030a6177..3d5eee6d01 100644 --- a/src/Misc/RelFiniteField.jl +++ b/src/Misc/RelFiniteField.jl @@ -56,6 +56,8 @@ function defining_polynomial(F::RelFinField{T}) where T return F.defining_polynomial::dense_poly_type(T) end +base_field_type(::Type{RelFinField{S}}) where S = parent_type(S) + base_field(F::RelFinField{S}) where S= base_ring(F.defining_polynomial)::parent_type(S) characteristic(F::RelFinField) = characteristic(base_field(F))