-
Notifications
You must be signed in to change notification settings - Fork 67
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 some ring / field conformance tests #1707
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,16 @@ | ||
# the following is copied from the `random_elem` function | ||
function test_elem(L::Union{QadicField, Hecke.LocalField}) | ||
b = basis(L) | ||
n = degree(L) | ||
r = [rand(1:5*n) for i in 1:n] # Choose small coordinates | ||
return sum( [r[i]*b[i] for i in 1:n]) | ||
end | ||
|
||
# TODO/FIXME: implement isapprox so we can get rid of the following HACK: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why? From the docs: Approximation (floating point and ball arithmetic only)isapprox(f::MyElem, g::MyElem; atol::Real=sqrt(eps())) so it is not part of the normal ring/field interface I'd say |
||
function equality(a::T, b::T) where {T <: Union{QadicFieldElem, Hecke.LocalFieldElem}} | ||
return a == b | ||
end | ||
|
||
@testset "LocalField" begin | ||
|
||
@testset "Creation" begin | ||
|
@@ -8,6 +21,9 @@ | |
@test characteristic(K) == 0 | ||
@test prime(K) == 2 | ||
|
||
test_Field_interface(K) | ||
#test_Field_interface_recursive(K) # TODO/FIXME: does not work due to missing isapprox | ||
|
||
Kt, t = polynomial_ring(K, "t") | ||
g = t^2+2 | ||
L, b = local_field(g, "b", Hecke.EisensteinLocalField, check = false) | ||
|
@@ -40,8 +56,14 @@ | |
|
||
@testset "Norm" begin | ||
K = qadic_field(3, 4, precision = 10)[1] | ||
test_Field_interface(K) | ||
#test_Field_interface_recursive(K) # TODO/FIXME: does not work due to missing isapprox | ||
|
||
Kx, x = polynomial_ring(K, "x") | ||
L = eisenstein_extension(x^20+3)[1] | ||
test_Field_interface(L) | ||
#test_Field_interface_recursive(L) # TODO/FIXME: does not work due to missing isapprox | ||
|
||
b = @inferred basis(L) | ||
for i = 1:10 | ||
r = 1+2*uniformizer(L)^i * sum([rand(1:10)*b[i] for i in 1:5]) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
@testset "RelFinField" begin | ||
|
||
@testset "conformance" begin | ||
F = Native.finite_field(3, 3, cached = false)[1] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @thofma I thought we'd rather get rid of the RelFinField? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I only replaced the ones in the prime decomposition of relative number fields. They might be used somewhere else still. |
||
x = polynomial_ring(F, "x", cached = false)[2] | ||
K, gK = @inferred Native.finite_field(x^2+1, :a) | ||
test_Field_interface_recursive(K) | ||
end | ||
|
||
@testset "Basic properties" begin | ||
F = Native.finite_field(3, 3, cached = false)[1] | ||
x = polynomial_ring(F, "x", cached = false)[2] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this be
base_ring(L::LocalField) = base_field(L)
instead?But
base_ring
was never (intended to be) part of any useful interface, it was just indicating, in recursively defined rings, the previous step. Strictly here,base_ring
might even have been the polynomial ring...base_field
,coefficient_ring/field
were intended to be more useful