Skip to content

Commit

Permalink
moved two functions from Oscar to Nemo (#1519)
Browse files Browse the repository at this point in the history
This is not yet satisfactory:

- Should `embed` return something?
  The `embed(k::T, K::T) where T <: FinField` method returns a mapping,
  but the documentation does not state what is returned,
  and the code that calls `embed` seems to ignore the return value.
- Tests and documentation are missing.
  • Loading branch information
ThomasBreuer authored Sep 13, 2023
1 parent 34264c6 commit d411bf9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/embedding/embedding.jl
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,10 @@ function embed(k::T, K::T) where T <: FinField
end
end

function embed(k::Nemo.fpField, K::fqPolyRepField)
@assert characteristic(K) == characteristic(k)
end

################################################################################
#
# Preimage map
Expand Down
2 changes: 2 additions & 0 deletions src/flint/fmpq.jl
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ returned as a rational with denominator $1$.
"""
Base.ceil(a::QQFieldElem) = QQFieldElem(cdiv(numerator(a), denominator(a)), 1)

nbits(a::QQFieldElem) = nbits(numerator(a)) + nbits(denominator(a))

###############################################################################
#
# Canonicalisation
Expand Down
3 changes: 3 additions & 0 deletions test/flint/fmpq-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ end
@test ceil(QQFieldElem(2, 3)) == 1
@test ceil(QQFieldElem(-1, 3)) == 0
@test ceil(QQFieldElem(2, 1)) == 2

@test nbits(QQFieldElem(12, 1)) == 5
@test nbits(QQFieldElem(1, 3)) == 3
end

@testset "QQFieldElem.unary_ops" begin
Expand Down

0 comments on commit d411bf9

Please sign in to comment.