Skip to content

Commit

Permalink
Uniform base_field_type handling
Browse files Browse the repository at this point in the history
Also remove redundant dense_poly_type methods.
  • Loading branch information
fingolfin committed Dec 19, 2024
1 parent 9f4ccb9 commit 88eed80
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
2 changes: 2 additions & 0 deletions src/Hecke.jl
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,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,)))

Check warning on line 560 in src/Hecke.jl

View check run for this annotation

Codecov / codecov/patch

src/Hecke.jl#L559-L560

Added lines #L559 - L560 were not covered by tests

################################################################################
#
Expand Down
4 changes: 0 additions & 4 deletions src/LocalField/LocalField.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 2 additions & 6 deletions src/Map/NumField.jl
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,9 @@ end
#
################################################################################

base_field_type(::AbsSimpleNumField) = QQField
base_field_type(::Type{AbsSimpleNumField}) = QQField

Check warning on line 185 in src/Map/NumField.jl

View check run for this annotation

Codecov / codecov/patch

src/Map/NumField.jl#L185

Added line #L185 was not covered by tests

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

Check warning on line 187 in src/Map/NumField.jl

View check run for this annotation

Codecov / codecov/patch

src/Map/NumField.jl#L187

Added line #L187 was not covered by tests

base_field_type(::Type{RelNonSimpleNumField{T}}) where {T} = parent_type(T)

Expand Down
2 changes: 2 additions & 0 deletions src/Misc/RelFiniteField.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Check warning on line 59 in src/Misc/RelFiniteField.jl

View check run for this annotation

Codecov / codecov/patch

src/Misc/RelFiniteField.jl#L59

Added line #L59 was not covered by tests

base_field(F::RelFinField{S}) where S= base_ring(F.defining_polynomial)::parent_type(S)

characteristic(F::RelFinField) = characteristic(base_field(F))
Expand Down

0 comments on commit 88eed80

Please sign in to comment.