From 6695643c59719cada691b525e348094f2f9e6bc2 Mon Sep 17 00:00:00 2001 From: Tommy Hofmann Date: Tue, 23 May 2023 13:34:23 +0200 Subject: [PATCH] Make FqField the default finite field --- docs/Project.toml | 1 + docs/src/finitefield.md | 221 ++--------------------- docs/src/gfp.md | 2 +- src/HeckeMiscFiniteField.jl | 18 -- src/Native.jl | 4 + src/Nemo.jl | 19 +- src/embedding/embedding.jl | 2 +- src/flint/FlintTypes.jl | 4 +- src/flint/fq.jl | 54 +----- src/flint/fq_default.jl | 151 ++++++++++++---- src/flint/fq_default_embed.jl | 4 +- src/flint/fq_default_extended.jl | 138 +++++++------- src/flint/fq_embed.jl | 2 +- src/flint/fq_nmod.jl | 40 ++-- src/flint/fq_nmod_embed.jl | 2 +- src/flint/gfp_elem.jl | 36 ++-- src/flint/gfp_fmpz_elem.jl | 24 +-- test/Benchmark-test.jl | 2 +- test/flint/fq-test.jl | 68 +++---- test/flint/fq_abs_series-test.jl | 40 ++-- test/flint/fq_default-test.jl | 62 +++---- test/flint/fq_default_abs_series-test.jl | 38 ++-- test/flint/fq_default_embed-test.jl | 30 +-- test/flint/fq_default_extended-test.jl | 90 ++++----- test/flint/fq_default_mat-test.jl | 58 +++--- test/flint/fq_default_mpoly-test.jl | 6 +- test/flint/fq_default_poly-test.jl | 78 ++++---- test/flint/fq_default_rel_series-test.jl | 40 ++-- test/flint/fq_mat-test.jl | 52 +++--- test/flint/fq_nmod-test.jl | 68 +++---- test/flint/fq_nmod_abs_series-test.jl | 40 ++-- test/flint/fq_nmod_embed-test.jl | 36 ++-- test/flint/fq_nmod_mat-test.jl | 52 +++--- test/flint/fq_nmod_mpoly-test.jl | 57 +++--- test/flint/fq_nmod_poly-test.jl | 80 ++++---- test/flint/fq_nmod_rel_series-test.jl | 40 ++-- test/flint/fq_poly-test.jl | 74 ++++---- test/flint/fq_rel_series-test.jl | 40 ++-- test/flint/gfp-test.jl | 78 ++++---- test/flint/gfp_abs_series-test.jl | 40 ++-- test/flint/gfp_fmpz-test.jl | 76 ++++---- test/flint/gfp_fmpz_abs_series-test.jl | 40 ++-- test/flint/gfp_fmpz_mat-test.jl | 62 +++---- test/flint/gfp_fmpz_mpoly-test.jl | 42 ++--- test/flint/gfp_fmpz_poly-test.jl | 74 ++++---- test/flint/gfp_fmpz_rel_series-test.jl | 40 ++-- test/flint/gfp_mat-test.jl | 68 +++---- test/flint/gfp_mpoly-test.jl | 46 ++--- test/flint/gfp_poly-test.jl | 74 ++++---- test/flint/gfp_rel_series-test.jl | 40 ++-- 50 files changed, 1129 insertions(+), 1324 deletions(-) diff --git a/docs/Project.toml b/docs/Project.toml index 9e99902980..341bbcbfd2 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -1,6 +1,7 @@ [deps] AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d" Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" +Nemo = "2edaba10-b0f1-5616-af89-8c11ac63239a" [compat] Documenter = "1.0" diff --git a/docs/src/finitefield.md b/docs/src/finitefield.md index 7b4be16fff..4f04dbec95 100644 --- a/docs/src/finitefield.md +++ b/docs/src/finitefield.md @@ -7,43 +7,15 @@ end # Finite fields -Finite fields are provided in Nemo by Flint. This allows construction of finite -fields of any characteristic and degree for which there are Conway polynomials. -It is also possible for the user to specify their own irreducible polynomial -generating a finite field. +A finite field $K$ is represented as simple extension $K = k(\alpha) = k[x]/(f)$, where $k$ can +be +- a prime field $\mathbf{F}_p$ ($K$ is then an *absolute finite field*), or +- an arbitrary finite field $k$ ($K$ is then a *relative finite field*). -Finite fields are constructed using the `FlintFiniteField` function. However, -for convenience we define +In both cases, we call $k$ the *base field* of $K$, $\alpha$ a *generator* and $f$ the *defining polynomial* of $K$. -``` -finite_field = FlintFiniteField -``` - -so that finite fields can be constructed using `finite_field` rather than -`FlintFiniteField`. Note that this is the name of the constructor, but not of -finite field type. - -The types of finite field elements in Nemo are given in the following table, -along with the libraries that provide them and the associated types of the -parent objects. - - Library | Field | Element type | Parent type ----------|--------------------------------|---------------|--------------------- -Flint | $\mathbb{F}_{p^n}$ (small $p$) | `fqPolyRepFieldElem` | `fqPolyRepField` -Flint | $\mathbb{F}_{p^n}$ (large $p$) | `FqPolyRepFieldElem` | `FqPolyRepField` - -The only difference between the `FqPolyRepFieldElem` and `fqPolyRepFieldElem` types is the representation. -The former is for finite fields with multiprecision characteristic and the -latter is for characteristics that fit into a single unsigned machine word. The -`FlintFiniteField` constructor automatically picks the correct representation -for the user, and so the average user doesn't need to know about the actual -types. - -All the finite field types belong to the `FinField` abstract type and the -finite field element types belong to the `FinFieldElem` abstract type. - -Since all the functionality for the `FqPolyRepFieldElem` finite field type is identical to that -provided for the `fqPolyRepFieldElem` finite field type, we simply document the former. +Note that all field theoretic properties (like basis, degree or trace) are defined with respect to the base field. +Methods with prefix `absolute_` return ## Finite field functionality @@ -53,180 +25,14 @@ Finite fields in Nemo provide all the field functionality described in AbstractA Below we describe the functionality that is provided in addition to this. -### Constructors - -In order to construct finite field elements in Nemo, one must first construct -the finite field itself. This is accomplished with one of the following -constructors. - -```@docs -FlintFiniteField -``` - -Here are some examples of creating finite fields and making use of the -resulting parent objects to coerce various elements into those fields. - -**Examples** - -```jldoctest -julia> R, x = finite_field(7, 3, "x") -(Finite field of degree 3 over GF(7), x) - -julia> S, y = finite_field(ZZ(12431351431561), 2, "y") -(Finite field of degree 2 over GF(12431351431561), y) - -julia> T, t = polynomial_ring(residue_ring(ZZ, 12431351431561), "t") -(Univariate polynomial ring in t over ZZ/(12431351431561), t) - -julia> U, z = finite_field(t^2 + 7, "z") -(Finite field of degree 2 over GF(12431351431561), z) - -julia> a = R(5) -5 - -julia> b = R(x) -x - -julia> c = S(ZZ(11)) -11 - -julia> d = U(7) -7 -``` - -### Basic manipulation - -```@docs -gen(::FqPolyRepField) -``` - -```@docs -is_gen(::FqPolyRepFieldElem) -``` - -```@docs -coeff(::FqPolyRepFieldElem, ::Int) -``` - -```@docs -degree(::FqPolyRepField) -``` - -```@docs -modulus(::FqPolyRepField) -``` - -**Examples** - -```jldoctest -julia> R, x = finite_field(ZZ(7), 5, "x") -(Finite field of degree 5 over GF(7), x) - -julia> c = gen(R) -x - -julia> d = characteristic(R) -7 - -julia> f = order(R) -16807 - -julia> g = degree(R) -5 - -julia> n = is_gen(x) -true -``` - -### Special functions - -Various special functions with finite field specific behaviour are defined. - -```@docs -tr(::FqPolyRepFieldElem) -``` - -```@docs -norm(::FqPolyRepFieldElem) -``` - -```@docs -frobenius(::FqPolyRepFieldElem, ::Int) -``` - -```@docs -pth_root(::FqPolyRepFieldElem) -``` - -**Examples** - -```jldoctest -julia> R, x = finite_field(ZZ(7), 5, "x") -(Finite field of degree 5 over GF(7), x) - -julia> a = x^4 + 3x^2 + 6x + 1 -x^4 + 3*x^2 + 6*x + 1 - -julia> b = tr(a) -1 - -julia> c = norm(a) -4 - -julia> d = frobenius(a) -x^4 + 2*x^3 + 3*x^2 + 5*x + 1 - -julia> f = frobenius(a, 3) -3*x^4 + 3*x^3 + 3*x^2 + x + 4 - -julia> g = pth_root(a) -4*x^4 + 3*x^3 + 4*x^2 + 5*x + 2 -``` - -### Lift - -```@docs -lift(::FpPolyRing, ::FqPolyRepFieldElem) -``` - -**Examples** - -```jldoctest -julia> R, x = finite_field(23, 2, "x") -(Finite field of degree 2 over GF(23), x) - -julia> S, y = polynomial_ring(GF(23), "y") -(Univariate polynomial ring in y over GF(23), y) - -julia> f = 8x + 9 -8*x + 9 - -julia> lift(S, f) -8*y + 9 -``` - -# Uniform finite fields - -An (experimental) uniform finite field interface is provided by the type `FqField`. -Such a finite field can be constructed as an extension of a prime field -$\mathbf{F}_p$ (an absolute extension) or of another finite field (a relative -extension). The field over which the extension is constructed is referred to as the *base field* -and field theoretic properties like the degree of an extension or the trace of an element are understood with respect to the base field. -The corresponding functionality for the implicit absolute extension over the prime field is available -by methods with the prefix `absolute_`. - -Note that all finite fields are simple extension $k[t]/(f)$ of their base field $k$. -The irreducible polynomial $f \in k[t]$ is the *defining polynomial* and the class of $t$ is referred -to as the *generator* of the extension. - -## Construction of finite fields +## Constructors ```@docs -Nemo._FiniteField -Nemo._GF +finite_field +GF ``` -## Field properties +## Field functionality ```@docs base_field(::FqField) @@ -237,12 +43,15 @@ is_absolute(::FqField) defining_polynomial(::FqPolyRing, ::FqField) ``` -## Element properties +## Element functionality ```@docs +gen(::FqField) +is_gen(::FqFieldElem) tr(::FqFieldElem) absolute_tr(::FqFieldElem) norm(::FqFieldElem) absolute_norm(::FqFieldElem) lift(::FqPolyRing, ::FqFieldElem) +lift(::ZZRing, ::FqFieldElem) ``` diff --git a/docs/src/gfp.md b/docs/src/gfp.md index dcb433ed85..726f91f420 100644 --- a/docs/src/gfp.md +++ b/docs/src/gfp.md @@ -60,7 +60,7 @@ Below we describe the functionality that is provided in addition to these. ```jldoctest julia> F = GF(3) -Finite field of characteristic 3 +Finite field of degree 1 over GF(3) julia> a = characteristic(F) 3 diff --git a/src/HeckeMiscFiniteField.jl b/src/HeckeMiscFiniteField.jl index afe3b3bc69..de8c9a454a 100644 --- a/src/HeckeMiscFiniteField.jl +++ b/src/HeckeMiscFiniteField.jl @@ -1,21 +1,3 @@ -# additional constructors - -function FlintFiniteField(p::Integer; cached::Bool=true) - @assert is_prime(p) - k = GF(p, cached=cached) - return k, k(1) -end - -function FlintFiniteField(p::ZZRingElem; cached::Bool=true) - @assert is_prime(p) - k = GF(p, cached=cached) - return k, k(1) -end - -GF(p::Integer, k::Int, s::VarName=:o; cached::Bool=true) = FlintFiniteField(p, k, s, cached=cached)[1] -GF(p::ZZRingElem, k::Int, s::VarName=:o; cached::Bool=true) = FlintFiniteField(p, k, s, cached=cached)[1] - - ## ## rand for Flint-Finite fields ## diff --git a/src/Native.jl b/src/Native.jl index c858da8579..a9ca6377ed 100644 --- a/src/Native.jl +++ b/src/Native.jl @@ -48,6 +48,8 @@ function finite_field(F::FqPolyRepField, deg::Int, s::VarName = :o; cached = tru return FqPolyRepField(characteristic(F), deg, Symbol(s), cached) end +similar(F::FqPolyRepField, deg::Int, s::VarName = :o; cached = true) = finite_field(F, deg, s, cached = cached) + function finite_field(char::Int, deg::Int, s::VarName = :o; cached = true) parent_obj = fqPolyRepField(ZZRingElem(char), deg, Symbol(s), cached) return parent_obj, gen(parent_obj) @@ -62,6 +64,8 @@ function finite_field(F::fqPolyRepField, deg::Int, s::VarName = :o; cached = tru return fqPolyRepField(characteristic(F), deg, Symbol(s), cached) end +similar(F::fqPolyRepField, deg::Int, s::VarName = :o; cached = true) = FiniteField(F, deg, s, cached = cached) + # Additional from Hecke function finite_field(p::Integer; cached::Bool = true) @assert is_prime(p) diff --git a/src/Nemo.jl b/src/Nemo.jl index 9b590d7615..e056646c32 100644 --- a/src/Nemo.jl +++ b/src/Nemo.jl @@ -171,6 +171,7 @@ for i in names(AbstractAlgebra) @eval export $i end +<<<<<<< HEAD import AbstractAlgebra: _absolute_basis import AbstractAlgebra: @attributes import AbstractAlgebra: @show_name @@ -198,6 +199,22 @@ import AbstractAlgebra: promote_rule import AbstractAlgebra: Ring import AbstractAlgebra: Set import AbstractAlgebra: set_attribute! +======= +export GF + +import AbstractAlgebra: Set, Module, Ring, Group, Field, promote_rule + +import AbstractAlgebra: pretty, Lowercase, LowercaseOff, Indent, Dedent, ErrorConstrDimMismatch + +export flint_cleanup, flint_set_num_threads + +export PadicField, QadicField + +export QQBar + +# Things/constants which are also defined in AbstractAlgebra: +export ZZ, QQ, finite_field, number_field +>>>>>>> 7e5b9356a (Make FqField the default finite field) include("Exports.jl") @@ -598,7 +615,7 @@ const ZZ = FlintZZ const QQ = FlintQQ const PadicField = FlintPadicField const QadicField = FlintQadicField -const finite_field = FlintFiniteField +#const FiniteField = FlintFiniteField ############################################################################### # diff --git a/src/embedding/embedding.jl b/src/embedding/embedding.jl index 2d0bd9cb94..23d32a0630 100644 --- a/src/embedding/embedding.jl +++ b/src/embedding/embedding.jl @@ -344,7 +344,7 @@ function intersections(k::T, K::T) where T <: FinField # and we embed it in k and S else # kc of same type as k but degree c - kc = finite_field(k, c, string("x", c)) + kc = similar(k, c, string("x", c)) embed(kc, k) for g in subK[l] embed(kc, domain(g)) diff --git a/src/flint/FlintTypes.jl b/src/flint/FlintTypes.jl index cba144d6d2..65b53f559e 100644 --- a/src/flint/FlintTypes.jl +++ b/src/flint/FlintTypes.jl @@ -6893,13 +6893,13 @@ const _fq_default_mpoly_union = Union{AbstractAlgebra.Generic.MPoly{FqPolyRepFie m = modulus(R) p = characteristic(R) if fits(UInt, p) - Fq = GF(UInt(p)) + Fq = Native.GF(UInt(p)) if isone(degree(m)) Fqx = polynomial_ring(Fq, s, cached = cached, ordering = ordering)[1] return new(Fqx, R, 3) end mm = polynomial_ring(Fq, "x")[1](lift(polynomial_ring(ZZ, "x")[1], m)) - Fq = FlintFiniteField(mm, R.var, cached = cached, check = false)[1] + Fq = Native.FiniteField(mm, R.var, cached = cached, check = false)[1] Fqx = polynomial_ring(Fq, s, cached = cached, ordering = ordering)[1] return new(Fqx, R, 2) end diff --git a/src/flint/fq.jl b/src/flint/fq.jl index de261d00a6..566f7698ad 100644 --- a/src/flint/fq.jl +++ b/src/flint/fq.jl @@ -512,7 +512,7 @@ Return the modulus defining the finite field $k$. """ function modulus(k::FqPolyRepField, var::VarName=:T) p = characteristic(k) - Q = polynomial(GF(p), [], Symbol(var)) + Q = polynomial(Native.GF(p), [], Symbol(var)) P = ccall((:fq_ctx_modulus, libflint), Ref{FpPolyRingElem}, (Ref{FqPolyRepField},), k) ccall((:fmpz_mod_poly_set, libflint), Nothing, @@ -596,56 +596,6 @@ function (a::FqPolyRepField)(b::Vector{<:IntegerUnion}) da = degree(a) db = length(b) da == db || error("Coercion impossible") - F = GF(characteristic(a), cached = false) + F = Native.GF(characteristic(a), cached = false) return FqPolyRepFieldElem(a, polynomial(F, b)) end - -############################################################################### -# -# FlintFiniteField constructor -# -############################################################################### - -@doc raw""" - FlintFiniteField(char::ZZRingElem, deg::Int, s::VarName; cached = true) -Returns a tuple $S, x$ consisting of a finite field parent object $S$ and -generator $x$ for the finite field of the given characteristic and degree. -The string $s$ is used to designate how the finite field generator will be -printed. The characteristic must be prime. When a Conway polynomial is known, -the field is generated using the Conway polynomial. Otherwise a random -sparse, irreducible polynomial is used. The generator of the field is -guaranteed to be a multiplicative generator only if the field is generated by -a Conway polynomial. We require the degree to be positive. -""" -function FlintFiniteField(char::ZZRingElem, deg::Int, s::VarName = :o; cached = true) - parent_obj = FqPolyRepField(char, deg, Symbol(s), cached) - return parent_obj, gen(parent_obj) -end - -@doc raw""" - FlintFiniteField(pol::Union{ZZModPolyRingElem, FpPolyRingElem}, s::VarName; cached = true, check = true) -Returns a tuple $S, x$ consisting of a finite field parent object $S$ and -generator $x$ for the finite field over $F_p$ defined by the given -polynomial, i.e. $\mathbb{F}_p[t]/(pol)$. The characteristic is specified by -the modulus of `pol`. The polynomial is required to be irreducible, but this -is not checked. The base ring of the polynomial is required to be a field, which -is checked by default. Use `check = false` to disable the check. -The string $s$ is used to designate how the finite field -generator will be printed. The generator will not be multiplicative in -general. -""" -function FlintFiniteField(pol::Union{ZZModPolyRingElem, FpPolyRingElem}, - s::VarName = :o; cached = true, check::Bool=true) - parent_obj = FqPolyRepField(pol, Symbol(s), cached, check=check) - return parent_obj, gen(parent_obj) -end - -@doc raw""" - FlintFiniteField(F::FqPolyRepField, deg::Int, s::VarName; cached = true) - -Return a finite field with the same type as `F` but with a possibly different -degree `deg` over the prime subfield. -""" -function FlintFiniteField(F::FqPolyRepField, deg::Int, s::VarName = :o; cached = true) - return FqPolyRepField(characteristic(F), deg, Symbol(s), cached) -end diff --git a/src/flint/fq_default.jl b/src/flint/fq_default.jl index 52cf39f782..e6fee2c040 100644 --- a/src/flint/fq_default.jl +++ b/src/flint/fq_default.jl @@ -106,6 +106,21 @@ end # ############################################################################### +@doc raw""" + lift(::ZZRing, x::FqFieldElem) -> ZZRingElem + +Given an element $x$ of a prime field $\mathbf{F}_p$, return +a preimage under the canonical map $\mathbf{Z} \to \mathbf{F}_p$. + +# Examples + +```jldoctest +julia> K = GF(19); + +julia> lift(ZZ, K(3)) +3 +``` +""" function lift(R::ZZRing, x::FqFieldElem) z = R() ok = ccall((:fq_default_get_fmpz, libflint), Cint, @@ -250,14 +265,14 @@ end function _get_raw_type(::Type{fqPolyRepField}, F::FqField) @assert _fq_default_ctx_type(F) == 2 - Rx, _ = polynomial_ring(GF(UInt(characteristic(F))), "x", cached = false) + Rx, _ = polynomial_ring(Native.GF(UInt(characteristic(F))), "x", cached = false) m = map_coefficients(x -> _coeff(x, 0), defining_polynomial(F), parent = Rx) return fqPolyRepField(m, :$, false) end function _get_raw_type(::Type{FqPolyRepField}, F::FqField) @assert _fq_default_ctx_type(F) == 3 - Rx, _ = polynomial_ring(GF(characteristic(F)), "x", cached = false) + Rx, _ = polynomial_ring(Native.GF(characteristic(F)), "x", cached = false) m = map_coefficients(x -> _coeff(x, 0), defining_polynomial(F), parent = Rx) return FqPolyRepField(m, :$, false) end @@ -269,12 +284,12 @@ end function _get_raw_type(::Type{fpField}, F::FqField) @assert _fq_default_ctx_type(F) == 4 - return GF(UInt(order(F))) + return Native.GF(UInt(order(F))) end function _get_raw_type(::Type{FpField}, F::FqField) @assert _fq_default_ctx_type(F) == 5 - return GF(order(F)) + return Native.GF(order(F)) end # image/preimage @@ -722,7 +737,7 @@ end function modulus(k::FqField, var::String="T") p = characteristic(k) - Q = polynomial(GF(p), [], var, cached = false) + Q = polynomial(Native.GF(p), [], var, cached = false) ccall((:fq_default_ctx_modulus, libflint), Nothing, (Ref{FpPolyRingElem}, Ref{FqField}), Q, k) @@ -797,6 +812,13 @@ function (a::FqField)(b::Union{ZZModPolyRingElem, FpPolyRingElem}) return z end +function (a::FqField)(b::Vector{<:IntegerUnion}) + da = degree(a) + db = length(b) + da == db || error("Coercion impossible") + return a(parent(defining_polynomial(a))(b)) +end + ############################################################################### # # FlintFiniteField constructor @@ -804,15 +826,35 @@ end ############################################################################### @doc raw""" - NGFiniteField(char::IntegerUnion, deg::Int, s::VarName; cached = true, check = true) + finite_field(p::IntegerUnion, d::Int, s::VarName; cached = true, check = true) + finite_field(q::IntegerUnion, s::VarName; cached = true, check = true) + finite_field(f::FqPolyElem, s::VarName; cached = true, check = true) + +Return a tuple $K, a$ consisting of a finite field $K$ of order $q = p^d$ and +algebra generator $x$. The string $s$ is used to designate how the finite field +generator will be printed. + +If a polynomial $f \in k[X]$ over a finite field $k$ is specified, the relative finite field +$K = k[X]/(f)$ will be constructed as a finite field with base field $k$. -Returns a tuple $S, x$ consisting of a finite field $S$ of degree `deg` with -characteristic `char` and generator $x$ for the finite field of the given -characteristic and degree. The string $s$ is used to designate how the finite -field generator will be -printed. +# Examples + +```jldoctest +julia> K, a = finite_field(3, 2, "a") +(Finite field of degree 2 over GF(3), a) + +julia> K, a = finite_field(9, "a") +(Finite field of degree 2 over GF(3), a) + +julia> Kx, x = K["x"]; + +julia> L, b = finite_field(x^3 + x^2 + x + 2, "b") +(Relative finite field of degree 3 over GF(3^2), b) +``` """ -function NGFiniteField(char::IntegerUnion, deg::Int, s::VarName = :o; cached = true, check::Bool = true) +finite_field + +function finite_field(char::IntegerUnion, deg::Int, s::VarName = :o; cached = true, check::Bool = true) check && !is_prime(char) && error("Characteristic must be prime") _char = ZZRingElem(char) S = Symbol(s) @@ -821,31 +863,70 @@ function NGFiniteField(char::IntegerUnion, deg::Int, s::VarName = :o; cached = t return parent_obj, _gen(parent_obj) end -# @doc raw""" -# NGFiniteField(pol::Union{ZZModPolyRingElem, FpPolyRingElem}, s::VarName; cached = true, check = true) -# -# Returns a tuple $S, x$ consisting of a finite field parent object $S$ and -# generator $x$ for the finite field over $F_p$ defined by the given -# polynomial, i.e. $\mathbb{F}_p[t]/(pol)$. The characteristic is specified by -# the modulus of `pol`. The polynomial is required to be irreducible, but this -# is not checked. The base ring of the polynomial is required to be a field, which -# is checked by default. Use `check = false` to disable the check. -# The string $s$ is used to designate how the finite field -# generator will be printed. The generator will not be multiplicative in -# general. -# """ -# function NGFiniteField(pol::Union{ZZModPolyRingElem, FpPolyRingElem, zzModPolyRingElem, fpPolyRingElem}, -# s::VarName; cached = true, check::Bool=true) -# S = Symbol(s) -# parent_obj = FqField(pol, S, cached, check=check) -# -# return parent_obj, _gen(parent_obj) -# end -# -# +function finite_field(q::IntegerUnion, s::VarName = :o; cached::Bool = true, check::Bool = true) + fl, e, p = is_prime_power_with_data(q) + !fl && error("Order must be a prime power") + return finite_field(p, e, s; cached = cached, check = false) +end + +function finite_field(f::FqPolyRingElem, s::VarName = :o; cached::Bool = true, check::Bool = true, absolute::Bool = false) + (check && !is_irreducible(f)) && error("Defining polynomial must be irreducible") + # Should probably have its own cache + F = FqField(f, Symbol(s), cached, absolute) + return F, gen(F) +end + +@doc raw""" + GF(p::IntegerUnion, d::Int, s::String; cached::Bool, check::Bool) + GF(q::IntegerUnion, s::String; cached::Bool, check::Bool) + GF(f::FqPolyRingElem; s::String; cached::Bool, check::Bool) + +Return a finite field $K$ of order $q = p^d$. The string $s$ is +used to designate how the finite field generator will be printed. + +If a polynomial $f \in k[X]$ over a finite field $k$ is specified, +the finite field $K = k[X]/(f)$ will be constructed as a finite +field with base field $k$. + +# Examples + +```jldoctest +julia> K = GF(3, 2, "a") +Finite field of degree 2 over GF(3) + +julia> K = GF(9, "a") +Finite field of degree 2 over GF(3) + +julia> Kx, x = K["x"]; + +julia> L = GF(x^3 + x^2 + x + 2, "b") +Relative finite field of degree 3 over GF(3^2) +``` +""" +GF + +function GF(a::IntegerUnion, s::VarName = :o; cached::Bool = true, check::Bool = true) + return finite_field(a, s; cached = cached, check = check)[1] +end + +function GF(p::IntegerUnion, d::Int, s::VarName = :o; cached::Bool = true, check::Bool = true) + return finite_field(p, d, s; cached = cached, check = check)[1] +end + +function GF(f::FqPolyRingElem, s::VarName = :o; cached::Bool = true, check::Bool = true, absolute::Bool = false) + return finite_field(f, s; cached = cached, check = check)[1] +end + +################################################################################ +# +# Intersection code +# +################################################################################ # The following code is used in the intersection code -function FlintFiniteField(F::FqField, deg::Int, s::VarName = :o; cached = true) +function finite_field(F::FqField, deg::Int, s::VarName = :o; cached = true) return FqField(characteristic(F), deg, Symbol(s), cached) end +similar(F::FqField, deg::Int, s::VarName = :o; cached = true) = finite_field(F, deg, s, cached = cached) + diff --git a/src/flint/fq_default_embed.jl b/src/flint/fq_default_embed.jl index 644e0e2080..756907a4eb 100644 --- a/src/flint/fq_default_embed.jl +++ b/src/flint/fq_default_embed.jl @@ -5,7 +5,7 @@ ############################################################################### function _as_fq_finite_field(F::FqField) - return FlintFiniteField(modulus(F), :a; cached = false)[1] + return Native.FiniteField(modulus(F), :a; cached = false)[1] end @@ -67,7 +67,7 @@ function embed_gens(k::FqField, K::FqField) a = k() b = K() p = ZZRingElem(characteristic(k))::ZZRingElem - R = GF(p) + R = Native.GF(p) PR = polynomial_ring(R, "T")[1] P = PR() diff --git a/src/flint/fq_default_extended.jl b/src/flint/fq_default_extended.jl index 6e99282b0d..52b589f8b0 100644 --- a/src/flint/fq_default_extended.jl +++ b/src/flint/fq_default_extended.jl @@ -46,7 +46,7 @@ Return the prime field of `F`. """ function prime_field(F::FqField) # We want them to be equal among all finite fields - return FqField(characteristic(F), 1, Symbol("#"), true) + return FqField(characteristic(F), 1, :o, true) end ################################################################################ @@ -73,17 +73,33 @@ function _coerce_to_prime_field(a::FqFieldElem) end @doc raw""" - defining_polynomial([R::FqPolyRing], L::FqField) + defining_polynomial([R::FqPolyRing], K::FqField) -Return the defining polynomial of `L` as a polynomial over the -base field of `L`. +Return the defining polynomial of `K` as a polynomial over the +base field of `K`. If the polynomial ring `R` is specified, the polynomial will be an element of `R`. + +# Examples + +```jldoctest +julia> K, a = finite_field(9, "a"); + +julia> defining_polynomial(K) +x^2 + 2*x + 2 + +julia> Ky, y = K["y"]; + +julia> L, b = finite_field(y^3 + y^2 + y + 2, "b"); + +julia> defining_polynomial(L) +y^3 + y^2 + y + 2 +``` """ -function defining_polynomial(R::FqPolyRing, L::FqField) - coefficient_ring(R) !== base_field(L) && error("Coefficient ring must be base field of finite field") - f = defining_polynomial(L) # this is cached +function defining_polynomial(R::FqPolyRing, K::FqField) + coefficient_ring(R) !== base_field(K) && error("Coefficient ring must be base field of finite field") + f = defining_polynomial(K) # this is cached if parent(f) === R return f else @@ -93,13 +109,13 @@ function defining_polynomial(R::FqPolyRing, L::FqField) end end -function defining_polynomial(L::FqField) - if !isdefined(L, :defining_poly) - @assert L.isstandard - F, = polynomial_ring(prime_field(L), "x", cached = false) - L.defining_poly = F(map(lift, collect(coefficients(modulus(L))))) +function defining_polynomial(K::FqField) + if !isdefined(K, :defining_poly) + @assert K.isstandard + F, = polynomial_ring(prime_field(K), "x", cached = false) + K.defining_poly = F(map(lift, collect(coefficients(modulus(K))))) end - return L.defining_poly::FqPolyRingElem + return K.defining_poly::FqPolyRingElem end ################################################################################ @@ -109,15 +125,31 @@ end ################################################################################ @doc raw""" - degree(a::FqField) + degree(K::FqField) -> Int Return the degree of the given finite field over the base field. + +# Examples + +```jldoctest +julia> K, a = finite_field(3, 2, "a"); + +julia> degree(K) +2 + +julia> Kx, x = K["x"]; + +julia> L, b = finite_field(x^3 + x^2 + x + 2, "b"); + +julia> degree(L) +3 +``` """ -function degree(a::FqField) - if is_absolute(a) - return _degree(a) +function degree(K::FqField) + if is_absolute(K) + return _degree(K) else - return degree(defining_polynomial(a)) + return degree(defining_polynomial(K)) end end @@ -197,10 +229,27 @@ end ################################################################################ @doc raw""" - coeff(x::FqFieldElem, n::Int) + coeff(x::FqFieldElem, n::Int) -> FqFieldElem + +Given an element $x$ of a finite field $K$, return the degree $n$ +coefficient (as an element of the base field) of $x$ when expressed +in the power basis of $K$. + +# Examples + +```jldoctest +julia> K, a = finite_field(9, "a"); + +julia> x = 2 * a + 1 +2*a + 1 -Return the degree $n$ coefficient (as an element of the base field) of the -polynomial representing the given finite field element. +julia> coeff(x, 1) +2 + +julia> x == sum([coeff(x, i - 1) * basis(K)[i] for i in 1:degree(K)]) == + sum([coeff(x, i) * a^i for i in 0:degree(K) - 1]) +true +``` """ function coeff(x::FqFieldElem, n::Int) if is_absolute(parent(x)) @@ -632,53 +681,6 @@ end # ################################################################################ -function NGFiniteField(a::IntegerUnion, s::VarName = :o; cached::Bool = true, check::Bool = true) - fl, e, p = is_prime_power_with_data(a) - !fl && error("Order must be a prime power") - return NGFiniteField(p, e, s; cached = cached, check = false) -end - -function NGFiniteField(f::FqPolyRingElem, s::VarName = :o; cached::Bool = true, check::Bool = true, absolute::Bool = false) - (check && !is_irreducible(f)) && error("Defining polynomial must be irreducible") - # Should probably have its own cache - F = FqField(f, Symbol(s), cached, absolute) - return F, gen(F) -end - -@doc raw""" - _FiniteField(q::IntegerUnion, s::String; cached::Bool, check::Bool) - _FiniteField(p::IntegerUnion, d::Int, s::String; cached::Bool, check::Bool) - _FiniteField(f::FqPolyRingElem; s::String; cached::Bool, check::Bool) - -Return a tuple $S, x$ consisting of a finite field $S$ of order $q = p^d$ and -algebra generator $x$. The string $s$ is used to designate how the finite field -generator will be printed. - -If a polynomial $f \in k[t]$ over a finite field $k$ is specified, the finite field -$S = k[t]/(f)$ will be constructed as a finite field with base field $k$. -""" -_FiniteField(a...; kw...) = NGFiniteField(a...; kw...) - -@doc raw""" - _GF(q::IntegerUnion, s::String; cached::Bool, check::Bool) - _GF(p::IntegerUnion, d::Int, s::String; cached::Bool, check::Bool) - _GF(f::FqPolyRingElem; s::String; cached::Bool, check::Bool) - -Return a finite field $S$ of order $q = p^d$. -The string $s$ is used to designate how the finite field -generator will be printed. - -If a polynomial $f \in k[t]$ over a finite field $k$ is specified, the finite field -$S = k[t]/(f)$ will be constructed as a finite field with base field $k$. -""" -function _GF(a::IntegerUnion, s::VarName = :o; cached::Bool = true, check::Bool = true) - return NGFiniteField(a, s; cached = cached, check = check)[1] -end - -function _GF(a::IntegerUnion, b::Int, s::VarName = :o; cached::Bool = true, check::Bool = true) - return NGFiniteField(a, b, s; cached = cached, check = check)[1] -end - ################################################################################ # # Fancy coercion diff --git a/src/flint/fq_embed.jl b/src/flint/fq_embed.jl index 3d50e06fd2..0b1c4eeb06 100644 --- a/src/flint/fq_embed.jl +++ b/src/flint/fq_embed.jl @@ -28,7 +28,7 @@ function embed_gens(k::FqPolyRepField, K::FqPolyRepField) a = k() b = K() p = ZZRingElem(characteristic(k))::ZZRingElem - R = GF(p) + R = Native.GF(p) PR = polynomial_ring(R, "T")[1] P = PR() diff --git a/src/flint/fq_nmod.jl b/src/flint/fq_nmod.jl index 89b05056bb..0ddbce111d 100644 --- a/src/flint/fq_nmod.jl +++ b/src/flint/fq_nmod.jl @@ -579,7 +579,7 @@ Return the modulus defining the finite field $k$. """ function modulus(k::fqPolyRepField, var::VarName=:T) p::Int = characteristic(k) - Q = polynomial(GF(p), [], var) + Q = polynomial(Native.GF(p), [], var) GC.@preserve k begin P = ccall((:fq_nmod_ctx_modulus, libflint), Ptr{fpPolyRingElem}, (Ref{fqPolyRepField},), k) @@ -686,24 +686,24 @@ function fqPolyRepFieldElem(a::fqPolyRepField, b::Vector{UInt}) r.length = norm return r end - - -############################################################################### # -# FlintFiniteField constructor # -############################################################################### - -function FlintFiniteField(char::Int, deg::Int, s::VarName = :o; cached = true) - parent_obj = fqPolyRepField(ZZRingElem(char), deg, Symbol(s), cached) - return parent_obj, gen(parent_obj) -end - -function FlintFiniteField(pol::Zmodn_poly, s::VarName = :o; cached = true, check::Bool=true) - parent_obj = fqPolyRepField(pol, Symbol(s), cached, check=check) - return parent_obj, gen(parent_obj) -end - -function FlintFiniteField(F::fqPolyRepField, deg::Int, s::VarName = :o; cached = true) - return fqPolyRepField(characteristic(F), deg, Symbol(s), cached) -end +################################################################################ +## +## FlintFiniteField constructor +## +################################################################################ +# +#function FlintFiniteField(char::Int, deg::Int, s::VarName = :o; cached = true) +# parent_obj = fqPolyRepField(ZZRingElem(char), deg, Symbol(s), cached) +# return parent_obj, gen(parent_obj) +#end +# +#function FlintFiniteField(pol::Zmodn_poly, s::VarName = :o; cached = true, check::Bool=true) +# parent_obj = fqPolyRepField(pol, Symbol(s), cached, check=check) +# return parent_obj, gen(parent_obj) +#end +# +#function FlintFiniteField(F::fqPolyRepField, deg::Int, s::VarName = :o; cached = true) +# return fqPolyRepField(characteristic(F), deg, Symbol(s), cached) +#end diff --git a/src/flint/fq_nmod_embed.jl b/src/flint/fq_nmod_embed.jl index 7ab0bc11fe..3488974860 100644 --- a/src/flint/fq_nmod_embed.jl +++ b/src/flint/fq_nmod_embed.jl @@ -27,7 +27,7 @@ function embed_gens(k::fqPolyRepField, K::fqPolyRepField) a = k() b = K() p::Int = characteristic(k) - R = GF(p) + R = Native.GF(p) PR = polynomial_ring(R, "T")[1] P = PR() diff --git a/src/flint/gfp_elem.jl b/src/flint/gfp_elem.jl index 0c3e523b4b..a11c236746 100644 --- a/src/flint/gfp_elem.jl +++ b/src/flint/gfp_elem.jl @@ -470,21 +470,21 @@ function (R::fpField)(a::Vector{<:IntegerUnion}) return R(a[1]) end -############################################################################### -# -# GF constructor -# -############################################################################### - -function GF(n::Int; cached::Bool=true) - (n <= 0) && throw(DomainError(n, "Characteristic must be positive")) - un = UInt(n) - !is_prime(un) && throw(DomainError(n, "Characteristic must be prime")) - return fpField(un, cached) -end - -function GF(n::UInt; cached::Bool=true) - un = UInt(n) - !is_prime(un) && throw(DomainError(n, "Characteristic must be prime")) - return fpField(un, cached) -end +# ############################################################################### +# # +# # GF constructor +# # +# ############################################################################### +# +# function GF(n::Int; cached::Bool=true) +# (n <= 0) && throw(DomainError(n, "Characteristic must be positive")) +# un = UInt(n) +# !is_prime(un) && throw(DomainError(n, "Characteristic must be prime")) +# return fpField(un, cached) +# end +# +# function GF(n::UInt; cached::Bool=true) +# un = UInt(n) +# !is_prime(un) && throw(DomainError(n, "Characteristic must be prime")) +# return fpField(un, cached) +# end diff --git a/src/flint/gfp_fmpz_elem.jl b/src/flint/gfp_fmpz_elem.jl index 5cf8cc541a..0934a0914c 100644 --- a/src/flint/gfp_fmpz_elem.jl +++ b/src/flint/gfp_fmpz_elem.jl @@ -457,14 +457,16 @@ function (R::FpField)(a::Vector{<:IntegerUnion}) return R(a[1]) end -############################################################################### -# -# GF constructor -# -############################################################################### - -function GF(n::ZZRingElem; cached::Bool=true) - (n <= 0) && throw(DomainError(n, "Characteristic must be positive")) - !is_probable_prime(n) && throw(DomainError(n, "Characteristic must be prime")) - return FpField(n, cached) -end +# ############################################################################### +# # +# # GF constructor +# # +# ############################################################################### +# +# function GF(n::ZZRingElem; cached::Bool=true) +# (n <= 0) && throw(DomainError(n, "Characteristic must be positive")) +# !is_probable_prime(n) && throw(DomainError(n, "Characteristic must be prime")) +# return FpField(n, cached) +# end +# ======= +# >>>>>>> 5e2de985 (Make FqField the default finite field) diff --git a/test/Benchmark-test.jl b/test/Benchmark-test.jl index 04cac3a419..9a274c5e4e 100644 --- a/test/Benchmark-test.jl +++ b/test/Benchmark-test.jl @@ -27,7 +27,7 @@ end end @testset "Benchmark.resultant" begin - R, x = FlintFiniteField(7, 11, "x") + R, x = Native.finite_field(7, 11, "x") S, y = polynomial_ring(R, "y") T = residue_ring(S, y^3 + 3x*y + 1) U, z = polynomial_ring(T, "z") diff --git a/test/flint/fq-test.jl b/test/flint/fq-test.jl index 17ab001b3b..8b601cbee8 100644 --- a/test/flint/fq-test.jl +++ b/test/flint/fq-test.jl @@ -3,35 +3,35 @@ function test_elem(R::FqPolyRepField) end @testset "FqPolyRepFieldElem.conformance_tests" begin - test_Field_interface_recursive(finite_field(ZZRingElem(7), 5, "z")[1]) + test_Field_interface_recursive(Native.finite_field(ZZRingElem(7), 5, "z")[1]) Sy, y = polynomial_ring(residue_ring(FlintZZ, 36893488147419103363), "y") - T, z = finite_field(y^2 + 1, "z") + T, z = Native.finite_field(y^2 + 1, "z") test_Field_interface_recursive(T) - Syy, yy = polynomial_ring(GF(ZZRingElem(36893488147419103363)), "y") - T2, z2 = finite_field(yy^2 + 1, "z") + Syy, yy = polynomial_ring(Native.GF(ZZRingElem(36893488147419103363)), "y") + T2, z2 = Native.finite_field(yy^2 + 1, "z") test_Field_interface_recursive(T2) end @testset "FqPolyRepFieldElem.constructors" begin - R, x = finite_field(ZZRingElem(7), 5, "x") + R, x = Native.finite_field(ZZRingElem(7), 5, "x") @test elem_type(R) == FqPolyRepFieldElem @test elem_type(FqPolyRepField) == FqPolyRepFieldElem @test parent_type(FqPolyRepFieldElem) == FqPolyRepField Sy, y = polynomial_ring(residue_ring(FlintZZ, 36893488147419103363), "y") - Syy, yy = polynomial_ring(GF(ZZRingElem(36893488147419103363)), "y") + Syy, yy = polynomial_ring(Native.GF(ZZRingElem(36893488147419103363)), "y") - T, z = finite_field(y^2 + 1, "z") - T2, z2 = finite_field(yy^2 + 1, "z") + T, z = Native.finite_field(y^2 + 1, "z") + T2, z2 = Native.finite_field(yy^2 + 1, "z") # check that one can leave out the name for the generator, or specify it as a symbol - @test finite_field(ZZRingElem(7), 5)[1] isa FqPolyRepField - @test finite_field(ZZRingElem(7), 5, :x)[1] isa FqPolyRepField - @test finite_field(y^2 + 1)[1] isa FqPolyRepField - @test finite_field(y^2 + 1, :x)[1] isa FqPolyRepField + @test Native.finite_field(ZZRingElem(7), 5)[1] isa FqPolyRepField + @test Native.finite_field(ZZRingElem(7), 5, :x)[1] isa FqPolyRepField + @test Native.finite_field(y^2 + 1)[1] isa FqPolyRepField + @test Native.finite_field(y^2 + 1, :x)[1] isa FqPolyRepField @test isa(R, FqPolyRepField) @test isa(T, FqPolyRepField) @@ -62,15 +62,15 @@ end @test isa(d, FqPolyRepFieldElem) # check for primality - T3, z3 = finite_field(yy^2 + 1, "z", check=false) + T3, z3 = Native.finite_field(yy^2 + 1, "z", check=false) @test isa(T2, FqPolyRepField) Syyy, yyy = polynomial_ring(residue_ring(FlintZZ, ZZ(4)), "y") @test yyy isa ZZModPolyRingElem - @test_throws DomainError finite_field(yyy^2+1, "z") + @test_throws DomainError Native.finite_field(yyy^2+1, "z") end @testset "FqPolyRepFieldElem.printing" begin - R, x = finite_field(ZZRingElem(7), 5, "x") + R, x = Native.finite_field(ZZRingElem(7), 5, "x") a = 3x^4 + 2x^3 + 4x^2 + x + 1 @@ -78,7 +78,7 @@ end end @testset "FqPolyRepFieldElem.manipulation" begin - R, x = finite_field(ZZRingElem(7), 5, "x") + R, x = Native.finite_field(ZZRingElem(7), 5, "x") @test iszero(zero(R)) @@ -103,12 +103,12 @@ end @test isa(modulus(R), FpPolyRingElem) #@test defining_polynomial(R) isa FpPolyRingElem - #kt, t = GF(ZZ(7))["t"] + #kt, t = Native.GF(ZZ(7))["t"] #@test parent(defining_polynomial(kt, R)) === kt end @testset "FqPolyRepFieldElem.unary_ops" begin - R, x = finite_field(ZZRingElem(7), 5, "x") + R, x = Native.finite_field(ZZRingElem(7), 5, "x") a = x^4 + 3x^2 + 6x + 1 @@ -116,7 +116,7 @@ end end @testset "FqPolyRepFieldElem.binary_ops" begin - R, x = finite_field(ZZRingElem(7), 5, "x") + R, x = Native.finite_field(ZZRingElem(7), 5, "x") a = x^4 + 3x^2 + 6x + 1 b = 3x^4 + 2x^2 + x + 1 @@ -129,7 +129,7 @@ end end @testset "FqPolyRepFieldElem.adhoc_binary" begin - R, x = finite_field(ZZRingElem(7), 5, "x") + R, x = Native.finite_field(ZZRingElem(7), 5, "x") a = x^4 + 3x^2 + 6x + 1 @@ -147,7 +147,7 @@ end end @testset "FqPolyRepFieldElem.powering" begin - R, x = finite_field(ZZRingElem(7), 5, "x") + R, x = Native.finite_field(ZZRingElem(7), 5, "x") a = x^4 + 3x^2 + 6x + 1 @@ -157,7 +157,7 @@ end end @testset "FqPolyRepFieldElem.comparison" begin - R, x = finite_field(ZZRingElem(7), 5, "x") + R, x = Native.finite_field(ZZRingElem(7), 5, "x") a = x^4 + 3x^2 + 6x + 1 b = 3x^4 + 2x^2 + 2 @@ -168,7 +168,7 @@ end end @testset "FqPolyRepFieldElem.inversion" begin - R, x = finite_field(ZZRingElem(7), 5, "x") + R, x = Native.finite_field(ZZRingElem(7), 5, "x") a = x^4 + 3x^2 + 6x + 1 @@ -180,7 +180,7 @@ end end @testset "FqPolyRepFieldElem.exact_division" begin - R, x = finite_field(ZZRingElem(7), 5, "x") + R, x = Native.finite_field(ZZRingElem(7), 5, "x") a = x^4 + 3x^2 + 6x + 1 b = 3x^4 + 2x^2 + 2 @@ -191,7 +191,7 @@ end end @testset "FqPolyRepFieldElem.gcd" begin - R, x = finite_field(ZZRingElem(7), 5, "x") + R, x = Native.finite_field(ZZRingElem(7), 5, "x") a = x^4 + 3x^2 + 6x + 1 b = 3x^4 + 2x^2 + x + 1 @@ -202,7 +202,7 @@ end end @testset "FqPolyRepFieldElem.special_functions" begin - R, x = finite_field(ZZRingElem(7), 5, "x") + R, x = Native.finite_field(ZZRingElem(7), 5, "x") a = x^4 + 3x^2 + 6x + 1 @@ -232,34 +232,34 @@ end end @testset "FqPolyRepFieldElem.rand" begin - R, x = finite_field(ZZRingElem(17), 3, "x") + R, x = Native.finite_field(ZZRingElem(17), 3, "x") test_rand(R) end @testset "FqPolyRepFieldElem.iteration" begin for n = [2, 3, 5, 13, 31] - R, _ = finite_field(ZZRingElem(n), 1, "x") + R, _ = Native.finite_field(ZZRingElem(n), 1, "x") elts = Nemo.AbstractAlgebra.test_iterate(R) @test elts == R.(0:n-1) - R, _ = finite_field(ZZRingElem(n), rand(2:9), "x") + R, _ = Native.finite_field(ZZRingElem(n), rand(2:9), "x") Nemo.AbstractAlgebra.test_iterate(R) end end @testset "FqPolyRepFieldElem.lift" begin - R, x = finite_field(ZZ(23), 2, "x") + R, x = Native.finite_field(ZZ(23), 2, "x") f = 8x + 9 - S, y = polynomial_ring(GF(ZZ(23)), "y") + S, y = polynomial_ring(Native.GF(ZZ(23)), "y") @test lift(S, f) == 8y + 9 end @testset "FqPolyRepField.overload" begin - R, x = finite_field(ZZ(19), 3, "x") + R, x = Native.finite_field(ZZ(19), 3, "x") @test R([1, 0, 1]) == x^2 + 1 end @testset "Nemo.jl#1493" begin - @test_throws DomainError GF(ZZ(4), 2) - @test_throws DomainError finite_field(ZZ(6), 2, "x") + @test_throws DomainError Native.GF(ZZ(4), 2) + @test_throws DomainError Native.finite_field(ZZ(6), 2, "x") end diff --git a/test/flint/fq_abs_series-test.jl b/test/flint/fq_abs_series-test.jl index fbd61e4c50..e6622b1e0d 100644 --- a/test/flint/fq_abs_series-test.jl +++ b/test/flint/fq_abs_series-test.jl @@ -3,7 +3,7 @@ end @testset "FqPolyRepAbsPowerSeriesRingElem.constructors" begin - S, t = finite_field(ZZRingElem(23), 5, "t") + S, t = Native.finite_field(ZZRingElem(23), 5, "t") R1 = AbsPowerSeriesRing(S, 30) R2 = AbsPowerSeriesRing(S, 30) @@ -36,7 +36,7 @@ end end @testset "FqPolyRepAbsPowerSeriesRingElem.printing" begin - S, t = finite_field(ZZRingElem(23), 5, "t") + S, t = Native.finite_field(ZZRingElem(23), 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) b = x^2 + 3x + O(x^4) @@ -45,7 +45,7 @@ end end @testset "FqPolyRepAbsPowerSeriesRingElem.manipulation" begin - S, t = finite_field(ZZRingElem(23), 5, "t") + S, t = Native.finite_field(ZZRingElem(23), 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -67,7 +67,7 @@ end end @testset "FqPolyRepAbsPowerSeriesRingElem.similar" begin - R0, a = finite_field(ZZ(23), 2, "a") + R0, a = Native.finite_field(ZZ(23), 2, "a") R, x = power_series_ring(R0, 10, "x"; model=:capped_absolute) S, y = power_series_ring(ZZ, 10, "y"; model=:capped_absolute) @@ -115,7 +115,7 @@ end end @testset "FqPolyRepAbsPowerSeriesRingElem.abs_series" begin - R, a = finite_field(ZZ(23), 2, "a") + R, a = Native.finite_field(ZZ(23), 2, "a") f = abs_series(R, [1, 2, 3], 3, 5, "y") @test isa(f, FqPolyRepAbsPowerSeriesRingElem) @@ -158,7 +158,7 @@ end end @testset "FqPolyRepAbsPowerSeriesRingElem.unary_ops" begin - S, t = finite_field(ZZRingElem(23), 5, "t") + S, t = Native.finite_field(ZZRingElem(23), 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -170,7 +170,7 @@ end end @testset "FqPolyRepAbsPowerSeriesRingElem.binary_ops" begin - S, t = finite_field(ZZRingElem(23), 5, "t") + S, t = Native.finite_field(ZZRingElem(23), 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -190,7 +190,7 @@ end end @testset "FqPolyRepAbsPowerSeriesRingElem.adhoc_binary_ops" begin - S, t = finite_field(ZZRingElem(23), 5, "t") + S, t = Native.finite_field(ZZRingElem(23), 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -208,7 +208,7 @@ end end @testset "FqPolyRepAbsPowerSeriesRingElem.comparison" begin - S, t = finite_field(ZZRingElem(23), 5, "t") + S, t = Native.finite_field(ZZRingElem(23), 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -224,7 +224,7 @@ end end @testset "FqPolyRepAbsPowerSeriesRingElem.adhoc_comparison" begin - S, t = finite_field(ZZRingElem(23), 5, "t") + S, t = Native.finite_field(ZZRingElem(23), 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -244,7 +244,7 @@ end end @testset "FqPolyRepAbsPowerSeriesRingElem.powering" begin - S, t = finite_field(ZZRingElem(23), 5, "t") + S, t = Native.finite_field(ZZRingElem(23), 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -264,7 +264,7 @@ end end @testset "FqPolyRepAbsPowerSeriesRingElem.shift" begin - S, t = finite_field(ZZRingElem(23), 5, "t") + S, t = Native.finite_field(ZZRingElem(23), 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -286,7 +286,7 @@ end end @testset "FqPolyRepAbsPowerSeriesRingElem.truncation" begin - S, t = finite_field(ZZRingElem(23), 5, "t") + S, t = Native.finite_field(ZZRingElem(23), 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -306,7 +306,7 @@ end end @testset "FqPolyRepAbsPowerSeriesRingElem.exact_division" begin - S, t = finite_field(ZZRingElem(23), 5, "t") + S, t = Native.finite_field(ZZRingElem(23), 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = x + x^3 @@ -324,7 +324,7 @@ end end @testset "FqPolyRepAbsPowerSeriesRingElem.adhoc_exact_division" begin - S, t = finite_field(ZZRingElem(23), 5, "t") + S, t = Native.finite_field(ZZRingElem(23), 5, "t") R, x = power_series_ring(ZZ, 30, "x", model=:capped_absolute) a = x + x^3 @@ -344,7 +344,7 @@ end end @testset "FqPolyRepAbsPowerSeriesRingElem.adhoc_exact_division" begin - S, t = finite_field(ZZRingElem(23), 5, "t") + S, t = Native.finite_field(ZZRingElem(23), 5, "t") R, x = power_series_ring(ZZ, 30, "x", model=:capped_absolute) a = x + x^3 @@ -364,7 +364,7 @@ end end @testset "FqPolyRepAbsPowerSeriesRingElem.inversion" begin - S, t = finite_field(ZZRingElem(23), 5, "t") + S, t = Native.finite_field(ZZRingElem(23), 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 1 + x + 2x^2 + O(x^5) @@ -376,7 +376,7 @@ end end @testset "FqPolyRepAbsPowerSeriesRingElem.square_root" begin - S, t = finite_field(ZZRingElem(31), 5, "t") + S, t = Native.finite_field(ZZRingElem(31), 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) for iter = 1:300 @@ -386,7 +386,7 @@ end end for p in [2, 7, 19, 65537] - R, t = finite_field(ZZRingElem(p), 2, "t") + R, t = Native.finite_field(ZZRingElem(p), 2, "t") S, x = power_series_ring(R, 10, "x", model=:capped_absolute) for iter = 1:10 @@ -416,7 +416,7 @@ end end @testset "FqPolyRepAbsPowerSeriesRingElem.unsafe_operators" begin - S, t = finite_field(ZZRingElem(23), 5, "t") + S, t = Native.finite_field(ZZRingElem(23), 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) for iter = 1:300 diff --git a/test/flint/fq_default-test.jl b/test/flint/fq_default-test.jl index cc948eeef2..e1f4b3083d 100644 --- a/test/flint/fq_default-test.jl +++ b/test/flint/fq_default-test.jl @@ -1,14 +1,14 @@ @testset "FqFieldElem.constructors" begin - R, x = NGFiniteField(ZZRingElem(7), 5, "x") + R, x = finite_field(ZZRingElem(7), 5, "x") @test elem_type(R) == FqFieldElem @test elem_type(FqField) == FqFieldElem @test parent_type(FqFieldElem) == FqField Sy, y = polynomial_ring(residue_ring(FlintZZ, 36893488147419103363), "y") - Syy, yy = polynomial_ring(GF(ZZRingElem(36893488147419103363)), "y") + Syy, yy = polynomial_ring(Native.GF(ZZRingElem(36893488147419103363)), "y") St, t = polynomial_ring(residue_ring(FlintZZ, 23), "t") - Stt, tt = polynomial_ring(GF(23), "y") + Stt, tt = polynomial_ring(Native.GF(23), "y") T = FqField(y^2 + 1, :z) z = gen(T) @@ -61,7 +61,7 @@ end @testset "FqFieldElem.printing" begin - R, x = NGFiniteField(ZZRingElem(7), 5, "x") + R, x = finite_field(ZZRingElem(7), 5, "x") a = 3x^4 + 2x^3 + 4x^2 + x + 1 @@ -69,7 +69,7 @@ end end @testset "FqFieldElem.manipulation" begin - R, x = NGFiniteField(ZZRingElem(7), 5, "x") + R, x = finite_field(ZZRingElem(7), 5, "x") @test iszero(zero(R)) @@ -93,7 +93,7 @@ end end @testset "FqFieldElem.conversions" begin - U, a = NGFiniteField(ZZRingElem(7), 5, "a") + U, a = finite_field(ZZRingElem(7), 5, "a") for T in [Int, Int128, BigInt, ZZRingElem] @test isone(U(T(1))) @@ -107,7 +107,7 @@ end f = 3a^4 + 2a^3 + a + 5 - for R in [residue_ring(FlintZZ, 7), residue_ring(FlintZZ, ZZ(7)), GF(7), GF(ZZ(7))] + for R in [residue_ring(FlintZZ, 7), residue_ring(FlintZZ, ZZ(7)), Native.GF(7), Native.GF(ZZ(7))] S, y = polynomial_ring(R, "y") @test f == U(S(f)) @@ -117,29 +117,29 @@ end @test f == U(lift(S, f)) - U, a = NGFiniteField(ZZ(7), 5, "a") + U, a = finite_field(ZZ(7), 5, "a") f = 3a^4 + 2a^3 + a + 5 - S, y = Nemo._GF(7)["y"] + S, y = Nemo.GF(7)["y"] @test f == U(3y^4 + 2y^3 + y + 5) S, y = base_field(U)["y"] @test lift(S, f) == 3y^4 + 2y^3 + y + 5 - S, y = Nemo._GF(5)["y"] + S, y = Nemo.GF(5)["y"] @test_throws ErrorException U(y) - U, a = NGFiniteField(ZZ(1180591620717411303449), 5, "a") + U, a = finite_field(ZZ(1180591620717411303449), 5, "a") f = 3a^4 + 2a^3 + a + 5 - S, y = Nemo._GF(ZZ(1180591620717411303449))["y"] + S, y = Nemo.GF(ZZ(1180591620717411303449))["y"] @test f == U(3y^4 + 2y^3 + y + 5) S, y = base_field(U)["y"] @test lift(S, f) == 3y^4 + 2y^3 + y + 5 - S, y = Nemo._GF(5)["y"] + S, y = Nemo.GF(5)["y"] @test_throws ErrorException U(y) end @testset "FqFieldElem.unary_ops" begin - R, x = NGFiniteField(ZZRingElem(7), 5, "x") + R, x = finite_field(ZZRingElem(7), 5, "x") a = x^4 + 3x^2 + 6x + 1 @@ -147,7 +147,7 @@ end end @testset "FqFieldElem.binary_ops" begin - R, x = NGFiniteField(ZZRingElem(7), 5, "x") + R, x = finite_field(ZZRingElem(7), 5, "x") a = x^4 + 3x^2 + 6x + 1 b = 3x^4 + 2x^2 + x + 1 @@ -160,7 +160,7 @@ end end @testset "FqFieldElem.adhoc_binary" begin - R, x = NGFiniteField(ZZRingElem(7), 5, "x") + R, x = finite_field(ZZRingElem(7), 5, "x") a = x^4 + 3x^2 + 6x + 1 @@ -178,7 +178,7 @@ end end @testset "FqFieldElem.powering" begin - R, x = NGFiniteField(ZZRingElem(7), 5, "x") + R, x = finite_field(ZZRingElem(7), 5, "x") a = x^4 + 3x^2 + 6x + 1 @@ -188,7 +188,7 @@ end end @testset "FqFieldElem.comparison" begin - R, x = NGFiniteField(ZZRingElem(7), 5, "x") + R, x = finite_field(ZZRingElem(7), 5, "x") a = x^4 + 3x^2 + 6x + 1 b = 3x^4 + 2x^2 + 2 @@ -199,7 +199,7 @@ end end @testset "FqFieldElem.inversion" begin - R, x = NGFiniteField(ZZRingElem(7), 5, "x") + R, x = finite_field(ZZRingElem(7), 5, "x") a = x^4 + 3x^2 + 6x + 1 @@ -211,7 +211,7 @@ end end @testset "FqFieldElem.exact_division" begin - R, x = NGFiniteField(ZZRingElem(7), 5, "x") + R, x = finite_field(ZZRingElem(7), 5, "x") a = x^4 + 3x^2 + 6x + 1 b = 3x^4 + 2x^2 + 2 @@ -222,7 +222,7 @@ end end @testset "FqFieldElem.gcd" begin - R, x = NGFiniteField(ZZRingElem(7), 5, "x") + R, x = finite_field(ZZRingElem(7), 5, "x") a = x^4 + 3x^2 + 6x + 1 b = 3x^4 + 2x^2 + x + 1 @@ -233,7 +233,7 @@ end end @testset "FqFieldElem.special_functions" begin - R, x = NGFiniteField(ZZRingElem(7), 5, "x") + R, x = finite_field(ZZRingElem(7), 5, "x") a = x^4 + 3x^2 + 6x + 1 @@ -263,26 +263,26 @@ end end @testset "FqFieldElem.rand" begin - R, x = NGFiniteField(ZZRingElem(17), 3, "x") + R, x = finite_field(ZZRingElem(17), 3, "x") test_rand(R) end @testset "FqFieldElem.iteration" begin for n = [2, 3, 5, 13, 31] - R, _ = NGFiniteField(ZZRingElem(n), 1, "x") + R, _ = finite_field(ZZRingElem(n), 1, "x") elts = Nemo.AbstractAlgebra.test_iterate(R) @test elts == R.(0:n-1) - R, _ = NGFiniteField(ZZRingElem(n), rand(2:9), "x") + R, _ = finite_field(ZZRingElem(n), rand(2:9), "x") Nemo.AbstractAlgebra.test_iterate(R) end end @testset "conversions" begin - F1, = NGFiniteField(7, 1) - F2, = NGFiniteField(ZZ(18446744073709551629), 1) - F3, = NGFiniteField(7, 10) # avoid zech - F4, = NGFiniteField(ZZ(18446744073709551629), 4) + F1, = finite_field(7, 1) + F2, = finite_field(ZZ(18446744073709551629), 1) + F3, = finite_field(7, 10) # avoid zech + F4, = finite_field(ZZ(18446744073709551629), 4) fields = [F1, F2, F3, F4] types = [Nemo.fpField, Nemo.FpField, fqPolyRepField, FqPolyRepField] for (F, T) in zip(fields, types) @@ -312,8 +312,8 @@ end @test_throws AssertionError Nemo.canonical_raw_type(Nemo.FpField, F1) - F1, = NGFiniteField(7, 1) - F1w, = NGFiniteField(2, 1) + F1, = finite_field(7, 1) + F1w, = finite_field(2, 1) f = Nemo.canonical_raw_type(Nemo.fpField, F1) @test_throws AssertionError f(rand(F1w)) @test_throws AssertionError f(rand(F2)) diff --git a/test/flint/fq_default_abs_series-test.jl b/test/flint/fq_default_abs_series-test.jl index 037619690f..2b836e30fb 100644 --- a/test/flint/fq_default_abs_series-test.jl +++ b/test/flint/fq_default_abs_series-test.jl @@ -3,7 +3,7 @@ end @testset "FqAbsPowerSeriesRingElem.constructors" begin - S, t = NGFiniteField(ZZRingElem(23), 5, "t") + S, t = finite_field(ZZRingElem(23), 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) @test elem_type(R) == FqAbsPowerSeriesRingElem @@ -29,7 +29,7 @@ end end @testset "FqAbsPowerSeriesRingElem.printing" begin - S, t = NGFiniteField(ZZRingElem(23), 5, "t") + S, t = finite_field(ZZRingElem(23), 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) b = x^2 + 3x + O(x^4) @@ -38,7 +38,7 @@ end end @testset "FqAbsPowerSeriesRingElem.manipulation" begin - S, t = NGFiniteField(ZZRingElem(23), 5, "t") + S, t = finite_field(ZZRingElem(23), 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -60,7 +60,7 @@ end end @testset "FqAbsPowerSeriesRingElem.similar" begin - R0, a = NGFiniteField(23, 2, "a") + R0, a = finite_field(23, 2, "a") R, x = power_series_ring(R0, 10, "x"; model=:capped_absolute) S, y = power_series_ring(ZZ, 10, "y"; model=:capped_absolute) @@ -108,7 +108,7 @@ end end @testset "FqAbsPowerSeriesRingElem.abs_series" begin - R, a = NGFiniteField(23, 2, "a") + R, a = finite_field(23, 2, "a") f = abs_series(R, [1, 2, 3], 3, 5, "y") @test isa(f, FqAbsPowerSeriesRingElem) @@ -151,7 +151,7 @@ end end @testset "FqAbsPowerSeriesRingElem.unary_ops" begin - S, t = NGFiniteField(ZZRingElem(23), 5, "t") + S, t = finite_field(ZZRingElem(23), 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -163,7 +163,7 @@ end end @testset "FqAbsPowerSeriesRingElem.binary_ops" begin - S, t = NGFiniteField(ZZRingElem(23), 5, "t") + S, t = finite_field(ZZRingElem(23), 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -183,7 +183,7 @@ end end @testset "FqAbsPowerSeriesRingElem.adhoc_binary_ops" begin - S, t = NGFiniteField(ZZRingElem(23), 5, "t") + S, t = finite_field(ZZRingElem(23), 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -201,7 +201,7 @@ end end @testset "FqAbsPowerSeriesRingElem.comparison" begin - S, t = NGFiniteField(ZZRingElem(23), 5, "t") + S, t = finite_field(ZZRingElem(23), 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -217,7 +217,7 @@ end end @testset "FqAbsPowerSeriesRingElem.adhoc_comparison" begin - S, t = NGFiniteField(ZZRingElem(23), 5, "t") + S, t = finite_field(ZZRingElem(23), 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -237,7 +237,7 @@ end end @testset "FqAbsPowerSeriesRingElem.powering" begin - S, t = NGFiniteField(ZZRingElem(23), 5, "t") + S, t = finite_field(ZZRingElem(23), 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -257,7 +257,7 @@ end end @testset "FqAbsPowerSeriesRingElem.shift" begin - S, t = NGFiniteField(ZZRingElem(23), 5, "t") + S, t = finite_field(ZZRingElem(23), 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -279,7 +279,7 @@ end end @testset "FqAbsPowerSeriesRingElem.truncation" begin - S, t = NGFiniteField(ZZRingElem(23), 5, "t") + S, t = finite_field(ZZRingElem(23), 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -299,7 +299,7 @@ end end @testset "FqAbsPowerSeriesRingElem.exact_division" begin - S, t = NGFiniteField(ZZRingElem(23), 5, "t") + S, t = finite_field(ZZRingElem(23), 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = x + x^3 @@ -317,7 +317,7 @@ end end @testset "FqAbsPowerSeriesRingElem.adhoc_exact_division" begin - S, t = NGFiniteField(ZZRingElem(23), 5, "t") + S, t = finite_field(ZZRingElem(23), 5, "t") R, x = power_series_ring(ZZ, 30, "x", model=:capped_absolute) a = x + x^3 @@ -337,7 +337,7 @@ end end @testset "FqAbsPowerSeriesRingElem.inversion" begin - S, t = NGFiniteField(ZZRingElem(23), 5, "t") + S, t = finite_field(ZZRingElem(23), 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 1 + x + 2x^2 + O(x^5) @@ -349,7 +349,7 @@ end end @testset "FqAbsPowerSeriesRingElem.square_root" begin - S, t = NGFiniteField(ZZRingElem(31), 5, "t") + S, t = finite_field(ZZRingElem(31), 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) for iter = 1:300 @@ -359,7 +359,7 @@ end end for p in [2, 7, 19, 65537] - R, t = NGFiniteField(ZZRingElem(p), 2, "t") + R, t = finite_field(ZZRingElem(p), 2, "t") S, x = power_series_ring(R, 10, "x", model=:capped_absolute) for iter = 1:10 @@ -389,7 +389,7 @@ end end @testset "FqAbsPowerSeriesRingElem.unsafe_operators" begin - S, t = NGFiniteField(ZZRingElem(23), 5, "t") + S, t = finite_field(ZZRingElem(23), 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) for iter = 1:300 diff --git a/test/flint/fq_default_embed-test.jl b/test/flint/fq_default_embed-test.jl index 5399f8829c..9c424df3a2 100644 --- a/test/flint/fq_default_embed-test.jl +++ b/test/flint/fq_default_embed-test.jl @@ -3,17 +3,17 @@ for i in 1:10 p = ZZRingElem(next_prime(rand(1:999))) - k1, x1 = NGFiniteField(p, 1, "x1") - k2, x2 = NGFiniteField(p, 2, "x2") - k3, x3 = NGFiniteField(p, 3, "x3") - k4, x4 = NGFiniteField(p, 4, "x4") - k6, x6 = NGFiniteField(p, 6, "x6") - k8, x8 = NGFiniteField(p, 8, "x8") - k9, x9 = NGFiniteField(p, 9, "x9") - k12, x12 = NGFiniteField(p, 12, "x12") - k16, x16 = NGFiniteField(p, 16, "x16") - k18, x18 = NGFiniteField(p, 18, "x18") - k24, x24 = NGFiniteField(p, 24, "x24") + k1, x1 = finite_field(p, 1, "x1") + k2, x2 = finite_field(p, 2, "x2") + k3, x3 = finite_field(p, 3, "x3") + k4, x4 = finite_field(p, 4, "x4") + k6, x6 = finite_field(p, 6, "x6") + k8, x8 = finite_field(p, 8, "x8") + k9, x9 = finite_field(p, 9, "x9") + k12, x12 = finite_field(p, 12, "x12") + k16, x16 = finite_field(p, 16, "x16") + k18, x18 = finite_field(p, 18, "x18") + k24, x24 = finite_field(p, 24, "x24") S = Set([(k4, k12), (k6, k24), @@ -81,8 +81,8 @@ end p = ZZRingElem(next_prime(rand(1:999))) a, b = rand(1:5), rand(1:5) - ka, xa = NGFiniteField(p, a, "xa") - kab, xab = NGFiniteField(p, a*b, "xab") + ka, xa = finite_field(p, a, "xa") + kab, xab = finite_field(p, a*b, "xab") f = preimage_map(ka, kab) g = embed(ka, kab) @@ -107,8 +107,8 @@ end pop!(S, p) p = ZZRingElem(p) - F = NGFiniteField(p, 4, "s")[1] - Z = GF(p) + F = finite_field(p, 4, "s", cached = false)[1] + Z = Native.GF(p) R, x = polynomial_ring(Z, "x") P1 = R(rand(Z, 4)) + x^4 diff --git a/test/flint/fq_default_extended-test.jl b/test/flint/fq_default_extended-test.jl index d942733687..4ab739a615 100644 --- a/test/flint/fq_default_extended-test.jl +++ b/test/flint/fq_default_extended-test.jl @@ -1,12 +1,12 @@ @testset "FqFieldElem.constructors" begin - R, a = NGFiniteField(ZZRingElem(7), 5, "a") + R, a = finite_field(ZZRingElem(7), 5, "a") Rx, x = R["x"] f = x^2 + (2*a^4 + 5*a^3 + 5*a^2 + 3*a + 6)*x + a^4 + a^2 + 5*a + 5 - F, b = NGFiniteField(f, "b") + F, b = finite_field(f, "b") @test defining_polynomial(F) == f @test F(x) == b - @test_throws ErrorException F(Nemo._GF(5)["x"][2]) + @test_throws ErrorException F(GF(5)["x"][2]) ff = defining_polynomial(Rx, F) @test ff == f @@ -25,7 +25,7 @@ Fy, y = F["y"] g = y^3 + 2*y + 1 - FF, c = NGFiniteField(g, "c") + FF, c = finite_field(g, "c") @test defining_polynomial(FF) == g @test FF isa FqField @@ -52,48 +52,48 @@ @test FF(one(R)) == one(FF) # check for irreducibility - @test_throws ErrorException NGFiniteField(x^2-1, "z") + @test_throws ErrorException finite_field(x^2-1, "z") - F, = NGFiniteField(9) + F, = finite_field(9) @test order(F) == 9 - @test NGFiniteField(9)[1] === NGFiniteField(9)[1] - @test NGFiniteField(9)[1] !== NGFiniteField(9, cached = false)[1] - @test_throws ErrorException NGFiniteField(6) - @test Nemo._GF(2, 1) === Nemo._GF(2) - @test Nemo._GF(6, 1, check = false) isa FqField - @test Nemo._FiniteField(2, 1)[1] isa FqField + @test finite_field(9)[1] === finite_field(9)[1] + @test finite_field(9)[1] !== finite_field(9, cached = false)[1] + @test_throws ErrorException finite_field(6) + @test GF(2, 1) === GF(2) + @test GF(6, 1, check = false) isa FqField + @test finite_field(2, 1)[1] isa FqField # check that the check is correct - R, a = NGFiniteField(3, 1, "a") + R, a = finite_field(3, 1, "a") Rx, x = R["x"] f = x^2 + 1 - F, b = NGFiniteField(f, "b") + F, b = finite_field(f, "b") @test F isa FqField # check caching - R, a = NGFiniteField(3, 1, "a") + R, a = finite_field(3, 1, "a") Rx, x = R["x"] f = x^2 + 2x + 2 - F, b = NGFiniteField(f, "b", cached = false) - FF, bb = NGFiniteField(f, "b", cached = false) + F, b = finite_field(f, "b", cached = false) + FF, bb = finite_field(f, "b", cached = false) @test F !== FF - F, b = NGFiniteField(f, "b") - FF, bb = NGFiniteField(f, "b") + F, b = finite_field(f, "b") + FF, bb = finite_field(f, "b") @test F === FF - R, a = NGFiniteField(3, 2, "a") + R, a = finite_field(3, 2, "a") Rx, x = R["x"] f = x^3 + 2x + 1 - F, b = NGFiniteField(f, "b", cached = false) + F, b = finite_field(f, "b", cached = false) @test_throws ErrorException lift(ZZ["x"][1], b) @test F(ZZ["x"][2] + 1) == b + 1 c = 2b^2 + 2b + 1 @test lift(Rx, c) == 2x^2 + 2x + 1 - R, a = NGFiniteField(ZZ(1180591620717411303449), 2, "a") + R, a = finite_field(ZZ(1180591620717411303449), 2, "a") Rx, x = R["x"] f = x^3 + 8*x^2 + 3*x + 5 - F, b = NGFiniteField(f, "b", cached = false) + F, b = finite_field(f, "b", cached = false) @test_throws ErrorException lift(ZZ["x"][1], b) @test F(ZZ["x"][2] + 1) == b + 1 c = 2b^2 + 2b + 1 @@ -101,10 +101,10 @@ end @testset "FqFieldElem.printing" begin - R, a = NGFiniteField(ZZRingElem(7), 5, "a") + R, a = finite_field(ZZRingElem(7), 5, "a") Rx, x = R["x"] f = x^2 + (2*a^4 + 5*a^3 + 5*a^2 + 3*a + 6)*x + a^4 + a^2 + 5*a + 5 - F, b = NGFiniteField(f, "b") + F, b = finite_field(f, "b") c = 2 * b + F(a) @test sprint(show, "text/plain", c) == "2*b + a" @@ -112,10 +112,10 @@ end end @testset "FqFieldElem.manipulation" begin - R, a = NGFiniteField(ZZRingElem(7), 5, "a") + R, a = finite_field(ZZRingElem(7), 5, "a") Rx, x = R["x"] f = x^2 + (2*a^4 + 5*a^3 + 5*a^2 + 3*a + 6)*x + a^4 + a^2 + 5*a + 5 - F, b = NGFiniteField(f, "b") + F, b = finite_field(f, "b") @test iszero(zero(F)) @test isone(one(F)) @@ -146,24 +146,24 @@ end @test basis(R) == [a^i for i in 0:4] @test basis(F) == [b^0, b^1] - RR, aa = NGFiniteField(ZZRingElem(7), 2, "a") + RR, aa = finite_field(ZZRingElem(7), 2, "a") @test iszero(tr(zero(R)) + tr(zero(R))) @test isone(norm(one(R)) * norm(one(R))) @test prime_field(R) === prime_field(RR) end @testset "FqFieldElem.special_functions" begin - R, a = NGFiniteField(ZZRingElem(7), 5, "a") + R, a = finite_field(ZZRingElem(7), 5, "a") @test degree(minpoly(a)) == degree(R) @test degree(defining_polynomial(R)) == degree(R) @test degree(absolute_charpoly(a)) == degree(R) @test !iszero(absolute_norm(a)) - @test_throws ErrorException NGFiniteField(ZZRingElem(11), 2, "a")[1](a) + @test_throws ErrorException finite_field(ZZRingElem(11), 2, "a")[1](a) Rx, x = R["x"] f = x^2 + (2*a^4 + 5*a^3 + 5*a^2 + 3*a + 6)*x + a^4 + a^2 + 5*a + 5 - F, b = NGFiniteField(f, "b") + F, b = finite_field(f, "b") @test (@inferred tr(b)) == 5*a^4 + 2*a^3 + 2*a^2 + 4*a + 1 @test (@inferred tr(tr(b))) == 6 @@ -182,16 +182,16 @@ end end @testset "FqFieldElem.iteration" begin - R, a = NGFiniteField(ZZRingElem(2), 2, "a") + R, a = finite_field(ZZRingElem(2), 2, "a") Rx, x = R["x"] f = x^3 + x + 1 - F, _ = NGFiniteField(f, "b") + F, _ = finite_field(f, "b") AbstractAlgebra.test_iterate(F) @test length(collect(F)) == order(F) end @testset "FqFieldElem._residue_field" begin - R, a = NGFiniteField(ZZRingElem(2), 2, "a") + R, a = finite_field(ZZRingElem(2), 2, "a") Rx, x = R["x"] f = x^3 + x + 1 F, RxtoF = Nemo._residue_field(f) @@ -224,19 +224,19 @@ end @test RxtoF(preimage(RxtoF, c)) == c end - R, a = NGFiniteField(ZZRingElem(7), 1, "a") + R, a = finite_field(ZZRingElem(7), 1, "a") Rx, x = R["x"] f = x + 2 F, RxtoF = Nemo._residue_field(f) @test defining_polynomial(Rx, F) == x + 2 - R, a = NGFiniteField(ZZRingElem(7), 1, "a") + R, a = finite_field(ZZRingElem(7), 1, "a") Rx, x = R["x"] f = x + 2 F, RxtoF = Nemo._residue_field(f) @test defining_polynomial(Rx, F) == x + 2 - R, a = NGFiniteField(ZZRingElem(18446744073709551629), 1, "a") + R, a = finite_field(ZZRingElem(18446744073709551629), 1, "a") Rx, x = R["x"] f = x + 2 F, RxtoF = Nemo._residue_field(f) @@ -244,20 +244,20 @@ end end @testset "Conversions" begin - F = Nemo._GF(2) + F = GF(2) Fx, x = F["x"] - FF, = Nemo._FiniteField(x) + FF, = finite_field(x) @test iszero(FF(x)) - F = Nemo._GF(ZZ(1180591620717411303449)) + F = GF(ZZ(1180591620717411303449)) Fx, x = F["x"] - FF, = Nemo._FiniteField(x) + FF, = finite_field(x) @test iszero(FF(x)) end @testset "Implicit promotions" begin - F = Nemo._GF(2, 2) - FF = Nemo._GF(2, 3) + F = GF(2, 2) + FF = GF(2, 3) fl, = Nemo._try_promote(F, one(FF)) @test !fl fl, = Nemo._try_promote(FF, one(F)) @@ -267,7 +267,7 @@ end Fx, x = F["x"] f = x^2 + gen(F)*x + 1 - FF, = Nemo._FiniteField(f) + FF, = finite_field(f) for i in 1:10 a, b = rand(F), rand(FF) @test a * b == FF(a) * b @@ -288,7 +288,7 @@ end @test divexact(a, one(FF)) == divexact(FF(a), one(FF)) end - F = Nemo._GF(3) + F = GF(3) Fx, x = F["x"] FF, = Nemo._residue_field(x - 2) a = one(F) * one(FF) diff --git a/test/flint/fq_default_mat-test.jl b/test/flint/fq_default_mat-test.jl index 026ee5089b..0465ed7e21 100644 --- a/test/flint/fq_default_mat-test.jl +++ b/test/flint/fq_default_mat-test.jl @@ -1,6 +1,6 @@ @testset "FqMatrix.constructors" begin - F4, a = NGFiniteField(ZZRingElem(2), 2, "a") - F9, b = NGFiniteField(ZZRingElem(3), 2, "b") + F4, a = finite_field(ZZRingElem(2), 2, "a") + F9, b = finite_field(ZZRingElem(3), 2, "b") R = FqMatrixSpace(F4, 2, 2) @@ -165,10 +165,10 @@ @test a in keys(Dict(a => 1)) @test !(a in keys(Dict(b => 1))) - R, x = NGFiniteField(ZZRingElem(23), 5, "x") + R, x = finite_field(ZZRingElem(23), 5, "x") S = matrix_space(R, 2, 2) - for R in [FlintZZ, residue_ring(FlintZZ, 23), residue_ring(FlintZZ, ZZ(23)), GF(23)] + for R in [FlintZZ, residue_ring(FlintZZ, 23), residue_ring(FlintZZ, ZZ(23)), Native.GF(23)] M = matrix(R, 2, 2, [1, 2, 3, 4]) @test isa(S(M), MatElem) @@ -176,7 +176,7 @@ end @testset "FqMatrix.similar" begin - F9, b = NGFiniteField(ZZRingElem(3), 2, "b") + F9, b = finite_field(ZZRingElem(3), 2, "b") S = matrix_space(F9, 3, 3) s = S(ZZRingElem(3)) @@ -204,7 +204,7 @@ end end @testset "FqMatrix.printing" begin - F4, _ = NGFiniteField(ZZRingElem(2), 2, "a") + F4, _ = finite_field(ZZRingElem(2), 2, "a") R = FqMatrixSpace(F4, 2, 2) a = R(1) @@ -214,9 +214,9 @@ end end @testset "FqMatrix.manipulation" begin - F4, _ = NGFiniteField(ZZRingElem(2), 2, "a") + F4, _ = finite_field(ZZRingElem(2), 2, "a") R = FqMatrixSpace(F4, 2, 2) - F9, _ = NGFiniteField(ZZRingElem(3), 2, "b") + F9, _ = finite_field(ZZRingElem(3), 2, "b") S = FqMatrixSpace(F9, 2, 2) ar = [ 1 2; 3 4] @@ -282,7 +282,7 @@ end end @testset "FqMatrix.unary_ops" begin - F17, _ = NGFiniteField(ZZRingElem(17), 1, "a") + F17, _ = finite_field(ZZRingElem(17), 1, "a") R = matrix_space(F17, 3, 4) RR = matrix_space(F17, 4, 3) @@ -299,7 +299,7 @@ end end @testset "FqMatrix.binary_ops" begin - F17, _ = NGFiniteField(ZZRingElem(17), 1, "a") + F17, _ = finite_field(ZZRingElem(17), 1, "a") R = matrix_space(F17, 3, 4) @@ -327,7 +327,7 @@ end end @testset "FqMatrix.row_col_swapping" begin - R, _ = NGFiniteField(ZZRingElem(17), 1, "a") + R, _ = finite_field(ZZRingElem(17), 1, "a") a = matrix(R, [1 2; 3 4; 5 6]) @@ -366,10 +366,10 @@ end end @testset "FqMatrix.adhoc_binary" begin - F17, _ = NGFiniteField(ZZRingElem(17), 1, "a") + F17, _ = finite_field(ZZRingElem(17), 1, "a") R = matrix_space(F17, 3, 4) - F2, _ = NGFiniteField(ZZRingElem(2), 1, "a") + F2, _ = finite_field(ZZRingElem(2), 1, "a") a = R([ 1 2 3 1; 3 2 1 2; 1 3 2 0]) @@ -405,7 +405,7 @@ end end @testset "FqMatrix.comparison" begin - F17, _ = NGFiniteField(ZZRingElem(17), 1, "a") + F17, _ = finite_field(ZZRingElem(17), 1, "a") R = matrix_space(F17, 3, 4) @@ -419,7 +419,7 @@ end end @testset "FqMatrix.adhoc_comparison" begin - F17, _ = NGFiniteField(ZZRingElem(17), 1, "a") + F17, _ = finite_field(ZZRingElem(17), 1, "a") R = matrix_space(F17, 3, 4) @@ -433,7 +433,7 @@ end end @testset "FqMatrix.powering" begin - F17, _ = NGFiniteField(ZZRingElem(17), 1, "a") + F17, _ = finite_field(ZZRingElem(17), 1, "a") R = matrix_space(F17, 3, 4) @@ -447,7 +447,7 @@ end end @testset "FqMatrix.row_echelon_form" begin - F17, _ = NGFiniteField(ZZRingElem(17), 1, "a") + F17, _ = finite_field(ZZRingElem(17), 1, "a") R = matrix_space(F17, 3, 4) RR = matrix_space(F17, 4, 3) @@ -476,7 +476,7 @@ end end @testset "FqMatrix.trace_det" begin - F17, _ = NGFiniteField(ZZRingElem(17), 1, "a") + F17, _ = finite_field(ZZRingElem(17), 1, "a") R = matrix_space(F17, 3, 4) RR = matrix_space(F17, 4, 3) @@ -508,7 +508,7 @@ end end @testset "FqMatrix.rank" begin - F17, _ = NGFiniteField(ZZRingElem(17), 1, "a") + F17, _ = finite_field(ZZRingElem(17), 1, "a") R = matrix_space(F17, 3, 4) RR = matrix_space(F17, 4, 3) @@ -532,7 +532,7 @@ end end @testset "FqMatrix.inv" begin - F17, _ = NGFiniteField(ZZRingElem(17), 1, "a") + F17, _ = finite_field(ZZRingElem(17), 1, "a") R = matrix_space(F17, 3, 4) RR = matrix_space(F17, 4, 3) @@ -552,7 +552,7 @@ end end @testset "FqMatrix.solve" begin - F17, _ = NGFiniteField(ZZRingElem(17), 1, "a") + F17, _ = finite_field(ZZRingElem(17), 1, "a") R = matrix_space(F17, 3, 3) S = matrix_space(F17, 3, 4) @@ -642,7 +642,7 @@ end @testset "FqMatrix.lu" begin - F17, _ = NGFiniteField(ZZRingElem(17), 1, "a") + F17, _ = finite_field(ZZRingElem(17), 1, "a") R = matrix_space(F17, 3, 3) S = matrix_space(F17, 3, 4) @@ -669,7 +669,7 @@ end end @testset "FqMatrix.view" begin - F17, _ = NGFiniteField(ZZRingElem(17), 1, "a") + F17, _ = finite_field(ZZRingElem(17), 1, "a") R = matrix_space(F17, 3, 3) S = matrix_space(F17, 3, 4) @@ -705,7 +705,7 @@ end end @testset "FqMatrix.sub" begin - F17, _ = NGFiniteField(ZZRingElem(17), 1, "a") + F17, _ = finite_field(ZZRingElem(17), 1, "a") S = matrix_space(F17, 3, 3) A = S([1 2 3; 4 5 6; 7 8 9]) @@ -729,7 +729,7 @@ end end @testset "FqMatrix.concatenation" begin - F17, _ = NGFiniteField(ZZRingElem(17), 1, "a") + F17, _ = finite_field(ZZRingElem(17), 1, "a") R = matrix_space(F17, 3, 3) S = matrix_space(F17, 3, 4) @@ -765,7 +765,7 @@ end end @testset "FqMatrix.conversion" begin - F17, _ = NGFiniteField(ZZRingElem(17), 1, "a") + F17, _ = finite_field(ZZRingElem(17), 1, "a") R = matrix_space(F17, 3, 3) a = R([ 1 2 3 ; 3 2 1 ; 0 0 2 ]) @@ -776,7 +776,7 @@ end end @testset "FqMatrix.charpoly" begin - F17, _ = NGFiniteField(ZZRingElem(17), 1, "a") + F17, _ = finite_field(ZZRingElem(17), 1, "a") for dim = 0:5 S = matrix_space(F17, dim, dim) @@ -796,7 +796,7 @@ end end @testset "FqMatrix.rand" begin - F17, _ = NGFiniteField(ZZRingElem(17), 1, "a") + F17, _ = finite_field(ZZRingElem(17), 1, "a") S = matrix_space(F17, 3, 3) M = rand(S) @test parent(M) == S @@ -807,7 +807,7 @@ end degs = [1, 2] for p in ps for d in degs - F, = NGFiniteField(p, d) + F, = finite_field(p, d) A = matrix(F, 2, 2, [rand(F) for i in 1:4]) GC.@preserve A begin for i in 1:2 diff --git a/test/flint/fq_default_mpoly-test.jl b/test/flint/fq_default_mpoly-test.jl index 007750bb45..708d988abd 100644 --- a/test/flint/fq_default_mpoly-test.jl +++ b/test/flint/fq_default_mpoly-test.jl @@ -1,8 +1,8 @@ begin -local test_fields = (NGFiniteField(23, 1, "a"), - NGFiniteField(23, 5, "a"), - NGFiniteField(next_prime(ZZRingElem(2)^100), 2, "a")) +local test_fields = (finite_field(23, 1, "a"), + finite_field(23, 5, "a"), + finite_field(next_prime(ZZRingElem(2)^100), 2, "a")) @testset "FqMPolyRingElem.constructors" begin for (R, a) in test_fields diff --git a/test/flint/fq_default_poly-test.jl b/test/flint/fq_default_poly-test.jl index 3467eff518..95e78b93fc 100644 --- a/test/flint/fq_default_poly-test.jl +++ b/test/flint/fq_default_poly-test.jl @@ -1,5 +1,5 @@ @testset "FqPolyRingElem.constructors" begin - R, x = NGFiniteField(ZZRingElem(23), 5, "x") + R, x = finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") @test elem_type(S) == FqPolyRingElem @@ -26,7 +26,7 @@ h = S(x^2 + 2x + 1) - RR, xx = NGFiniteField(ZZRingElem(23), 1, "xx") + RR, xx = finite_field(ZZRingElem(23), 1, "xx") @test_throws ErrorException S(xx) @test isa(h, PolyRingElem) @@ -61,7 +61,7 @@ @test isa(r, PolyRingElem) - for R in [FlintZZ, residue_ring(FlintZZ, 23), residue_ring(FlintZZ, ZZ(23)), GF(23), GF(ZZ(23))] + for R in [FlintZZ, residue_ring(FlintZZ, 23), residue_ring(FlintZZ, ZZ(23)), Native.GF(23), Native.GF(ZZ(23))] T, y = polynomial_ring(R, "y") f = 3y^2 + 2y + 1 @@ -71,7 +71,7 @@ end @testset "FqPolyRingElem.printing" begin - R, x = NGFiniteField(ZZRingElem(23), 5, "x") + R, x = finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") T, z = polynomial_ring(S, "z") @@ -81,7 +81,7 @@ end end @testset "FqPolyRingElem.manipulation" begin - R, x = NGFiniteField(ZZRingElem(23), 5, "x") + R, x = finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") @test iszero(zero(S)) @@ -112,7 +112,7 @@ end end @testset "FqPolyRingElem.similar" begin - R, a = NGFiniteField(23, 3, "a") + R, a = finite_field(23, 3, "a") f = polynomial(R, [1, 2, 3]) g = similar(f) @@ -127,7 +127,7 @@ end end @testset "FqPolyRingElem.binary_ops" begin - R, x = NGFiniteField(ZZRingElem(23), 5, "x") + R, x = finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") f = x*y^2 + (x + 1)*y + 3 @@ -141,7 +141,7 @@ end end @testset "FqPolyRingElem.adhoc_binary" begin - R, x = NGFiniteField(ZZRingElem(23), 5, "x") + R, x = finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") f = x*y^2 + (x + 1)*y + 3 @@ -177,7 +177,7 @@ end end @testset "FqPolyRingElem.comparison" begin - R, x = NGFiniteField(ZZRingElem(23), 5, "x") + R, x = finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") f = x*y^2 + (x + 1)*y + 3 @@ -189,7 +189,7 @@ end end @testset "FqPolyRingElem.adhoc_comparison" begin - R, x = NGFiniteField(ZZRingElem(23), 5, "x") + R, x = finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") @test S(1) == 1 @@ -206,7 +206,7 @@ end end @testset "FqPolyRingElem.unary_ops" begin - R, x = NGFiniteField(ZZRingElem(23), 5, "x") + R, x = finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") f = x*y^2 + (x + 1)*y + 3 @@ -215,7 +215,7 @@ end end @testset "FqPolyRingElem.truncation" begin - R, x = NGFiniteField(ZZRingElem(23), 5, "x") + R, x = finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") f = x*y^2 + (x + 1)*y + 3 @@ -231,7 +231,7 @@ end end @testset "FqPolyRingElem.reverse" begin - R, x = NGFiniteField(ZZRingElem(23), 5, "x") + R, x = finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") f = x*y^2 + (x + 1)*y + 3 @@ -242,7 +242,7 @@ end end @testset "FqPolyRingElem.shift" begin - R, x = NGFiniteField(ZZRingElem(23), 5, "x") + R, x = finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") f = x*y^2 + (x + 1)*y + 3 @@ -257,7 +257,7 @@ end end @testset "FqPolyRingElem.powering" begin - R, x = NGFiniteField(ZZRingElem(23), 5, "x") + R, x = finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") f = x*y^2 + (x + 1)*y + 3 @@ -268,7 +268,7 @@ end end @testset "FqPolyRingElem.modular_arithmetic" begin - R, x = NGFiniteField(ZZRingElem(23), 5, "x") + R, x = finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") f = (3*x^2 + x + 2)*y + x^2 + 1 @@ -287,7 +287,7 @@ end @test powermod(f, -ZZRingElem(3), g) == (18*x^4+x^3+7*x^2+15*x+5)*y+(16*x^4+14*x^3+15*x^2+5*x+21) - R, _ = NGFiniteField(23, 1, "x") + R, _ = finite_field(23, 1, "x") Rx, x = R["x"] f = x^2 g = x^4 @@ -295,7 +295,7 @@ end end @testset "FqPolyRingElem.exact_division" begin - R, x = NGFiniteField(ZZRingElem(23), 5, "x") + R, x = finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") f = x*y^2 + (x + 1)*y + 3 @@ -305,7 +305,7 @@ end end @testset "FqPolyRingElem.adhoc_exact_division" begin - R, x = NGFiniteField(ZZRingElem(23), 5, "x") + R, x = finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") f = x*y^2 + (x + 1)*y + 3 @@ -316,7 +316,7 @@ end end @testset "FqPolyRingElem.euclidean_division" begin - R, x = NGFiniteField(ZZRingElem(23), 5, "x") + R, x = finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") k = y^3 + x*y^2 + (x + 1)*y + 3 @@ -329,7 +329,7 @@ end end @testset "FqPolyRingElem.content_primpart_gcd" begin - R, x = NGFiniteField(ZZRingElem(23), 5, "x") + R, x = finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") k = x*y^2 + (x + 1)*y + 3 @@ -351,7 +351,7 @@ end end @testset "FqPolyRingElem.square_root" begin - R, x = NGFiniteField(ZZRingElem(23), 5, "x") + R, x = finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") for iter in 1:1000 @@ -384,7 +384,7 @@ end end @testset "FqPolyRingElem.evaluation" begin - R, x = NGFiniteField(ZZRingElem(23), 5, "x") + R, x = finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") f = x^2 + 2x + 1 @@ -405,7 +405,7 @@ end end @testset "FqPolyRingElem.composition" begin - R, x = NGFiniteField(ZZRingElem(23), 5, "x") + R, x = finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") f = x*y^2 + (x + 1)*y + 3 @@ -415,7 +415,7 @@ end end @testset "FqPolyRingElem.derivative" begin - R, x = NGFiniteField(ZZRingElem(23), 5, "x") + R, x = finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") h = x*y^2 + (x + 1)*y + 3 @@ -424,7 +424,7 @@ end end @testset "FqPolyRingElem.integral" begin - R, x = NGFiniteField(ZZRingElem(23), 5, "x") + R, x = finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") f = (x^2 + 2x + 1)*y^2 + (x + 1)*y - 2x + 4 @@ -433,7 +433,7 @@ end end @testset "FqPolyRingElem.resultant" begin - R, x = NGFiniteField(ZZRingElem(23), 5, "x") + R, x = finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") f = 3x*y^2 + (x + 1)*y + 3 @@ -443,7 +443,7 @@ end end @testset "FqPolyRingElem.discriminant" begin - R, x = NGFiniteField(ZZRingElem(23), 5, "x") + R, x = finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") f = x*y^2 + (x + 1)*y + 3 @@ -452,7 +452,7 @@ end end @testset "FqPolyRingElem.gcdx" begin - R, x = NGFiniteField(ZZRingElem(23), 5, "x") + R, x = finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") f = 3x*y^2 + (x + 1)*y + 3 @@ -462,7 +462,7 @@ end end @testset "FqPolyRingElem.special" begin - R, x = NGFiniteField(ZZRingElem(23), 5, "x") + R, x = finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") @test chebyshev_t(20, y) == 524288*y^20-2621440*y^18+5570560*y^16-6553600*y^14+4659200*y^12-2050048*y^10+549120*y^8-84480*y^6+6600*y^4-200*y^2+1 @@ -471,7 +471,7 @@ end end @testset "FqPolyRingElem.inflation_deflation" begin - R, x = NGFiniteField(ZZRingElem(23), 5, "x") + R, x = finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") f = (x + 1)*y^2 + 2x*y + x + 3 @@ -480,7 +480,7 @@ end end @testset "FqPolyRingElem.is_irreducible" begin - R, a = NGFiniteField(ZZRingElem(23), 1, "a") + R, a = finite_field(ZZRingElem(23), 1, "a") Rx, x = polynomial_ring(R, "x") f = x^6 + x^4 + 2 *x^2 @@ -493,7 +493,7 @@ end end @testset "FqPolyRingElem.is_squarefree" begin - R, a = NGFiniteField(ZZRingElem(23), 1, "a") + R, a = finite_field(ZZRingElem(23), 1, "a") Rx, x = polynomial_ring(R, "x") f = x^6 + x^4 + 2 *x^2 @@ -509,7 +509,7 @@ end end @testset "FqPolyRingElem.factor" begin - R, x = NGFiniteField(ZZRingElem(23), 5, "x") + R, x = finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") @test_throws ArgumentError factor(S(0)) @@ -546,7 +546,7 @@ end end @testset "FqPolyRingElem.remove_valuation" begin - R, x = NGFiniteField(23, 5, "x") + R, x = finite_field(23, 5, "x") S, y = polynomial_ring(R, "y") f = 7y^2 + 3y + 2 @@ -573,25 +573,25 @@ end end @testset "FqPolyRingElem.lift" begin - R, x = NGFiniteField(23, 1, "x") + R, x = finite_field(23, 1, "x") S, y = R["y"] ZZy, z = ZZ["z"] f = lift(ZZy, y^2 + 1) @test parent(f) === ZZy @test map_coefficients(R, f, parent = S) == y^2 + 1 - R, x = NGFiniteField(next_prime(ZZ(2)^100), 1, "x") + R, x = finite_field(next_prime(ZZ(2)^100), 1, "x") S, y = R["y"] ZZy, z = ZZ["z"] f = lift(ZZy, y^2 + 1) @test parent(f) === ZZy @test map_coefficients(R, f, parent = S) == y^2 + 1 - R, x = NGFiniteField(23, 2, "x") + R, x = finite_field(23, 2, "x") S, y = R["y"] ZZy, z = ZZ["z"] @test_throws ErrorException lift(ZZy, y^2 + 1) - R, x = NGFiniteField(next_prime(ZZ(2)^100), 2, "x") + R, x = finite_field(next_prime(ZZ(2)^100), 2, "x") S, y = R["y"] ZZy, z = ZZ["z"] @test_throws ErrorException lift(ZZy, y^2 + 1) diff --git a/test/flint/fq_default_rel_series-test.jl b/test/flint/fq_default_rel_series-test.jl index 7429dd0d24..3a6fd95652 100644 --- a/test/flint/fq_default_rel_series-test.jl +++ b/test/flint/fq_default_rel_series-test.jl @@ -3,7 +3,7 @@ end @testset "FqRelPowerSeriesRingElem.constructors" begin - R, t = NGFiniteField(ZZRingElem(23), 5, "t") + R, t = finite_field(ZZRingElem(23), 5, "t") S, x = power_series_ring(R, 30, "x") @test elem_type(S) == FqRelPowerSeriesRingElem @@ -38,7 +38,7 @@ end end @testset "FqRelPowerSeriesRingElem.printing" begin - R, t = NGFiniteField(ZZRingElem(23), 5, "t") + R, t = finite_field(ZZRingElem(23), 5, "t") S, x = power_series_ring(R, 30, "x") b = (t^2 + 1)*x^2 + (t + 3)x + O(x^4) @@ -47,7 +47,7 @@ end end @testset "FqRelPowerSeriesRingElem.manipulation" begin - R, t = NGFiniteField(ZZRingElem(23), 5, "t") + R, t = finite_field(ZZRingElem(23), 5, "t") S, x = power_series_ring(R, 30, "x") @test max_precision(S) == 30 @@ -83,7 +83,7 @@ end end @testset "FqRelPowerSeriesRingElem.similar" begin - R0, a = NGFiniteField(23, 2, "a") + R0, a = finite_field(23, 2, "a") R, x = power_series_ring(R0, 10, "x") S, y = power_series_ring(ZZ, 10, "y") @@ -131,7 +131,7 @@ end end @testset "FqRelPowerSeriesRingElem.rel_series" begin - R, a = NGFiniteField(23, 2, "a") + R, a = finite_field(23, 2, "a") f = rel_series(R, [1, 2, 3], 3, 5, 2, "y") @test isa(f, FqRelPowerSeriesRingElem) @@ -174,7 +174,7 @@ end end @testset "FqRelPowerSeriesRingElem.unary_ops" begin - R, t = NGFiniteField(ZZRingElem(23), 5, "t") + R, t = finite_field(ZZRingElem(23), 5, "t") S, x = power_series_ring(R, 30, "x") a = 2x + x^3 @@ -186,7 +186,7 @@ end end @testset "FqRelPowerSeriesRingElem.binary_ops" begin - R, t = NGFiniteField(ZZRingElem(23), 5, "t") + R, t = finite_field(ZZRingElem(23), 5, "t") S, x = power_series_ring(R, 30, "x") a = 2x + x^3 @@ -324,7 +324,7 @@ end end @testset "FqRelPowerSeriesRingElem.adhoc_binary_ops" begin - R, t = NGFiniteField(ZZRingElem(23), 5, "t") + R, t = finite_field(ZZRingElem(23), 5, "t") S, x = power_series_ring(R, 30, "x") a = 2x + x^3 @@ -342,7 +342,7 @@ end end @testset "FqRelPowerSeriesRingElem.comparison" begin - R, t = NGFiniteField(ZZRingElem(23), 5, "t") + R, t = finite_field(ZZRingElem(23), 5, "t") S, x = power_series_ring(R, 30, "x") a = 2x + x^3 @@ -362,7 +362,7 @@ end end @testset "FqRelPowerSeriesRingElem.adhoc_comparison" begin - R, t = NGFiniteField(ZZRingElem(23), 5, "t") + R, t = finite_field(ZZRingElem(23), 5, "t") S, x = power_series_ring(R, 30, "x") a = 2x + x^3 @@ -382,7 +382,7 @@ end end @testset "FqRelPowerSeriesRingElem.powering" begin - R, t = NGFiniteField(ZZRingElem(23), 5, "t") + R, t = finite_field(ZZRingElem(23), 5, "t") S, x = power_series_ring(R, 30, "x") a = 2x + x^3 @@ -402,7 +402,7 @@ end end @testset "FqRelPowerSeriesRingElem.shift" begin - R, t = NGFiniteField(ZZRingElem(23), 5, "t") + R, t = finite_field(ZZRingElem(23), 5, "t") S, x = power_series_ring(R, 30, "x") a = 2x + x^3 @@ -424,7 +424,7 @@ end end @testset "FqRelPowerSeriesRingElem.truncation" begin - R, t = NGFiniteField(ZZRingElem(23), 5, "t") + R, t = finite_field(ZZRingElem(23), 5, "t") S, x = power_series_ring(R, 30, "x") a = 2x + x^3 @@ -444,7 +444,7 @@ end end @testset "FqRelPowerSeriesRingElem.inversion" begin - R, t = NGFiniteField(ZZRingElem(23), 5, "t") + R, t = finite_field(ZZRingElem(23), 5, "t") S, x = power_series_ring(R, 30, "x") a = 1 + x + 2x^2 + O(x^5) @@ -456,7 +456,7 @@ end end @testset "FqRelPowerSeriesRingElem.exact_division" begin - R, t = NGFiniteField(ZZRingElem(23), 5, "t") + R, t = finite_field(ZZRingElem(23), 5, "t") S, x = power_series_ring(R, 30, "x") a = x + x^3 @@ -474,7 +474,7 @@ end end @testset "FqRelPowerSeriesRingElem.adhoc_exact_division" begin - R, t = NGFiniteField(ZZRingElem(23), 5, "t") + R, t = finite_field(ZZRingElem(23), 5, "t") S, x = power_series_ring(R, 30, "x") a = x + x^3 @@ -496,7 +496,7 @@ end end @testset "FqRelPowerSeriesRingElem.square_root" begin - S, t = NGFiniteField(ZZRingElem(31), 5, "t") + S, t = finite_field(ZZRingElem(31), 5, "t") R, x = power_series_ring(S, 30, "x") for iter = 1:300 @@ -506,7 +506,7 @@ end end for p in [2, 7, 19, 65537] - R, t = NGFiniteField(ZZRingElem(p), 2, "t") + R, t = finite_field(ZZRingElem(p), 2, "t") S, x = power_series_ring(R, 10, "x") @@ -537,7 +537,7 @@ end end @testset "FqRelPowerSeriesRingElem.special_functions" begin - R, t = NGFiniteField(ZZRingElem(23), 5, "t") + R, t = finite_field(ZZRingElem(23), 5, "t") S, x = power_series_ring(R, 30, "x") @test isequal(exp(x + O(x^10)), 18*x^9+x^8+8*x^7+10*x^6+14*x^5+x^4+4*x^3+12*x^2+x+1+O(x^10)) @@ -547,7 +547,7 @@ end @testset "FqRelPowerSeriesRingElem.unsafe_operators" begin - S, t = NGFiniteField(ZZRingElem(23), 5, "t") + S, t = finite_field(ZZRingElem(23), 5, "t") R, x = power_series_ring(S, 30, "x") for iter = 1:300 diff --git a/test/flint/fq_mat-test.jl b/test/flint/fq_mat-test.jl index db1acfd275..e4b3a94cab 100644 --- a/test/flint/fq_mat-test.jl +++ b/test/flint/fq_mat-test.jl @@ -1,6 +1,6 @@ @testset "FqPolyRepMatrix.constructors" begin - F4, a = finite_field(ZZRingElem(2), 2, "a") - F9, b = finite_field(ZZRingElem(3), 2, "b") + F4, a = Native.finite_field(ZZRingElem(2), 2, "a") + F9, b = Native.finite_field(ZZRingElem(3), 2, "b") R = FqPolyRepMatrixSpace(F4, 2, 2) @@ -167,7 +167,7 @@ end @testset "FqPolyRepMatrix.similar" begin - F9, b = finite_field(ZZRingElem(3), 2, "b") + F9, b = Native.finite_field(ZZRingElem(3), 2, "b") S = matrix_space(F9, 3, 3) s = S(ZZRingElem(3)) @@ -195,7 +195,7 @@ end end @testset "FqPolyRepMatrix.printing" begin - F4, _ = finite_field(ZZRingElem(2), 2, "a") + F4, _ = Native.finite_field(ZZRingElem(2), 2, "a") R = FqPolyRepMatrixSpace(F4, 2, 2) a = R(1) @@ -205,9 +205,9 @@ end end @testset "FqPolyRepMatrix.manipulation" begin - F4, _ = finite_field(ZZRingElem(2), 2, "a") + F4, _ = Native.finite_field(ZZRingElem(2), 2, "a") R = FqPolyRepMatrixSpace(F4, 2, 2) - F9, _ = finite_field(ZZRingElem(3), 2, "b") + F9, _ = Native.finite_field(ZZRingElem(3), 2, "b") S = FqPolyRepMatrixSpace(F9, 2, 2) ar = [ 1 2; 3 4] @@ -273,7 +273,7 @@ end end @testset "FqPolyRepMatrix.unary_ops" begin - F17, _ = finite_field(ZZRingElem(17), 1, "a") + F17, _ = Native.finite_field(ZZRingElem(17), 1, "a") R = matrix_space(F17, 3, 4) RR = matrix_space(F17, 4, 3) @@ -290,7 +290,7 @@ end end @testset "FqPolyRepMatrix.binary_ops" begin - F17, _ = finite_field(ZZRingElem(17), 1, "a") + F17, _ = Native.finite_field(ZZRingElem(17), 1, "a") R = matrix_space(F17, 3, 4) a = R([ 1 2 3 1; 3 2 1 2; 1 3 2 0]) @@ -317,7 +317,7 @@ end end @testset "FqPolyRepMatrix.row_col_swapping" begin - R, _ = FlintFiniteField(ZZRingElem(17), 1, "a") + R, _ = Native.finite_field(ZZRingElem(17), 1, "a") a = matrix(R, [1 2; 3 4; 5 6]) @@ -356,10 +356,10 @@ end end @testset "FqPolyRepMatrix.adhoc_binary" begin - F17, _ = finite_field(ZZRingElem(17), 1, "a") + F17, _ = Native.finite_field(ZZRingElem(17), 1, "a") R = matrix_space(F17, 3, 4) - F2, _ = finite_field(ZZRingElem(2), 1, "a") + F2, _ = Native.finite_field(ZZRingElem(2), 1, "a") a = R([ 1 2 3 1; 3 2 1 2; 1 3 2 0]) @@ -395,7 +395,7 @@ end end @testset "FqPolyRepMatrix.comparison" begin - F17, _ = finite_field(ZZRingElem(17), 1, "a") + F17, _ = Native.finite_field(ZZRingElem(17), 1, "a") R = matrix_space(F17, 3, 4) @@ -409,7 +409,7 @@ end end @testset "FqPolyRepMatrix.adhoc_comparison" begin - F17, _ = finite_field(ZZRingElem(17), 1, "a") + F17, _ = Native.finite_field(ZZRingElem(17), 1, "a") R = matrix_space(F17, 3, 4) @@ -423,7 +423,7 @@ end end @testset "FqPolyRepMatrix.powering" begin - F17, _ = finite_field(ZZRingElem(17), 1, "a") + F17, _ = Native.finite_field(ZZRingElem(17), 1, "a") R = matrix_space(F17, 3, 4) @@ -437,7 +437,7 @@ end end @testset "FqPolyRepMatrix.row_echelon_form" begin - F17, _ = FlintFiniteField(ZZRingElem(17), 1, "a") + F17, _ = Native.finite_field(ZZRingElem(17), 1, "a") R = matrix_space(F17, 3, 4) RR = matrix_space(F17, 4, 3) @@ -466,7 +466,7 @@ end end @testset "FqPolyRepMatrix.trace_det" begin - F17, _ = finite_field(ZZRingElem(17), 1, "a") + F17, _ = Native.finite_field(ZZRingElem(17), 1, "a") R = matrix_space(F17, 3, 4) RR = matrix_space(F17, 4, 3) @@ -498,7 +498,7 @@ end end @testset "FqPolyRepMatrix.rank" begin - F17, _ = finite_field(ZZRingElem(17), 1, "a") + F17, _ = Native.finite_field(ZZRingElem(17), 1, "a") R = matrix_space(F17, 3, 4) RR = matrix_space(F17, 4, 3) @@ -522,7 +522,7 @@ end end @testset "FqPolyRepMatrix.inv" begin - F17, _ = finite_field(ZZRingElem(17), 1, "a") + F17, _ = Native.finite_field(ZZRingElem(17), 1, "a") R = matrix_space(F17, 3, 4) RR = matrix_space(F17, 4, 3) @@ -542,7 +542,7 @@ end end @testset "FqPolyRepMatrix.solve" begin - F17, _ = finite_field(ZZRingElem(17), 1, "a") + F17, _ = Native.finite_field(ZZRingElem(17), 1, "a") R = matrix_space(F17, 3, 3) S = matrix_space(F17, 3, 4) @@ -632,7 +632,7 @@ end @testset "FqPolyRepMatrix.lu" begin - F17, _ = finite_field(ZZRingElem(17), 1, "a") + F17, _ = Native.finite_field(ZZRingElem(17), 1, "a") R = matrix_space(F17, 3, 3) S = matrix_space(F17, 3, 4) @@ -659,7 +659,7 @@ end end @testset "FqPolyRepMatrix.view" begin - F17, _ = finite_field(ZZRingElem(17), 1, "a") + F17, _ = Native.finite_field(ZZRingElem(17), 1, "a") R = matrix_space(F17, 3, 3) S = matrix_space(F17, 3, 4) @@ -695,7 +695,7 @@ end end @testset "FqPolyRepMatrix.sub" begin - F17, _ = finite_field(ZZRingElem(17), 1, "a") + F17, _ = Native.finite_field(ZZRingElem(17), 1, "a") S = matrix_space(F17, 3, 3) A = S([1 2 3; 4 5 6; 7 8 9]) @@ -719,7 +719,7 @@ end end @testset "FqPolyRepMatrix.concatenation" begin - F17, _ = finite_field(ZZRingElem(17), 1, "a") + F17, _ = Native.finite_field(ZZRingElem(17), 1, "a") R = matrix_space(F17, 3, 3) S = matrix_space(F17, 3, 4) @@ -755,7 +755,7 @@ end end @testset "FqPolyRepMatrix.conversion" begin - F17, _ = finite_field(ZZRingElem(17), 1, "a") + F17, _ = Native.finite_field(ZZRingElem(17), 1, "a") R = matrix_space(F17, 3, 3) a = R([ 1 2 3 ; 3 2 1 ; 0 0 2 ]) @@ -766,7 +766,7 @@ end end @testset "FqPolyRepMatrix.charpoly" begin - F17, _ = finite_field(ZZRingElem(17), 1, "a") + F17, _ = Native.finite_field(ZZRingElem(17), 1, "a") for dim = 0:5 S = matrix_space(F17, dim, dim) @@ -786,7 +786,7 @@ end end @testset "FqPolyRepMatrix.rand" begin - F17, _ = finite_field(ZZRingElem(17), 1, "a") + F17, _ = Native.finite_field(ZZRingElem(17), 1, "a") S = matrix_space(F17, 3, 3) M = rand(S) @test parent(M) == S diff --git a/test/flint/fq_nmod-test.jl b/test/flint/fq_nmod-test.jl index 24cd3a600a..de5bb529dd 100644 --- a/test/flint/fq_nmod-test.jl +++ b/test/flint/fq_nmod-test.jl @@ -1,21 +1,21 @@ @testset "fqPolyRepFieldElem.constructors" begin - R, x = finite_field(7, 5, "x") + R, x = Native.finite_field(7, 5, "x") @test elem_type(R) == fqPolyRepFieldElem @test elem_type(fqPolyRepField) == fqPolyRepFieldElem @test parent_type(fqPolyRepFieldElem) == fqPolyRepField Sy, y = polynomial_ring(residue_ring(FlintZZ, 3), "y") - Syy, yy = GF(3)["y"] + Syy, yy = Native.GF(3)["y"] - T, z = finite_field(y^2 + 1, "z") - T2, z2 = finite_field(yy^2 + 1, "z") + T, z = Native.finite_field(y^2 + 1, "z") + T2, z2 = Native.finite_field(yy^2 + 1, "z") # check that one can leave out the name for the generator, or specify it as a symbol - @test finite_field(7, 5)[1] isa fqPolyRepField - @test finite_field(7, 5, :x)[1] isa fqPolyRepField - @test finite_field(y^2 + 1)[1] isa fqPolyRepField - @test finite_field(y^2 + 1, :x)[1] isa fqPolyRepField + @test Native.finite_field(7, 5)[1] isa fqPolyRepField + @test Native.finite_field(7, 5, :x)[1] isa fqPolyRepField + @test Native.finite_field(y^2 + 1)[1] isa fqPolyRepField + @test Native.finite_field(y^2 + 1, :x)[1] isa fqPolyRepField @test isa(R, fqPolyRepField) @test isa(T, fqPolyRepField) @@ -41,15 +41,15 @@ @test isa(d, fqPolyRepFieldElem) # check for primality - T3, z3 = finite_field(yy^2 + 1, "z", check=false) + T3, z3 = Native.finite_field(yy^2 + 1, "z", check=false) @test isa(T2, fqPolyRepField) Syyy, yyy = polynomial_ring(residue_ring(FlintZZ, 4), "y") @test yyy isa zzModPolyRingElem - @test_throws DomainError finite_field(yyy^2+1, "z") + @test_throws DomainError Native.finite_field(yyy^2+1, "z") end @testset "fqPolyRepFieldElem.rand" begin - R, x = finite_field(7, 5, "x") + R, x = Native.finite_field(7, 5, "x") test_rand(R) test_rand(R, 1:9) @@ -63,10 +63,10 @@ end end @testset "fqPolyRepFieldElem.unsafe_coeffs" begin - R, a = finite_field(23, 2, "a") + R, a = Native.finite_field(23, 2, "a") b = R() - + @test Nemo.setindex_raw!(b, UInt(0), 0) == 0 @test Nemo.setindex_raw!(b, UInt(0), 1) == 0 @test Nemo.setindex_raw!(b, UInt(2), 1) == 2a @@ -88,7 +88,7 @@ end end @testset "fqPolyRepFieldElem.printing" begin - R, x = finite_field(7, 5, "x") + R, x = Native.finite_field(7, 5, "x") a = 3x^4 + 2x^3 + 4x^2 + x + 1 @@ -96,7 +96,7 @@ end end @testset "fqPolyRepFieldElem.manipulation" begin - R, x = finite_field(7, 5, "x") + R, x = Native.finite_field(7, 5, "x") @test iszero(zero(R)) @@ -121,12 +121,12 @@ end @test isa(modulus(R), fpPolyRingElem) #@test defining_polynomial(R) isa fpPolyRingElem - #kt, t = GF(7)["t"] + #kt, t = Native.GF(7)["t"] #@test parent(defining_polynomial(kt, R)) === kt end @testset "fqPolyRepFieldElem.unary_ops" begin - R, x = finite_field(7, 5, "x") + R, x = Native.finite_field(7, 5, "x") a = x^4 + 3x^2 + 6x + 1 @@ -134,7 +134,7 @@ end end @testset "fqPolyRepFieldElem.binary_ops" begin - R, x = finite_field(7, 5, "x") + R, x = Native.finite_field(7, 5, "x") a = x^4 + 3x^2 + 6x + 1 b = 3x^4 + 2x^2 + x + 1 @@ -147,7 +147,7 @@ end end @testset "fqPolyRepFieldElem.adhoc_binary" begin - R, x = finite_field(7, 5, "x") + R, x = Native.finite_field(7, 5, "x") a = x^4 + 3x^2 + 6x + 1 @@ -165,7 +165,7 @@ end end @testset "fqPolyRepFieldElem.powering" begin - R, x = finite_field(7, 5, "x") + R, x = Native.finite_field(7, 5, "x") a = x^4 + 3x^2 + 6x + 1 @@ -175,7 +175,7 @@ end end @testset "fqPolyRepFieldElem.comparison" begin - R, x = finite_field(7, 5, "x") + R, x = Native.finite_field(7, 5, "x") a = x^4 + 3x^2 + 6x + 1 b = 3x^4 + 2x^2 + 2 @@ -186,7 +186,7 @@ end end @testset "fqPolyRepFieldElem.inversion" begin - R, x = finite_field(7, 5, "x") + R, x = Native.finite_field(7, 5, "x") a = x^4 + 3x^2 + 6x + 1 @@ -198,7 +198,7 @@ end end @testset "fqPolyRepFieldElem.exact_division" begin - R, x = finite_field(7, 5, "x") + R, x = Native.finite_field(7, 5, "x") a = x^4 + 3x^2 + 6x + 1 b = 3x^4 + 2x^2 + 2 @@ -209,7 +209,7 @@ end end @testset "fqPolyRepFieldElem.gcd" begin - R, x = finite_field(7, 5, "x") + R, x = Native.finite_field(7, 5, "x") a = x^4 + 3x^2 + 6x + 1 b = 3x^4 + 2x^2 + x + 1 @@ -220,7 +220,7 @@ end end @testset "fqPolyRepFieldElem.special_functions" begin - R, x = finite_field(7, 5, "x") + R, x = Native.finite_field(7, 5, "x") a = x^4 + 3x^2 + 6x + 1 @@ -251,27 +251,17 @@ end @testset "fqPolyRepFieldElem.iteration" begin for n = [2, 3, 5, 13, 31] - R, _ = finite_field(n, 1, "x") + R, _ = Native.finite_field(n, 1, "x") elts = Nemo.AbstractAlgebra.test_iterate(R) @test elts == R.(0:n-1) - R, _ = finite_field(n, rand(2:9), "x") + R, _ = Native.finite_field(n, rand(2:9), "x") Nemo.AbstractAlgebra.test_iterate(R) end end @testset "fqPolyRepFieldElem.lift" begin - R, x = finite_field(23, 2, "x") + R, x = Native.finite_field(23, 2, "x") f = 8x + 9 - S, y = polynomial_ring(GF(23), "y") + S, y = polynomial_ring(Native.GF(23), "y") @test lift(S, f) == 8y + 9 end - -@testset "fqPolyRepField.overload" begin - R, x = finite_field(19, 3, "x") - @test R([1, 0, 1]) == x^2 + 1 -end - -@testset "Nemo.jl#1493" begin - @test_throws DomainError GF(4, 2) - @test_throws DomainError finite_field(6, 2, "x") -end diff --git a/test/flint/fq_nmod_abs_series-test.jl b/test/flint/fq_nmod_abs_series-test.jl index 4c72573053..e39022a2c3 100644 --- a/test/flint/fq_nmod_abs_series-test.jl +++ b/test/flint/fq_nmod_abs_series-test.jl @@ -3,7 +3,7 @@ end @testset "fqPolyRepAbsPowerSeriesRingElem.constructors" begin - S, t = finite_field(23, 5, "t") + S, t = Native.finite_field(23, 5, "t") R1 = AbsPowerSeriesRing(S, 30) R2 = AbsPowerSeriesRing(S, 30) @@ -36,7 +36,7 @@ end end @testset "fqPolyRepAbsPowerSeriesRingElem.printing" begin - S, t = finite_field(23, 5, "t") + S, t = Native.finite_field(23, 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) b = x^2 + 3x + O(x^4) @@ -45,7 +45,7 @@ end end @testset "fqPolyRepAbsPowerSeriesRingElem.manipulation" begin - S, t = finite_field(23, 5, "t") + S, t = Native.finite_field(23, 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -67,7 +67,7 @@ end end @testset "fqPolyRepAbsPowerSeriesRingElem.similar" begin - R0, a = finite_field(23, 2, "a") + R0, a = Native.finite_field(23, 2, "a") R, x = power_series_ring(R0, 10, "x"; model=:capped_absolute) S, y = power_series_ring(ZZ, 10, "y"; model=:capped_absolute) @@ -115,7 +115,7 @@ end end @testset "fqPolyRepAbsPowerSeriesRingElem.abs_series" begin - R, a = finite_field(23, 2, "a") + R, a = Native.finite_field(23, 2, "a") f = abs_series(R, [1, 2, 3], 3, 5, "y") @test isa(f, fqPolyRepAbsPowerSeriesRingElem) @@ -158,7 +158,7 @@ end end @testset "fqPolyRepAbsPowerSeriesRingElem.unary_ops" begin - S, t = finite_field(23, 5, "t") + S, t = Native.finite_field(23, 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -170,7 +170,7 @@ end end @testset "fqPolyRepAbsPowerSeriesRingElem.binary_ops" begin - S, t = finite_field(23, 5, "t") + S, t = Native.finite_field(23, 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -190,7 +190,7 @@ end end @testset "fqPolyRepAbsPowerSeriesRingElem.adhoc_binary_ops" begin - S, t = finite_field(23, 5, "t") + S, t = Native.finite_field(23, 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -206,14 +206,14 @@ end @test d*ZZ(3) == 3x^2 + 9x^3 - 3x^4 - F, x = finite_field(23, 1, "x") + F, x = Native.finite_field(23, 1, "x") R, t = power_series_ring(F, 6, "t", model=:capped_absolute) @test F(1) * t == t end @testset "fqPolyRepAbsPowerSeriesRingElem.comparison" begin - S, t = finite_field(23, 5, "t") + S, t = Native.finite_field(23, 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -229,7 +229,7 @@ end end @testset "fqPolyRepAbsPowerSeriesRingElem.adhoc_comparison" begin - S, t = finite_field(23, 5, "t") + S, t = Native.finite_field(23, 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -249,7 +249,7 @@ end end @testset "fqPolyRepAbsPowerSeriesRingElem.powering" begin - S, t = finite_field(23, 5, "t") + S, t = Native.finite_field(23, 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -269,7 +269,7 @@ end end @testset "fqPolyRepAbsPowerSeriesRingElem.shift" begin - S, t = finite_field(23, 5, "t") + S, t = Native.finite_field(23, 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -291,7 +291,7 @@ end end @testset "fqPolyRepAbsPowerSeriesRingElem.truncation" begin - S, t = finite_field(23, 5, "t") + S, t = Native.finite_field(23, 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -311,7 +311,7 @@ end end @testset "fqPolyRepAbsPowerSeriesRingElem.exact_division" begin - S, t = finite_field(23, 5, "t") + S, t = Native.finite_field(23, 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = x + x^3 @@ -329,7 +329,7 @@ end end @testset "fqPolyRepAbsPowerSeriesRingElem.adhoc_exact_division" begin - S, t = finite_field(23, 5, "t") + S, t = Native.finite_field(23, 5, "t") R, x = power_series_ring(ZZ, 30, "x", model=:capped_absolute) a = x + x^3 @@ -349,7 +349,7 @@ end end @testset "fqPolyRepAbsPowerSeriesRingElem.inversion" begin - S, t = finite_field(23, 5, "t") + S, t = Native.finite_field(23, 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 1 + x + 2x^2 + O(x^5) @@ -361,7 +361,7 @@ end end @testset "fqPolyRepAbsPowerSeriesRingElem.square_root" begin - S, t = finite_field(31, 5, "t") + S, t = Native.finite_field(31, 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) for iter = 1:300 @@ -371,7 +371,7 @@ end end for p in [2, 7, 19, 65537] - R, t = finite_field(p, 2, "t") + R, t = Native.finite_field(p, 2, "t") S, x = power_series_ring(R, 10, "x", model=:capped_absolute) for iter = 1:10 @@ -401,7 +401,7 @@ end end @testset "fqPolyRepAbsPowerSeriesRingElem.unsafe_operators" begin - S, t = finite_field(23, 5, "t") + S, t = Native.finite_field(23, 5, "t") R, x = power_series_ring(S, 30, "x", model=:capped_absolute) for iter = 1:300 diff --git a/test/flint/fq_nmod_embed-test.jl b/test/flint/fq_nmod_embed-test.jl index 4d958c681e..a1dff38d40 100644 --- a/test/flint/fq_nmod_embed-test.jl +++ b/test/flint/fq_nmod_embed-test.jl @@ -7,17 +7,17 @@ p = rand(2:997) end - k1, x1 = finite_field(p, 1, "x1") - k2, x2 = finite_field(p, 2, "x2") - k3, x3 = finite_field(p, 3, "x3") - k4, x4 = finite_field(p, 4, "x4") - k6, x6 = finite_field(p, 6, "x6") - k8, x8 = finite_field(p, 8, "x8") - k9, x9 = finite_field(p, 9, "x9") - k12, x12 = finite_field(p, 12, "x12") - k16, x16 = finite_field(p, 16, "x16") - k18, x18 = finite_field(p, 18, "x18") - k24, x24 = finite_field(p, 24, "x24") + k1, x1 = Native.finite_field(p, 1, "x1") + k2, x2 = Native.finite_field(p, 2, "x2") + k3, x3 = Native.finite_field(p, 3, "x3") + k4, x4 = Native.finite_field(p, 4, "x4") + k6, x6 = Native.finite_field(p, 6, "x6") + k8, x8 = Native.finite_field(p, 8, "x8") + k9, x9 = Native.finite_field(p, 9, "x9") + k12, x12 = Native.finite_field(p, 12, "x12") + k16, x16 = Native.finite_field(p, 16, "x16") + k18, x18 = Native.finite_field(p, 18, "x18") + k24, x24 = Native.finite_field(p, 24, "x24") S = Set([(k4, k12), (k6, k24), @@ -89,8 +89,8 @@ end end a, b = rand(1:5), rand(1:5) - ka, xa = finite_field(p, a, "xa") - kab, xab = finite_field(p, a*b, "xab") + ka, xa = Native.finite_field(p, a, "xa") + kab, xab = Native.finite_field(p, a*b, "xab") f = preimage_map(ka, kab) g = embed(ka, kab) @@ -113,7 +113,7 @@ end end pop!(S, p) - F = finite_field(p, 4, "s")[1] + F = Native.finite_field(p, 4, "s")[1] Z = residue_ring(ZZ, p) R, x = polynomial_ring(Z, "x") @@ -146,10 +146,10 @@ end F4 = factor(P4) end - K1 = finite_field(P1, "r1")[1] - K2 = finite_field(P2, "r2")[1] - K3 = finite_field(P3, "r3")[1] - K4 = finite_field(P4, "r4")[1] + K1 = Native.finite_field(P1, "r1")[1] + K2 = Native.finite_field(P2, "r2")[1] + K3 = Native.finite_field(P3, "r3")[1] + K4 = Native.finite_field(P4, "r4")[1] K = Set([K1, K2, K3, K4]) while !isempty(K) diff --git a/test/flint/fq_nmod_mat-test.jl b/test/flint/fq_nmod_mat-test.jl index 17a9f9426b..d324ac3650 100644 --- a/test/flint/fq_nmod_mat-test.jl +++ b/test/flint/fq_nmod_mat-test.jl @@ -1,6 +1,6 @@ @testset "fqPolyRepMatrix.constructors" begin - F4, a = FlintFiniteField(2, 2, "a") - F9, b = FlintFiniteField(3, 2, "b") + F4, a = Native.finite_field(2, 2, "a") + F9, b = Native.finite_field(3, 2, "b") R = fqPolyRepMatrixSpace(F4, 2, 2) @@ -167,7 +167,7 @@ end @testset "fqPolyRepMatrix.similar" begin - F9, b = finite_field(3, 2, "b") + F9, b = Native.finite_field(3, 2, "b") S = fqPolyRepMatrixSpace(F9, 2, 2) s = S(ZZRingElem(3)) @@ -195,7 +195,7 @@ end end @testset "fqPolyRepMatrix.printing" begin - F4, _ = FlintFiniteField(2, 2, "a") + F4, _ = Native.finite_field(2, 2, "a") R = fqPolyRepMatrixSpace(F4, 2, 2) a = R(1) @@ -205,9 +205,9 @@ end end @testset "fqPolyRepMatrix.manipulation" begin - F4, _ = FlintFiniteField(2, 2, "a") + F4, _ = Native.finite_field(2, 2, "a") R = fqPolyRepMatrixSpace(F4, 2, 2) - F9, _ = FlintFiniteField(3, 2, "b") + F9, _ = Native.finite_field(3, 2, "b") S = fqPolyRepMatrixSpace(F9, 2, 2) ar = [ 1 2; 3 4] @@ -273,7 +273,7 @@ end end @testset "fqPolyRepMatrix.unary_ops" begin - F17, _ = FlintFiniteField(17, 1, "a") + F17, _ = Native.finite_field(17, 1, "a") R = matrix_space(F17, 3, 4) RR = matrix_space(F17, 4, 3) @@ -290,7 +290,7 @@ end end @testset "fqPolyRepMatrix.row_col_swapping" begin - R, _ = FlintFiniteField(17, 1, "a") + R, _ = Native.finite_field(17, 1, "a") a = matrix(R, [1 2; 3 4; 5 6]) @@ -329,7 +329,7 @@ end end @testset "fqPolyRepMatrix.binary_ops" begin - F17, _ = FlintFiniteField(17, 1, "a") + F17, _ = Native.finite_field(17, 1, "a") R = matrix_space(F17, 3, 4) a = R([ 1 2 3 1; 3 2 1 2; 1 3 2 0]) @@ -356,10 +356,10 @@ end end @testset "fqPolyRepMatrix.adhoc_binary" begin - F17, _ = FlintFiniteField(17, 1, "a") + F17, _ = Native.finite_field(17, 1, "a") R = matrix_space(F17, 3, 4) - F2, _ = FlintFiniteField(2, 1, "a") + F2, _ = Native.finite_field(2, 1, "a") a = R([ 1 2 3 1; 3 2 1 2; 1 3 2 0]) @@ -395,7 +395,7 @@ end end @testset "fqPolyRepMatrix.comparison" begin - F17, _ = FlintFiniteField(17, 1, "a") + F17, _ = Native.finite_field(17, 1, "a") R = matrix_space(F17, 3, 4) @@ -409,7 +409,7 @@ end end @testset "fqPolyRepMatrix.comparison" begin - F17, _ = FlintFiniteField(17, 1, "a") + F17, _ = Native.finite_field(17, 1, "a") R = matrix_space(F17, 3, 4) @@ -423,7 +423,7 @@ end end @testset "fqPolyRepMatrix.powering" begin - F17, _ = FlintFiniteField(17, 1, "a") + F17, _ = Native.finite_field(17, 1, "a") R = matrix_space(F17, 3, 4) @@ -437,7 +437,7 @@ end end @testset "fqPolyRepMatrix.row_echelon_form" begin - F17, _ = FlintFiniteField(17, 1, "a") + F17, _ = Native.finite_field(17, 1, "a") R = matrix_space(F17, 3, 4) RR = matrix_space(F17, 4, 3) @@ -466,7 +466,7 @@ end end @testset "fqPolyRepMatrix.trace_det" begin - F17, _ = FlintFiniteField(17, 1, "a") + F17, _ = Native.finite_field(17, 1, "a") R = matrix_space(F17, 3, 4) RR = matrix_space(F17, 4, 3) @@ -498,7 +498,7 @@ end end @testset "fqPolyRepMatrix.rank" begin - F17, _ = FlintFiniteField(17, 1, "a") + F17, _ = Native.finite_field(17, 1, "a") R = matrix_space(F17, 3, 4) RR = matrix_space(F17, 4, 3) @@ -522,7 +522,7 @@ end end @testset "fqPolyRepMatrix.inv" begin - F17, _ = FlintFiniteField(17, 1, "a") + F17, _ = Native.finite_field(17, 1, "a") R = matrix_space(F17, 3, 4) RR = matrix_space(F17, 4, 3) @@ -542,7 +542,7 @@ end end @testset "fqPolyRepMatrix.solve" begin - F17, _ = FlintFiniteField(17, 1, "a") + F17, _ = Native.finite_field(17, 1, "a") R = matrix_space(F17, 3, 3) S = matrix_space(F17, 3, 4) @@ -632,7 +632,7 @@ end @testset "fqPolyRepMatrix.lu" begin - F17, _ = FlintFiniteField(17, 1, "a") + F17, _ = Native.finite_field(17, 1, "a") R = matrix_space(F17, 3, 3) S = matrix_space(F17, 3, 4) @@ -659,7 +659,7 @@ end end @testset "fqPolyRepMatrix.view" begin - F17, _ = FlintFiniteField(17, 1, "a") + F17, _ = Native.finite_field(17, 1, "a") R = matrix_space(F17, 3, 3) S = matrix_space(F17, 3, 4) @@ -695,7 +695,7 @@ end end @testset "fqPolyRepMatrix.sub" begin - F17, _ = FlintFiniteField(17, 1, "a") + F17, _ = Native.finite_field(17, 1, "a") S = matrix_space(F17, 3, 3) A = S([1 2 3; 4 5 6; 7 8 9]) @@ -719,7 +719,7 @@ end end @testset "fqPolyRepMatrix.concatenation" begin - F17, _ = FlintFiniteField(17, 1, "a") + F17, _ = Native.finite_field(17, 1, "a") R = matrix_space(F17, 3, 3) S = matrix_space(F17, 3, 4) @@ -755,7 +755,7 @@ end end @testset "fqPolyRepMatrix.conversion" begin - F17, _ = FlintFiniteField(17, 1, "a") + F17, _ = Native.finite_field(17, 1, "a") R = matrix_space(F17, 3, 3) a = R([ 1 2 3 ; 3 2 1 ; 0 0 2 ]) @@ -766,7 +766,7 @@ end end @testset "fqPolyRepMatrix.charpoly" begin - F17, _ = FlintFiniteField(17, 1, "a") + F17, _ = Native.finite_field(17, 1, "a") for dim = 0:5 S = matrix_space(F17, dim, dim) @@ -786,7 +786,7 @@ end end @testset "fqPolyRepMatrix.rand" begin - F17, _ = FlintFiniteField(17, 1, "a") + F17, _ = Native.finite_field(17, 1, "a") S = matrix_space(F17, 3, 4) M = rand(S) @test parent(M) == S diff --git a/test/flint/fq_nmod_mpoly-test.jl b/test/flint/fq_nmod_mpoly-test.jl index d0e6b48138..2404878d44 100644 --- a/test/flint/fq_nmod_mpoly-test.jl +++ b/test/flint/fq_nmod_mpoly-test.jl @@ -1,5 +1,5 @@ @testset "fqPolyRepMPolyRingElem.constructors" begin - R, a = finite_field(23, 5, "a") + R, a = Native.finite_field(23, 5, "a") for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -78,19 +78,19 @@ end end - RR, = finite_field(23, 2, "a") + RR, = Native.finite_field(23, 2, "a") S, (x, y) = polynomial_ring(R, ["x", "y"]) M = MPolyBuildCtx(S) @test_throws ErrorException push_term!(M, one(RR), zeros(Int, 2)) - F, = finite_field(2, 2, :z) + F, = Native.finite_field(2, 2, :z) R, (x, ) = polynomial_ring(F, ["x",]) @test R([F(1)], [[BigInt(1)]]) == x @test R([1], [[BigInt(1)]]) == x end @testset "fqPolyRepMPolyRingElem.printing" begin - R, a = finite_field(23, 5, "a") + R, a = Native.finite_field(23, 5, "a") S, (x, y) = polynomial_ring(R, ["x", "y"]) @test !occursin(r"{", string(S)) @@ -107,7 +107,7 @@ end end @testset "fqPolyRepMPolyRingElem.hash" begin - R, a = finite_field(23, 5, "a") + R, a = Native.finite_field(23, 5, "a") S, (x, y) = polynomial_ring(R, ["x", "y"]) p = y^ZZRingElem(2)^100 @@ -117,7 +117,7 @@ end end @testset "fqPolyRepMPolyRingElem.manipulation" begin - R, a = finite_field(23, 5, "a") + R, a = Native.finite_field(23, 5, "a") for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -241,16 +241,10 @@ end @test trailing_coefficient(x) == 1 @test trailing_coefficient(S(2)) == 2 @test trailing_coefficient(S()) == 0 - - f = x^(ZZ(2)^100) * y^100 - @test_throws InexactError degree(f, 1) - @test degree(f, 2) == 100 - @test_throws OverflowError degrees(f) - @test_throws OverflowError total_degree(f) end @testset "fqPolyRepMPolyRingElem.multivariate_coeff" begin - R, a = finite_field(23, 5, "a") + R, a = Native.finite_field(23, 5, "a") for ord in Nemo.flint_orderings S, (x, y, z) = polynomial_ring(R, ["x", "y", "z"]; ordering=ord) @@ -268,7 +262,7 @@ end end @testset "fqPolyRepMPolyRingElem.unary_ops" begin - R, a = finite_field(23, 5, "a") + R, a = Native.finite_field(23, 5, "a") for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -285,7 +279,7 @@ end end @testset "fqPolyRepMPolyRingElem.binary_ops" begin - R, a = finite_field(23, 5, "a") + R, a = Native.finite_field(23, 5, "a") for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -308,7 +302,7 @@ end end @testset "fqPolyRepMPolyRingElem.adhoc_binary" begin - R, a = finite_field(23, 5, "a") + R, a = Native.finite_field(23, 5, "a") for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -344,7 +338,7 @@ end end @testset "fqPolyRepMPolyRingElem.adhoc_comparison" begin - R, a = finite_field(23, 5, "a") + R, a = Native.finite_field(23, 5, "a") for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -366,7 +360,7 @@ end end @testset "fqPolyRepMPolyRingElem.powering" begin - R, a = finite_field(23, 5, "a") + R, a = Native.finite_field(23, 5, "a") for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -393,7 +387,7 @@ end end @testset "fqPolyRepMPolyRingElem.divides" begin - R, a = finite_field(23, 5, "a") + R, a = Native.finite_field(23, 5, "a") for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -422,7 +416,7 @@ end end @testset "fqPolyRepMPolyRingElem.euclidean_division" begin - R, a = finite_field(23, 5, "a") + R, a = Native.finite_field(23, 5, "a") for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -458,7 +452,7 @@ end end @testset "fqPolyRepMPolyRingElem.ideal_reduction" begin - R, a = finite_field(23, 5, "a") + R, a = Native.finite_field(23, 5, "a") for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -507,7 +501,7 @@ end end @testset "fqPolyRepMPolyRingElem.gcd" begin - R, a = finite_field(23, 5, "a") + R, a = Native.finite_field(23, 5, "a") for num_vars = 1:4 var_names = ["x$j" for j in 1:num_vars] @@ -533,12 +527,9 @@ end end @testset "fqPolyRepMPolyRingElem.factor" begin - R, a = finite_field(23, 5, "a") + R, a = Native.finite_field(23, 5, "a") R, (x, y, z) = polynomial_ring(R, ["x", "y", "z"]) - @test_throws ArgumentError factor(R(0)) - @test_throws ArgumentError factor_squarefree(R(0)) - function check_factor(a, esum) f = factor(a) @test a == unit(f) * prod([p^e for (p, e) in f]) @@ -553,7 +544,7 @@ end end @testset "fqPolyRepMPolyRingElem.sqrt" begin - R, a = finite_field(23, 5, "a") + R, a = Native.finite_field(23, 5, "a") for num_vars = 1:4 var_names = ["x$j" for j in 1:num_vars] @@ -579,7 +570,7 @@ end end @testset "fqPolyRepMPolyRingElem.evaluation" begin - R, a = finite_field(23, 5, "a") + R, a = Native.finite_field(23, 5, "a") for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -662,7 +653,7 @@ end end @testset "fqPolyRepMPolyRingElem.valuation" begin - R, a = finite_field(23, 5, "a") + R, a = Native.finite_field(23, 5, "a") for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -700,7 +691,7 @@ end end @testset "fqPolyRepMPolyRingElem.derivative" begin - R, a = finite_field(23, 5, "a") + R, a = Native.finite_field(23, 5, "a") for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -720,7 +711,7 @@ end end @testset "fqPolyRepMPolyRingElem.combine_like_terms" begin - R23, a = finite_field(23, 5, "a") + R23, a = Native.finite_field(23, 5, "a") for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -756,7 +747,7 @@ end end @testset "fqPolyRepMPolyRingElem.exponents" begin - R23, a = finite_field(23, 5, "a") + R23, a = Native.finite_field(23, 5, "a") for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -811,7 +802,7 @@ end end @testset "fqPolyRepMPolyRingElem.gcd_with_cofactors" begin - R23, t = finite_field(23, 5, "t") + R23, t = Native.finite_field(23, 5, "t") R, (x, y, z) = polynomial_ring(R23, [:x, :y, :z]) @test gcd_with_cofactors(x, y) == (1, x, y) diff --git a/test/flint/fq_nmod_poly-test.jl b/test/flint/fq_nmod_poly-test.jl index 74073e38f0..24b522ef85 100644 --- a/test/flint/fq_nmod_poly-test.jl +++ b/test/flint/fq_nmod_poly-test.jl @@ -1,5 +1,5 @@ @testset "fqPolyRepPolyRingElem.constructors" begin - R, x = finite_field(23, 5, "x") + R, x = Native.finite_field(23, 5, "x") S1 = PolyRing(R) S2 = PolyRing(R) @@ -68,7 +68,7 @@ end @testset "fqPolyRepPolyRingElem.printing" begin - R, x = finite_field(23, 5, "x") + R, x = Native.finite_field(23, 5, "x") S, y = polynomial_ring(R, "y") f = x^2 + y^3 + 1 @@ -77,7 +77,7 @@ end end @testset "fqPolyRepPolyRingElem.manipulation" begin - R, x = finite_field(23, 5, "x") + R, x = Native.finite_field(23, 5, "x") S, y = polynomial_ring(R, "y") @test iszero(zero(S)) @@ -110,7 +110,7 @@ end end @testset "fqPolyRepPolyRingElem.polynomial" begin - R, _ = finite_field(23, 3, "a") + R, _ = Native.finite_field(23, 3, "a") f = polynomial(R, []) g = polynomial(R, [1, 2, 3]) @@ -130,7 +130,7 @@ end end @testset "fqPolyRepPolyRingElem.similar" begin - R, a = finite_field(23, 3, "a") + R, a = Native.finite_field(23, 3, "a") f = polynomial(R, [1, 2, 3]) g = similar(f) @@ -145,7 +145,7 @@ end end @testset "fqPolyRepPolyRingElem.binary_ops" begin - R, x = finite_field(23, 5, "x") + R, x = Native.finite_field(23, 5, "x") S, y = polynomial_ring(R, "y") f = x*y^2 + (x + 1)*y + 3 @@ -159,7 +159,7 @@ end end @testset "fqPolyRepPolyRingElem.adhoc_binary" begin - R, x = finite_field(23, 5, "x") + R, x = Native.finite_field(23, 5, "x") S, y = polynomial_ring(R, "y") f = x*y^2 + (x + 1)*y + 3 @@ -195,7 +195,7 @@ end end @testset "fqPolyRepPolyRingElem.comparison" begin - R, x = finite_field(23, 5, "x") + R, x = Native.finite_field(23, 5, "x") S, y = polynomial_ring(R, "y") f = x*y^2 + (x + 1)*y + 3 @@ -207,7 +207,7 @@ end end @testset "fqPolyRepPolyRingElem.adhoc_comparison" begin - R, x = finite_field(23, 5, "x") + R, x = Native.finite_field(23, 5, "x") S, y = polynomial_ring(R, "y") @test S(1) == 1 @@ -224,7 +224,7 @@ end end @testset "fqPolyRepPolyRingElem.unary_ops" begin - R, x = finite_field(23, 5, "x") + R, x = Native.finite_field(23, 5, "x") S, y = polynomial_ring(R, "y") f = x*y^2 + (x + 1)*y + 3 @@ -233,7 +233,7 @@ end end @testset "fqPolyRepPolyRingElem.truncation" begin - R, x = finite_field(23, 5, "x") + R, x = Native.finite_field(23, 5, "x") S, y = polynomial_ring(R, "y") f = x*y^2 + (x + 1)*y + 3 @@ -249,7 +249,7 @@ end end @testset "fqPolyRepPolyRingElem.reverse" begin - R, x = finite_field(23, 5, "x") + R, x = Native.finite_field(23, 5, "x") S, y = polynomial_ring(R, "y") f = x*y^2 + (x + 1)*y + 3 @@ -258,7 +258,7 @@ end end @testset "fqPolyRepPolyRingElem.shift" begin - R, x = finite_field(23, 5, "x") + R, x = Native.finite_field(23, 5, "x") S, y = polynomial_ring(R, "y") f = x*y^2 + (x + 1)*y + 3 @@ -273,7 +273,7 @@ end end @testset "fqPolyRepPolyRingElem.powering" begin - R, x = finite_field(23, 5, "x") + R, x = Native.finite_field(23, 5, "x") S, y = polynomial_ring(R, "y") f = x*y^2 + (x + 1)*y + 3 @@ -284,7 +284,7 @@ end end @testset "fqPolyRepPolyRingElem.modular_arithmetic" begin - R, x = finite_field(23, 5, "x") + R, x = Native.finite_field(23, 5, "x") S, y = polynomial_ring(R, "y") f = (3*x^2 + x + 2)*y + x^2 + 1 @@ -305,7 +305,7 @@ end end @testset "fqPolyRepPolyRingElem.exact_division" begin - R, x = finite_field(23, 5, "x") + R, x = Native.finite_field(23, 5, "x") S, y = polynomial_ring(R, "y") f = x*y^2 + (x + 1)*y + 3 @@ -315,7 +315,7 @@ end end @testset "fqPolyRepPolyRingElem.adhoc_exact_division" begin - R, x = finite_field(23, 5, "x") + R, x = Native.finite_field(23, 5, "x") S, y = polynomial_ring(R, "y") f = x*y^2 + (x + 1)*y + 3 @@ -326,7 +326,7 @@ end end @testset "fqPolyRepPolyRingElem.euclidean_division" begin - R, x = finite_field(23, 5, "x") + R, x = Native.finite_field(23, 5, "x") S, y = polynomial_ring(R, "y") k = y^3 + x*y^2 + (x + 1)*y + 3 @@ -338,7 +338,7 @@ end end @testset "fqPolyRepPolyRingElem.content_primpart_gcd" begin - R, x = finite_field(23, 5, "x") + R, x = Native.finite_field(23, 5, "x") S, y = polynomial_ring(R, "y") k = x*y^2 + (x + 1)*y + 3 @@ -361,7 +361,7 @@ end @testset "fqPolyRepPolyRingElem.square_root" begin for p in [2, 23] - R, x = finite_field(p, 3, "x") + R, x = Native.finite_field(p, 3, "x") S, y = polynomial_ring(R, "y") for iter in 1:1000 @@ -395,7 +395,7 @@ end end @testset "fqPolyRepPolyRingElem.evaluation" begin - R, x = finite_field(23, 5, "x") + R, x = Native.finite_field(23, 5, "x") S, y = polynomial_ring(R, "y") f = x^2 + 2x + 1 @@ -416,7 +416,7 @@ end end @testset "fqPolyRepPolyRingElem.composition" begin - R, x = finite_field(23, 5, "x") + R, x = Native.finite_field(23, 5, "x") S, y = polynomial_ring(R, "y") f = x*y^2 + (x + 1)*y + 3 @@ -426,7 +426,7 @@ end end @testset "fqPolyRepPolyRingElem.derivative" begin - R, x = finite_field(23, 5, "x") + R, x = Native.finite_field(23, 5, "x") S, y = polynomial_ring(R, "y") h = x*y^2 + (x + 1)*y + 3 @@ -435,7 +435,7 @@ end end @testset "fqPolyRepPolyRingElem.integral" begin - R, x = finite_field(23, 5, "x") + R, x = Native.finite_field(23, 5, "x") S, y = polynomial_ring(R, "y") f = (x^2 + 2x + 1)*y^2 + (x + 1)*y - 2x + 4 @@ -444,7 +444,7 @@ end end @testset "fqPolyRepPolyRingElem.resultant" begin - R, x = finite_field(23, 5, "x") + R, x = Native.finite_field(23, 5, "x") S, y = polynomial_ring(R, "y") f = 3x*y^2 + (x + 1)*y + 3 @@ -454,7 +454,7 @@ end end @testset "fqPolyRepPolyRingElem.discriminant" begin - R, x = finite_field(23, 5, "x") + R, x = Native.finite_field(23, 5, "x") S, y = polynomial_ring(R, "y") f = x*y^2 + (x + 1)*y + 3 @@ -463,7 +463,7 @@ end end @testset "fqPolyRepPolyRingElem.gcdx" begin - R, x = finite_field(23, 5, "x") + R, x = Native.finite_field(23, 5, "x") S, y = polynomial_ring(R, "y") f = 3x*y^2 + (x + 1)*y + 3 @@ -473,7 +473,7 @@ end end @testset "fqPolyRepPolyRingElem.special" begin - R, x = finite_field(23, 5, "x") + R, x = Native.finite_field(23, 5, "x") S, y = polynomial_ring(R, "y") @test chebyshev_t(20, y) == 524288*y^20-2621440*y^18+5570560*y^16-6553600*y^14+4659200*y^12-2050048*y^10+549120*y^8-84480*y^6+6600*y^4-200*y^2+1 @@ -482,7 +482,7 @@ end end @testset "fqPolyRepPolyRingElem.inflation_deflation" begin - R, x = finite_field(23, 5, "x") + R, x = Native.finite_field(23, 5, "x") S, y = polynomial_ring(R, "y") f = (x + 1)*y^2 + 2x*y + x + 3 @@ -491,7 +491,7 @@ end end @testset "fqPolyRepPolyRingElem.is_irreducible" begin - R, a = finite_field(23, 1, "a") + R, a = Native.finite_field(23, 1, "a") Rx, x = polynomial_ring(R, "x") f = x^6 + x^4 + 2 *x^2 @@ -504,28 +504,20 @@ end end @testset "fqPolyRepPolyRingElem.is_squarefree" begin - R, x = finite_field(23, 5, "x") - Rx, y = polynomial_ring(R, "y") + R, x = Native.finite_field(23, 5, "x") + S, y = polynomial_ring(R, "y") f = y^6 + y^4 + 2 *y^2 @test !is_squarefree(f) @test is_squarefree((y+1)*(y+2)*(y+3)) - - @test !is_squarefree(Rx(0)) - @test is_squarefree(Rx(1)) - @test is_squarefree(Rx(2)) - @test is_squarefree(Rx(4)) end @testset "fqPolyRepPolyRingElem.factor" begin - R, x = finite_field(23, 5, "x") + R, x = Native.finite_field(23, 5, "x") S, y = polynomial_ring(R, "y") - @test_throws ArgumentError factor(S(0)) - @test_throws ArgumentError factor_squarefree(S(0)) - f = 7y^2 + 3y + 2 g = 11y^3 - 2y^2 + 5 @@ -555,7 +547,7 @@ end end @testset "fqPolyRepPolyRingElem.remove_valuation" begin - R, x = finite_field(23, 5, "x") + R, x = Native.finite_field(23, 5, "x") S, y = polynomial_ring(R, "y") f = 7y^2 + 3y + 2 @@ -582,8 +574,8 @@ end end @testset "issue #1353" begin - F, _ = finite_field(2, 1, "1") - E, a = finite_field(2, 15, "a") + F, _ = Native.finite_field(2, 1, "1") + E, a = Native.finite_field(2, 15, "a") S, x = polynomial_ring(F, "x") @test_throws ErrorException x+a diff --git a/test/flint/fq_nmod_rel_series-test.jl b/test/flint/fq_nmod_rel_series-test.jl index 65d208c61d..461533d00c 100644 --- a/test/flint/fq_nmod_rel_series-test.jl +++ b/test/flint/fq_nmod_rel_series-test.jl @@ -3,7 +3,7 @@ end @testset "fqPolyRepRelPowerSeriesRingElem.constructors" begin - R, t = finite_field(23, 5, "t") + R, t = Native.finite_field(23, 5, "t") S1 = RelPowerSeriesRing(R, 30) S2 = RelPowerSeriesRing(R, 30) @@ -45,7 +45,7 @@ end end @testset "fqPolyRepRelPowerSeriesRingElem.printing" begin - R, t = finite_field(23, 5, "t") + R, t = Native.finite_field(23, 5, "t") S, x = power_series_ring(R, 30, "x") b = (t^2 + 1)*x^2 + (t + 3)x + O(x^4) @@ -54,7 +54,7 @@ end end @testset "fqPolyRepRelPowerSeriesRingElem.manipulation" begin - R, t = finite_field(23, 5, "t") + R, t = Native.finite_field(23, 5, "t") S, x = power_series_ring(R, 30, "x") @test max_precision(S) == 30 @@ -90,7 +90,7 @@ end end @testset "fqPolyRepRelPowerSeriesRingElem.similar" begin - R0, a = finite_field(23, 2, "a") + R0, a = Native.finite_field(23, 2, "a") R, x = power_series_ring(R0, 10, "x") S, y = power_series_ring(ZZ, 10, "y") @@ -138,7 +138,7 @@ end end @testset "fqPolyRepRelPowerSeriesRingElem.rel_series" begin - R, a = finite_field(23, 2, "a") + R, a = Native.finite_field(23, 2, "a") f = rel_series(R, [1, 2, 3], 3, 5, 2, "y") @test isa(f, fqPolyRepRelPowerSeriesRingElem) @@ -181,7 +181,7 @@ end end @testset "fqPolyRepRelPowerSeriesRingElem.unary_ops" begin - R, t = finite_field(23, 5, "t") + R, t = Native.finite_field(23, 5, "t") S, x = power_series_ring(R, 30, "x") a = 2x + x^3 @@ -193,7 +193,7 @@ end end @testset "fqPolyRepRelPowerSeriesRingElem.binary_ops" begin - R, t = finite_field(23, 5, "t") + R, t = Native.finite_field(23, 5, "t") S, x = power_series_ring(R, 30, "x") a = 2x + x^3 @@ -331,7 +331,7 @@ end end @testset "fqPolyRepRelPowerSeriesRingElem.adhoc_binary_ops" begin - R, t = finite_field(23, 5, "t") + R, t = Native.finite_field(23, 5, "t") S, x = power_series_ring(R, 30, "x") a = 2x + x^3 @@ -349,7 +349,7 @@ end end @testset "fqPolyRepRelPowerSeriesRingElem.comparison" begin - R, t = finite_field(23, 5, "t") + R, t = Native.finite_field(23, 5, "t") S, x = power_series_ring(R, 30, "x") a = 2x + x^3 @@ -369,7 +369,7 @@ end end @testset "fqPolyRepRelPowerSeriesRingElem.adhoc_comparison" begin - R, t = finite_field(23, 5, "t") + R, t = Native.finite_field(23, 5, "t") S, x = power_series_ring(R, 30, "x") a = 2x + x^3 @@ -389,7 +389,7 @@ end end @testset "fqPolyRepRelPowerSeriesRingElem.powering" begin - R, t = finite_field(23, 5, "t") + R, t = Native.finite_field(23, 5, "t") S, x = power_series_ring(R, 30, "x") a = 2x + x^3 @@ -409,7 +409,7 @@ end end @testset "fqPolyRepRelPowerSeriesRingElem.shift" begin - R, t = finite_field(23, 5, "t") + R, t = Native.finite_field(23, 5, "t") S, x = power_series_ring(R, 30, "x") a = 2x + x^3 @@ -431,7 +431,7 @@ end end @testset "fqPolyRepRelPowerSeriesRingElem.truncation" begin - R, t = finite_field(23, 5, "t") + R, t = Native.finite_field(23, 5, "t") S, x = power_series_ring(R, 30, "x") a = 2x + x^3 @@ -451,7 +451,7 @@ end end @testset "fqPolyRepRelPowerSeriesRingElem.inversion" begin - R, t = finite_field(23, 5, "t") + R, t = Native.finite_field(23, 5, "t") S, x = power_series_ring(R, 30, "x") a = 1 + x + 2x^2 + O(x^5) @@ -463,7 +463,7 @@ end end @testset "fqPolyRepRelPowerSeriesRingElem.exact_division" begin - R, t = finite_field(23, 5, "t") + R, t = Native.finite_field(23, 5, "t") S, x = power_series_ring(R, 30, "x") a = x + x^3 @@ -481,7 +481,7 @@ end end @testset "fqPolyRepRelPowerSeriesRingElem.adhoc_exact_division" begin - R, t = finite_field(23, 5, "t") + R, t = Native.finite_field(23, 5, "t") S, x = power_series_ring(R, 30, "x") a = x + x^3 @@ -503,7 +503,7 @@ end end @testset "fqPolyRepRelPowerSeriesRingElem.square_root" begin - S, t = finite_field(31, 5, "t") + S, t = Native.finite_field(31, 5, "t") R, x = power_series_ring(S, 30, "x") for iter = 1:300 @@ -513,7 +513,7 @@ end end for p in [2, 7, 19, 65537] - R, t = finite_field(p, 2, "t") + R, t = Native.finite_field(p, 2, "t") S, x = power_series_ring(R, 10, "x") @@ -544,7 +544,7 @@ end end @testset "fqPolyRepRelPowerSeriesRingElem.special_functions" begin - R, t = finite_field(23, 5, "t") + R, t = Native.finite_field(23, 5, "t") S, x = power_series_ring(R, 30, "x") @test isequal(exp(x + O(x^10)), 18*x^9+x^8+8*x^7+10*x^6+14*x^5+x^4+4*x^3+12*x^2+x+1+O(x^10)) @@ -553,7 +553,7 @@ end end @testset "fqPolyRepRelPowerSeriesRingElem.unsafe_operators" begin - S, t = finite_field(23, 5, "t") + S, t = Native.finite_field(23, 5, "t") R, x = power_series_ring(S, 30, "x") for iter = 1:300 diff --git a/test/flint/fq_poly-test.jl b/test/flint/fq_poly-test.jl index d79627970d..41f2607060 100644 --- a/test/flint/fq_poly-test.jl +++ b/test/flint/fq_poly-test.jl @@ -1,5 +1,5 @@ @testset "FqPolyRepPolyRingElem.constructors" begin - R, x = finite_field(ZZRingElem(23), 5, "x") + R, x = Native.finite_field(ZZRingElem(23), 5, "x") S1 = PolyRing(R) S2 = PolyRing(R) @@ -68,7 +68,7 @@ end @testset "FqPolyRepPolyRingElem.printing" begin - R, x = finite_field(ZZRingElem(23), 5, "x") + R, x = Native.finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") T, z = polynomial_ring(S, "z") @@ -78,7 +78,7 @@ end end @testset "FqPolyRepPolyRingElem.manipulation" begin - R, x = finite_field(ZZRingElem(23), 5, "x") + R, x = Native.finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") @test iszero(zero(S)) @@ -109,7 +109,7 @@ end end @testset "FqPolyRepPolyRingElem.polynomial" begin - R, _ = finite_field(ZZ(23), 3, "a") + R, _ = Native.finite_field(ZZ(23), 3, "a") f = polynomial(R, []) g = polynomial(R, [1, 2, 3]) @@ -129,7 +129,7 @@ end end @testset "FqPolyRepPolyRingElem.similar" begin - R, a = finite_field(ZZ(23), 3, "a") + R, a = Native.finite_field(ZZ(23), 3, "a") f = polynomial(R, [1, 2, 3]) g = similar(f) @@ -144,7 +144,7 @@ end end @testset "FqPolyRepPolyRingElem.binary_ops" begin - R, x = finite_field(ZZRingElem(23), 5, "x") + R, x = Native.finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") f = x*y^2 + (x + 1)*y + 3 @@ -158,7 +158,7 @@ end end @testset "FqPolyRepPolyRingElem.adhoc_binary" begin - R, x = finite_field(ZZRingElem(23), 5, "x") + R, x = Native.finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") f = x*y^2 + (x + 1)*y + 3 @@ -194,7 +194,7 @@ end end @testset "FqPolyRepPolyRingElem.comparison" begin - R, x = finite_field(ZZRingElem(23), 5, "x") + R, x = Native.finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") f = x*y^2 + (x + 1)*y + 3 @@ -206,7 +206,7 @@ end end @testset "FqPolyRepPolyRingElem.adhoc_comparison" begin - R, x = finite_field(ZZRingElem(23), 5, "x") + R, x = Native.finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") @test S(1) == 1 @@ -223,7 +223,7 @@ end end @testset "FqPolyRepPolyRingElem.unary_ops" begin - R, x = finite_field(ZZRingElem(23), 5, "x") + R, x = Native.finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") f = x*y^2 + (x + 1)*y + 3 @@ -232,7 +232,7 @@ end end @testset "FqPolyRepPolyRingElem.truncation" begin - R, x = finite_field(ZZRingElem(23), 5, "x") + R, x = Native.finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") f = x*y^2 + (x + 1)*y + 3 @@ -248,7 +248,7 @@ end end @testset "FqPolyRepPolyRingElem.reverse" begin - R, x = finite_field(ZZRingElem(23), 5, "x") + R, x = Native.finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") f = x*y^2 + (x + 1)*y + 3 @@ -259,7 +259,7 @@ end end @testset "FqPolyRepPolyRingElem.shift" begin - R, x = finite_field(ZZRingElem(23), 5, "x") + R, x = Native.finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") f = x*y^2 + (x + 1)*y + 3 @@ -274,7 +274,7 @@ end end @testset "FqPolyRepPolyRingElem.powering" begin - R, x = finite_field(ZZRingElem(23), 5, "x") + R, x = Native.finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") f = x*y^2 + (x + 1)*y + 3 @@ -285,7 +285,7 @@ end end @testset "FqPolyRepPolyRingElem.modular_arithmetic" begin - R, x = finite_field(ZZRingElem(23), 5, "x") + R, x = Native.finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") f = (3*x^2 + x + 2)*y + x^2 + 1 @@ -306,7 +306,7 @@ end end @testset "FqPolyRepPolyRingElem.exact_division" begin - R, x = finite_field(ZZRingElem(23), 5, "x") + R, x = Native.finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") f = x*y^2 + (x + 1)*y + 3 @@ -316,7 +316,7 @@ end end @testset "FqPolyRepPolyRingElem.adhoc_exact_division" begin - R, x = finite_field(ZZRingElem(23), 5, "x") + R, x = Native.finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") f = x*y^2 + (x + 1)*y + 3 @@ -327,7 +327,7 @@ end end @testset "FqPolyRepPolyRingElem.euclidean_division" begin - R, x = finite_field(ZZRingElem(23), 5, "x") + R, x = Native.finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") k = y^3 + x*y^2 + (x + 1)*y + 3 @@ -339,7 +339,7 @@ end end @testset "FqPolyRepPolyRingElem.content_primpart_gcd" begin - R, x = finite_field(ZZRingElem(23), 5, "x") + R, x = Native.finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") k = x*y^2 + (x + 1)*y + 3 @@ -362,7 +362,7 @@ end @testset "FqPolyRepPolyRingElem.square_root" begin for p in [2, 23] - R, x = finite_field(ZZRingElem(p), 3, "x") + R, x = Native.finite_field(ZZRingElem(p), 3, "x") S, y = polynomial_ring(R, "y") for iter in 1:1000 @@ -396,7 +396,7 @@ end end @testset "FqPolyRepPolyRingElem.evaluation" begin - R, x = finite_field(ZZRingElem(23), 5, "x") + R, x = Native.finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") f = x^2 + 2x + 1 @@ -417,7 +417,7 @@ end end @testset "FqPolyRepPolyRingElem.composition" begin - R, x = finite_field(ZZRingElem(23), 5, "x") + R, x = Native.finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") f = x*y^2 + (x + 1)*y + 3 @@ -427,7 +427,7 @@ end end @testset "FqPolyRepPolyRingElem.derivative" begin - R, x = finite_field(ZZRingElem(23), 5, "x") + R, x = Native.finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") h = x*y^2 + (x + 1)*y + 3 @@ -436,7 +436,7 @@ end end @testset "FqPolyRepPolyRingElem.integral" begin - R, x = finite_field(ZZRingElem(23), 5, "x") + R, x = Native.finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") f = (x^2 + 2x + 1)*y^2 + (x + 1)*y - 2x + 4 @@ -445,7 +445,7 @@ end end @testset "FqPolyRepPolyRingElem.resultant" begin - R, x = finite_field(ZZRingElem(23), 5, "x") + R, x = Native.finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") f = 3x*y^2 + (x + 1)*y + 3 @@ -455,7 +455,7 @@ end end @testset "FqPolyRepPolyRingElem.discriminant" begin - R, x = finite_field(ZZRingElem(23), 5, "x") + R, x = Native.finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") f = x*y^2 + (x + 1)*y + 3 @@ -464,7 +464,7 @@ end end @testset "FqPolyRepPolyRingElem.gcdx" begin - R, x = finite_field(ZZRingElem(23), 5, "x") + R, x = Native.finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") f = 3x*y^2 + (x + 1)*y + 3 @@ -474,7 +474,7 @@ end end @testset "FqPolyRepPolyRingElem.special" begin - R, x = finite_field(ZZRingElem(23), 5, "x") + R, x = Native.finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") @test chebyshev_t(20, y) == 524288*y^20-2621440*y^18+5570560*y^16-6553600*y^14+4659200*y^12-2050048*y^10+549120*y^8-84480*y^6+6600*y^4-200*y^2+1 @@ -483,7 +483,7 @@ end end @testset "FqPolyRepPolyRingElem.inflation_deflation" begin - R, x = finite_field(ZZRingElem(23), 5, "x") + R, x = Native.finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") f = (x + 1)*y^2 + 2x*y + x + 3 @@ -492,7 +492,7 @@ end end @testset "FqPolyRepPolyRingElem.is_irreducible" begin - R, a = finite_field(ZZRingElem(23), 1, "a") + R, a = Native.finite_field(ZZRingElem(23), 1, "a") Rx, x = polynomial_ring(R, "x") f = x^6 + x^4 + 2 *x^2 @@ -505,7 +505,7 @@ end end @testset "FqPolyRepPolyRingElem.is_squarefree" begin - R, a = finite_field(ZZRingElem(23), 1, "a") + R, a = Native.finite_field(ZZRingElem(23), 1, "a") Rx, x = polynomial_ring(R, "x") f = x^6 + x^4 + 2 *x^2 @@ -513,20 +513,12 @@ end @test !is_squarefree(f) @test is_squarefree((x+1)*(x+2)*(x+3)) - - @test !is_squarefree(Rx(0)) - @test is_squarefree(Rx(1)) - @test is_squarefree(Rx(2)) - @test is_squarefree(Rx(4)) end @testset "FqPolyRepPolyRingElem.factor" begin - R, x = finite_field(ZZRingElem(23), 5, "x") + R, x = Native.finite_field(ZZRingElem(23), 5, "x") S, y = polynomial_ring(R, "y") - @test_throws ArgumentError factor(S(0)) - @test_throws ArgumentError factor_squarefree(S(0)) - f = 7y^2 + 3y + 2 g = 11y^3 - 2y^2 + 5 @@ -558,7 +550,7 @@ end end @testset "FqPolyRepPolyRingElem.remove_valuation" begin - R, x = finite_field(23, 5, "x") + R, x = Native.finite_field(23, 5, "x") S, y = polynomial_ring(R, "y") f = 7y^2 + 3y + 2 diff --git a/test/flint/fq_rel_series-test.jl b/test/flint/fq_rel_series-test.jl index 985a0215fc..6f4e07fbc0 100644 --- a/test/flint/fq_rel_series-test.jl +++ b/test/flint/fq_rel_series-test.jl @@ -3,7 +3,7 @@ end @testset "FqPolyRepRelPowerSeriesRingElem.constructors" begin - R, t = finite_field(ZZRingElem(23), 5, "t") + R, t = Native.finite_field(ZZRingElem(23), 5, "t") S1 = RelPowerSeriesRing(R, 30) S2 = RelPowerSeriesRing(R, 30) @@ -45,7 +45,7 @@ end end @testset "FqPolyRepRelPowerSeriesRingElem.printing" begin - R, t = finite_field(ZZRingElem(23), 5, "t") + R, t = Native.finite_field(ZZRingElem(23), 5, "t") S, x = power_series_ring(R, 30, "x") b = (t^2 + 1)*x^2 + (t + 3)x + O(x^4) @@ -54,7 +54,7 @@ end end @testset "FqPolyRepRelPowerSeriesRingElem.manipulation" begin - R, t = finite_field(ZZRingElem(23), 5, "t") + R, t = Native.finite_field(ZZRingElem(23), 5, "t") S, x = power_series_ring(R, 30, "x") @test max_precision(S) == 30 @@ -90,7 +90,7 @@ end end @testset "FqPolyRepRelPowerSeriesRingElem.similar" begin - R0, a = finite_field(ZZ(23), 2, "a") + R0, a = Native.finite_field(ZZ(23), 2, "a") R, x = power_series_ring(R0, 10, "x") S, y = power_series_ring(ZZ, 10, "y") @@ -138,7 +138,7 @@ end end @testset "FqPolyRepRelPowerSeriesRingElem.rel_series" begin - R, a = finite_field(ZZ(23), 2, "a") + R, a = Native.finite_field(ZZ(23), 2, "a") f = rel_series(R, [1, 2, 3], 3, 5, 2, "y") @test isa(f, FqPolyRepRelPowerSeriesRingElem) @@ -181,7 +181,7 @@ end end @testset "FqPolyRepRelPowerSeriesRingElem.unary_ops" begin - R, t = finite_field(ZZRingElem(23), 5, "t") + R, t = Native.finite_field(ZZRingElem(23), 5, "t") S, x = power_series_ring(R, 30, "x") a = 2x + x^3 @@ -193,7 +193,7 @@ end end @testset "FqPolyRepRelPowerSeriesRingElem.binary_ops" begin - R, t = finite_field(ZZRingElem(23), 5, "t") + R, t = Native.finite_field(ZZRingElem(23), 5, "t") S, x = power_series_ring(R, 30, "x") a = 2x + x^3 @@ -331,7 +331,7 @@ end end @testset "FqPolyRepRelPowerSeriesRingElem.adhoc_binary_ops" begin - R, t = finite_field(ZZRingElem(23), 5, "t") + R, t = Native.finite_field(ZZRingElem(23), 5, "t") S, x = power_series_ring(R, 30, "x") a = 2x + x^3 @@ -349,7 +349,7 @@ end end @testset "FqPolyRepRelPowerSeriesRingElem.comparison" begin - R, t = finite_field(ZZRingElem(23), 5, "t") + R, t = Native.finite_field(ZZRingElem(23), 5, "t") S, x = power_series_ring(R, 30, "x") a = 2x + x^3 @@ -369,7 +369,7 @@ end end @testset "FqPolyRepRelPowerSeriesRingElem.adhoc_comparison" begin - R, t = finite_field(ZZRingElem(23), 5, "t") + R, t = Native.finite_field(ZZRingElem(23), 5, "t") S, x = power_series_ring(R, 30, "x") a = 2x + x^3 @@ -389,7 +389,7 @@ end end @testset "FqPolyRepRelPowerSeriesRingElem.powering" begin - R, t = finite_field(ZZRingElem(23), 5, "t") + R, t = Native.finite_field(ZZRingElem(23), 5, "t") S, x = power_series_ring(R, 30, "x") a = 2x + x^3 @@ -409,7 +409,7 @@ end end @testset "FqPolyRepRelPowerSeriesRingElem.shift" begin - R, t = finite_field(ZZRingElem(23), 5, "t") + R, t = Native.finite_field(ZZRingElem(23), 5, "t") S, x = power_series_ring(R, 30, "x") a = 2x + x^3 @@ -431,7 +431,7 @@ end end @testset "FqPolyRepRelPowerSeriesRingElem.truncation" begin - R, t = finite_field(ZZRingElem(23), 5, "t") + R, t = Native.finite_field(ZZRingElem(23), 5, "t") S, x = power_series_ring(R, 30, "x") a = 2x + x^3 @@ -451,7 +451,7 @@ end end @testset "FqPolyRepRelPowerSeriesRingElem.inversion" begin - R, t = finite_field(ZZRingElem(23), 5, "t") + R, t = Native.finite_field(ZZRingElem(23), 5, "t") S, x = power_series_ring(R, 30, "x") a = 1 + x + 2x^2 + O(x^5) @@ -463,7 +463,7 @@ end end @testset "FqPolyRepRelPowerSeriesRingElem.exact_division" begin - R, t = finite_field(ZZRingElem(23), 5, "t") + R, t = Native.finite_field(ZZRingElem(23), 5, "t") S, x = power_series_ring(R, 30, "x") a = x + x^3 @@ -481,7 +481,7 @@ end end @testset "FqPolyRepRelPowerSeriesRingElem.adhoc_exact_division" begin - R, t = finite_field(ZZRingElem(23), 5, "t") + R, t = Native.finite_field(ZZRingElem(23), 5, "t") S, x = power_series_ring(R, 30, "x") a = x + x^3 @@ -503,7 +503,7 @@ end end @testset "FqPolyRepRelPowerSeriesRingElem.square_root" begin - S, t = finite_field(ZZRingElem(31), 5, "t") + S, t = Native.finite_field(ZZRingElem(31), 5, "t") R, x = power_series_ring(S, 30, "x") for iter = 1:300 @@ -513,7 +513,7 @@ end end for p in [2, 7, 19, 65537] - R, t = finite_field(ZZRingElem(p), 2, "t") + R, t = Native.finite_field(ZZRingElem(p), 2, "t") S, x = power_series_ring(R, 10, "x") @@ -544,7 +544,7 @@ end end @testset "FqPolyRepRelPowerSeriesRingElem.special_functions" begin - R, t = finite_field(ZZRingElem(23), 5, "t") + R, t = Native.finite_field(ZZRingElem(23), 5, "t") S, x = power_series_ring(R, 30, "x") @test isequal(exp(x + O(x^10)), 18*x^9+x^8+8*x^7+10*x^6+14*x^5+x^4+4*x^3+12*x^2+x+1+O(x^10)) @@ -553,7 +553,7 @@ end end @testset "FqPolyRepRelPowerSeriesRingElem.unsafe_operators" begin - S, t = finite_field(ZZRingElem(23), 5, "t") + S, t = Native.finite_field(ZZRingElem(23), 5, "t") R, x = power_series_ring(S, 30, "x") for iter = 1:300 diff --git a/test/flint/gfp-test.jl b/test/flint/gfp-test.jl index a20ea8f41f..f77ec5b585 100644 --- a/test/flint/gfp-test.jl +++ b/test/flint/gfp-test.jl @@ -5,14 +5,14 @@ end @testset "gfp.conformance_tests" begin # TODO: make this work with test_Field_interface_recursive for p in [13, next_prime(2^8), next_prime(2^16), next_prime(2^32)] - test_Field_interface(GF(p)) + test_Field_interface(Native.GF(p)) end end @testset "gfp.constructors" begin - R = GF(13) + R = Native.GF(13) - @test_throws DomainError GF(-13) + @test_throws DomainError Native.GF(-13) @test elem_type(R) == Nemo.fpFieldElem @test elem_type(Nemo.fpField) == Nemo.fpFieldElem @@ -38,7 +38,7 @@ end p = rand(UInt(1):typemax(UInt)) if Nemo.is_prime(ZZ(p)) - R = GF(p) + R = Native.GF(p) a = R(rand(Int)) d = a.data @@ -50,7 +50,7 @@ end for i = 1:1000 p = rand(1:24) if Nemo.is_prime(ZZ(p)) - R = GF(p) + R = Native.GF(p) a = R(rand(Int)) d = a.data @@ -59,28 +59,28 @@ end end end - S = GF(17) - T = GF(17) + S = Native.GF(17) + T = Native.GF(17) @test T === S - S = GF(19, cached = false) - T = GF(19, cached = false) + S = Native.GF(19, cached = false) + T = Native.GF(19, cached = false) @test !(S === T) - S = GF(ZZRingElem(17)) - T = GF(ZZRingElem(17)) + S = Native.GF(ZZRingElem(17)) + T = Native.GF(ZZRingElem(17)) @test T === S - S = GF(ZZRingElem(19), cached = false) - T = GF(ZZRingElem(19), cached = false) + S = Native.GF(ZZRingElem(19), cached = false) + T = Native.GF(ZZRingElem(19), cached = false) @test !(S === T) - @test_throws MethodError GF(big(3)) - @test_throws MethodError GF(0x3) + @test_throws MethodError Native.GF(big(3)) + @test_throws MethodError Native.GF(0x3) end @testset "gfp.rand" begin - R = GF(13) + R = Native.GF(13) test_rand(R) test_rand(R, 1:9) @@ -94,14 +94,14 @@ end end @testset "gfp.printing" begin - R = GF(13) + R = Native.GF(13) @test string(R(3)) == "3" @test string(R()) == "0" end @testset "gfp.manipulation" begin - R = GF(13) + R = Native.GF(13) @test iszero(zero(R)) @@ -112,7 +112,7 @@ end @test deepcopy(R(3)) == R(3) - R1 = GF(13) + R1 = Native.GF(13) @test R === R1 @@ -123,8 +123,8 @@ end @test lift(R(3)) == 3 @test isa(lift(R(3)), ZZRingElem) - R2 = GF(2) - R3 = GF(3) + R2 = Native.GF(2) + R3 = Native.GF(3) R6 = residue_ring(ZZ, 6) R66 = residue_ring(ZZ, ZZ(6)) @test R2(R6(2)) == 2 && parent(R2(R6(2))) == R2 @@ -142,7 +142,7 @@ end for i = 1:100 p = rand(UInt(1):typemax(UInt)) if Nemo.is_prime(ZZ(p)) - R = GF(p) + R = Native.GF(p) for iter = 1:100 a = rand(R) @@ -155,7 +155,7 @@ end for i = 1:100 p = rand(1:24) if Nemo.is_prime(ZZ(p)) - R = GF(p) + R = Native.GF(p) for iter = 1:100 a = rand(R) @@ -170,7 +170,7 @@ end for i = 1:100 p = rand(1:24) if Nemo.is_prime(ZZ(p)) - R = GF(p) + R = Native.GF(p) for iter = 1:100 a1 = rand(R) @@ -192,7 +192,7 @@ end for i = 1:100 p = rand(UInt(1):typemax(UInt)) if Nemo.is_prime(ZZ(p)) - R = GF(p) + R = Native.GF(p) for iter = 1:100 a1 = rand(R) @@ -216,7 +216,7 @@ end for i = 1:100 p = rand(1:24) if Nemo.is_prime(ZZ(p)) - R = GF(p) + R = Native.GF(p) for iter = 1:100 a = rand(R) @@ -241,7 +241,7 @@ end for i = 1:100 p = rand(UInt(1):typemax(UInt)) if Nemo.is_prime(ZZ(p)) - R = GF(p) + R = Native.GF(p) for iter = 1:100 a = rand(R) @@ -268,7 +268,7 @@ end for i = 1:100 p = rand(1:24) if Nemo.is_prime(ZZ(p)) - R = GF(p) + R = Native.GF(p) for iter = 1:100 a = R(1) @@ -304,7 +304,7 @@ end for i = 1:100 p = rand(UInt(1):typemax(UInt)) if Nemo.is_prime(ZZ(p)) - R = GF(p) + R = Native.GF(p) for iter = 1:100 a = R(1) @@ -342,7 +342,7 @@ end for i = 1:100 p = rand(1:24) if Nemo.is_prime(ZZ(p)) - R = GF(p) + R = Native.GF(p) for iter = 1:100 a = rand(R) @@ -361,7 +361,7 @@ end for i = 1:100 p = rand(UInt(1):typemax(UInt)) if Nemo.is_prime(ZZ(p)) - R = GF(p) + R = Native.GF(p) for iter = 1:100 a = rand(R) @@ -382,7 +382,7 @@ end for i = 1:100 p = rand(1:24) if Nemo.is_prime(ZZ(p)) - R = GF(p) + R = Native.GF(p) for iter = 1:100 c = rand(0:100) @@ -399,7 +399,7 @@ end for i = 1:100 p = rand(UInt(1):typemax(UInt)) if Nemo.is_prime(ZZ(p)) - R = GF(p) + R = Native.GF(p) for iter = 1:100 c = rand(Int) @@ -418,7 +418,7 @@ end for i = 1:100 p = rand(1:24) if Nemo.is_prime(ZZ(p)) - R = GF(p) + R = Native.GF(p) for iter = 1:100 a = rand(R) @@ -433,7 +433,7 @@ end for i = 1:100 p = rand(UInt(1):typemax(UInt)) if Nemo.is_prime(ZZ(p)) - R = GF(p) + R = Native.GF(p) for iter = 1:100 a = rand(R) @@ -450,7 +450,7 @@ end for i = 1:100 p = rand(1:24) if Nemo.is_prime(ZZ(p)) - R = GF(p) + R = Native.GF(p) for iter = 1:100 a1 = rand(R) @@ -469,7 +469,7 @@ end for i = 1:100 p = rand(UInt(1):typemax(UInt)) if Nemo.is_prime(ZZ(p)) - R = GF(p) + R = Native.GF(p) for iter = 1:100 a1 = rand(R) @@ -489,7 +489,7 @@ end for i = 1:100 p = rand(1:65537) if Nemo.is_prime(ZZ(p)) - R = GF(p) + R = Native.GF(p) z = rand(R) if p != 2 @@ -524,6 +524,6 @@ end end @testset "gfp.overload" begin - R = GF(19) + R = Native.GF(19) @test R([5]) == R(5) end diff --git a/test/flint/gfp_abs_series-test.jl b/test/flint/gfp_abs_series-test.jl index d22596fffb..e6ed6fd3d0 100644 --- a/test/flint/gfp_abs_series-test.jl +++ b/test/flint/gfp_abs_series-test.jl @@ -3,7 +3,7 @@ end @testset "fpAbsPowerSeriesRingElem.constructors" begin - S = GF(23) + S = Native.GF(23) R1 = AbsPowerSeriesRing(S, 30) R2 = AbsPowerSeriesRing(S, 30) @@ -36,7 +36,7 @@ end end @testset "fpAbsPowerSeriesRingElem.printing" begin - S = GF(23) + S = Native.GF(23) R, x = power_series_ring(S, 30, "x", model=:capped_absolute) b = x^2 + 3x + O(x^4) @@ -45,7 +45,7 @@ end end @testset "fpAbsPowerSeriesRingElem.manipulation" begin - S = GF(23) + S = Native.GF(23) R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -67,7 +67,7 @@ end end @testset "fpAbsPowerSeriesRingElem.similar" begin - R0 = GF(23) + R0 = Native.GF(23) R, x = power_series_ring(R0, 10, "x"; model=:capped_absolute) S, y = power_series_ring(ZZ, 10, "y"; model=:capped_absolute) @@ -115,7 +115,7 @@ end end @testset "fpAbsPowerSeriesRingElem.abs_series" begin - R = GF(23) + R = Native.GF(23) f = abs_series(R, [1, 2, 3], 3, 5, "y") @test isa(f, fpAbsPowerSeriesRingElem) @@ -158,7 +158,7 @@ end end @testset "fpAbsPowerSeriesRingElem.unary_ops" begin - S = GF(23) + S = Native.GF(23) R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -170,7 +170,7 @@ end end @testset "fpAbsPowerSeriesRingElem.binary_ops" begin - S = GF(23) + S = Native.GF(23) R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -190,7 +190,7 @@ end end @testset "fpAbsPowerSeriesRingElem.adhoc_binary_ops" begin - S = GF(23) + S = Native.GF(23) R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -208,7 +208,7 @@ end end @testset "fpAbsPowerSeriesRingElem.comparison" begin - S = GF(23) + S = Native.GF(23) R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -224,7 +224,7 @@ end end @testset "fpAbsPowerSeriesRingElem.adhoc_comparison" begin - S = GF(23) + S = Native.GF(23) R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -244,7 +244,7 @@ end end @testset "fpAbsPowerSeriesRingElem.powering" begin - S = GF(23) + S = Native.GF(23) R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -264,7 +264,7 @@ end end @testset "fpAbsPowerSeriesRingElem.shift" begin - S = GF(23) + S = Native.GF(23) R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -286,7 +286,7 @@ end end @testset "fpAbsPowerSeriesRingElem.truncation" begin - S = GF(23) + S = Native.GF(23) R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -307,7 +307,7 @@ end end @testset "fpAbsPowerSeriesRingElem.exact_division" begin - S = GF(23) + S = Native.GF(23) R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = x + x^3 @@ -325,7 +325,7 @@ end end @testset "fpAbsPowerSeriesRingElem.adhoc_exact_division" begin - S = GF(23) + S = Native.GF(23) R, x = power_series_ring(ZZ, 30, "x", model=:capped_absolute) a = x + x^3 @@ -345,7 +345,7 @@ end end @testset "fpAbsPowerSeriesRingElem.inversion" begin - S = GF(23) + S = Native.GF(23) R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 1 + x + 2x^2 + O(x^5) @@ -357,7 +357,7 @@ end end @testset "fpAbsPowerSeriesRingElem.integral_derivative" begin - S = GF(31) + S = Native.GF(31) R, x = power_series_ring(S, 10, "x"; model=:capped_absolute) for iter = 1:100 @@ -368,7 +368,7 @@ end end @testset "fpAbsPowerSeriesRingElem.square_root" begin - S = GF(31) + S = Native.GF(31) R, x = power_series_ring(S, 30, "x", model=:capped_absolute) for iter = 1:300 @@ -378,7 +378,7 @@ end end for p in [2, 7, 19, 65537] - R = GF(p) + R = Native.GF(p) S, x = power_series_ring(R, 10, "x", model=:capped_absolute) @@ -413,7 +413,7 @@ end end @testset "fpAbsPowerSeriesRingElem.unsafe_operators" begin - S = GF(31) + S = Native.GF(31) R, x = power_series_ring(S, 30, "x", model=:capped_absolute) for iter = 1:300 diff --git a/test/flint/gfp_fmpz-test.jl b/test/flint/gfp_fmpz-test.jl index 6eb0e8e336..be949dd1c8 100644 --- a/test/flint/gfp_fmpz-test.jl +++ b/test/flint/gfp_fmpz-test.jl @@ -1,7 +1,7 @@ @testset "gfp_fmpz.constructors" begin - R = GF(ZZ(13)) + R = Native.GF(ZZ(13)) - @test_throws DomainError GF(-ZZ(13)) + @test_throws DomainError Native.GF(-ZZ(13)) @test elem_type(R) == Nemo.FpFieldElem @test elem_type(Nemo.FpField) == Nemo.FpFieldElem @@ -22,7 +22,7 @@ for i = 1:1000 p = rand(BigInt(1):BigInt(4273673264873254848326487))*6 + 1 if Nemo.is_probable_prime(ZZ(p)) - R = GF(ZZ(p)) + R = Native.GF(ZZ(p)) a = R(rand(Int)) d = a.data @@ -34,7 +34,7 @@ for i = 1:1000 p = rand(1:24) if Nemo.is_prime(ZZ(p)) - R = GF(ZZ(p)) + R = Native.GF(ZZ(p)) a = R(rand(Int)) d = a.data @@ -43,25 +43,25 @@ end end - S = GF(ZZ(17)) - T = GF(ZZ(17)) + S = Native.GF(ZZ(17)) + T = Native.GF(ZZ(17)) @test T === S - S = GF(ZZ(19), cached = false) - T = GF(ZZ(19), cached = false) + S = Native.GF(ZZ(19), cached = false) + T = Native.GF(ZZ(19), cached = false) @test !(S === T) - S = GF(ZZRingElem(17)) - T = GF(ZZRingElem(17)) + S = Native.GF(ZZRingElem(17)) + T = Native.GF(ZZRingElem(17)) @test T === S - S = GF(ZZRingElem(19), cached = false) - T = GF(ZZRingElem(19), cached = false) + S = Native.GF(ZZRingElem(19), cached = false) + T = Native.GF(ZZRingElem(19), cached = false) @test !(S === T) end @testset "gfp_fmpz.rand" begin - R = GF(ZZ(13)) + R = Native.GF(ZZ(13)) test_rand(R) test_rand(R, 1:9) @@ -75,14 +75,14 @@ end end @testset "gfp_fmpz.printing" begin - R = GF(ZZ(13)) + R = Native.GF(ZZ(13)) @test string(R(3)) == "3" @test string(R()) == "0" end @testset "gfp_fmpz.manipulation" begin - R = GF(ZZ(13)) + R = Native.GF(ZZ(13)) @test iszero(zero(R)) @@ -93,7 +93,7 @@ end @test deepcopy(R(3)) == R(3) - R1 = GF(ZZ(13)) + R1 = Native.GF(ZZ(13)) @test R === R1 @@ -105,9 +105,9 @@ end @test lift(R(3)) == 3 @test isa(lift(R(3)), ZZRingElem) - R2 = GF(ZZ(2)) - R22 = GF(2) - R3 = GF(ZZ(3)) + R2 = Native.GF(ZZ(2)) + R22 = Native.GF(2) + R3 = Native.GF(ZZ(3)) R6 = residue_ring(ZZ, ZZ(6)) @test R2(R6(2)) == 2 && parent(R2(R6(2))) == R2 @test R22(R6(2)) == 2 && parent(R22(R6(2))) == R22 @@ -123,7 +123,7 @@ end for i = 1:1000 p = rand(BigInt(1):BigInt(4273673264873254848326487))*6 + 1 if Nemo.is_probable_prime(ZZ(p)) - R = GF(ZZ(p)) + R = Native.GF(ZZ(p)) for iter = 1:1000 a = rand(R) @@ -136,7 +136,7 @@ end for i = 1:100 p = rand(1:24) if Nemo.is_prime(ZZ(p)) - R = GF(ZZ(p)) + R = Native.GF(ZZ(p)) for iter = 1:100 a = rand(R) @@ -151,7 +151,7 @@ end for i = 1:100 p = rand(1:24) if Nemo.is_prime(ZZ(p)) - R = GF(ZZ(p)) + R = Native.GF(ZZ(p)) for iter = 1:100 a1 = rand(R) @@ -173,7 +173,7 @@ end for i = 1:1000 p = rand(BigInt(1):BigInt(4273673264873254848326487))*6 + 1 if Nemo.is_probable_prime(ZZ(p)) - R = GF(ZZ(p)) + R = Native.GF(ZZ(p)) for iter = 1:100 a1 = rand(R) @@ -197,7 +197,7 @@ end for i = 1:100 p = rand(1:24) if Nemo.is_prime(ZZ(p)) - R = GF(ZZ(p)) + R = Native.GF(ZZ(p)) for iter = 1:100 a = rand(R) @@ -222,7 +222,7 @@ end for i = 1:1000 p = rand(BigInt(1):BigInt(4273673264873254848326487))*6 + 1 if Nemo.is_probable_prime(ZZ(p)) - R = GF(ZZ(p)) + R = Native.GF(ZZ(p)) for iter = 1:100 a = rand(R) @@ -249,7 +249,7 @@ end for i = 1:100 p = rand(1:24) if Nemo.is_prime(ZZ(p)) - R = GF(ZZ(p)) + R = Native.GF(ZZ(p)) for iter = 1:100 a = R(1) @@ -285,7 +285,7 @@ end for i = 1:1000 p = rand(BigInt(1):BigInt(4273673264873254848326487))*6 + 1 if Nemo.is_probable_prime(ZZ(p)) - R = GF(ZZ(p)) + R = Native.GF(ZZ(p)) for iter = 1:100 a = R(1) @@ -318,7 +318,7 @@ end end end - R = GF(ZZ(23)) + R = Native.GF(ZZ(23)) a = R(11) @@ -331,7 +331,7 @@ end for i = 1:100 p = rand(1:24) if Nemo.is_prime(ZZ(p)) - R = GF(ZZ(p)) + R = Native.GF(ZZ(p)) for iter = 1:100 a = rand(R) @@ -350,7 +350,7 @@ end for i = 1:1000 p = rand(BigInt(1):BigInt(4273673264873254848326487))*6 + 1 if Nemo.is_probable_prime(ZZ(p)) - R = GF(ZZ(p)) + R = Native.GF(ZZ(p)) for iter = 1:100 a = rand(R) @@ -371,7 +371,7 @@ end for i = 1:100 p = rand(1:24) if Nemo.is_prime(ZZ(p)) - R = GF(ZZ(p)) + R = Native.GF(ZZ(p)) for iter = 1:100 c = rand(0:100) @@ -388,7 +388,7 @@ end for i = 1:1000 p = rand(BigInt(1):BigInt(4273673264873254848326487))*6 + 1 if Nemo.is_probable_prime(ZZ(p)) - R = GF(ZZ(p)) + R = Native.GF(ZZ(p)) for iter = 1:100 c = rand(Int) @@ -407,7 +407,7 @@ end for i = 1:100 p = rand(1:24) if Nemo.is_prime(ZZ(p)) - R = GF(ZZ(p)) + R = Native.GF(ZZ(p)) for iter = 1:100 a = rand(R) @@ -422,7 +422,7 @@ end for i = 1:1000 p = rand(BigInt(1):BigInt(4273673264873254848326487))*6 + 1 if Nemo.is_probable_prime(ZZ(p)) - R = GF(ZZ(p)) + R = Native.GF(ZZ(p)) for iter = 1:100 a = rand(R) @@ -439,7 +439,7 @@ end for i = 1:100 p = rand(1:24) if Nemo.is_prime(ZZ(p)) - R = GF(ZZ(p)) + R = Native.GF(ZZ(p)) for iter = 1:100 a1 = rand(R) @@ -461,7 +461,7 @@ end for i = 1:1000 p = rand(BigInt(1):BigInt(4273673264873254848326487))*6 + 1 if Nemo.is_probable_prime(ZZ(p)) - R = GF(ZZ(p)) + R = Native.GF(ZZ(p)) for iter = 1:100 a1 = rand(R) @@ -481,7 +481,7 @@ end for i = 1:100 p = rand(1:65537) if Nemo.is_prime(ZZ(p)) - R = GF(ZZ(p)) + R = Native.GF(ZZ(p)) z = rand(R) if p != 2 @@ -516,6 +516,6 @@ end end @testset "gfp_fmpz.overload" begin - R = GF(ZZ(19)) + R = Native.GF(ZZ(19)) @test R([5]) == R(5) end diff --git a/test/flint/gfp_fmpz_abs_series-test.jl b/test/flint/gfp_fmpz_abs_series-test.jl index 4ce2711b39..55d85d5172 100644 --- a/test/flint/gfp_fmpz_abs_series-test.jl +++ b/test/flint/gfp_fmpz_abs_series-test.jl @@ -3,7 +3,7 @@ end @testset "FpAbsPowerSeriesRingElem.constructors" begin - S = GF(ZZ(123456789012345678949)) + S = Native.GF(ZZ(123456789012345678949)) R1 = AbsPowerSeriesRing(S, 30) R2 = AbsPowerSeriesRing(S, 30) @@ -36,7 +36,7 @@ end end @testset "FpAbsPowerSeriesRingElem.printing" begin - S = GF(ZZ(123456789012345678949)) + S = Native.GF(ZZ(123456789012345678949)) R, x = power_series_ring(S, 30, "x", model=:capped_absolute) b = x^2 + 3x + O(x^4) @@ -45,7 +45,7 @@ end end @testset "FpAbsPowerSeriesRingElem.manipulation" begin - S = GF(ZZ(123456789012345678949)) + S = Native.GF(ZZ(123456789012345678949)) R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -67,7 +67,7 @@ end end @testset "FpAbsPowerSeriesRingElem.similar" begin - R0 = GF(ZZ(23)) + R0 = Native.GF(ZZ(23)) R, x = power_series_ring(R0, 10, "x"; model=:capped_absolute) S, y = power_series_ring(ZZ, 10, "y"; model=:capped_absolute) @@ -115,7 +115,7 @@ end end @testset "FpAbsPowerSeriesRingElem.abs_series" begin - R = GF(ZZ(23)) + R = Native.GF(ZZ(23)) f = abs_series(R, [1, 2, 3], 3, 5, "y") @test isa(f, FpAbsPowerSeriesRingElem) @@ -158,7 +158,7 @@ end end @testset "FpAbsPowerSeriesRingElem.unary_ops" begin - S = GF(ZZ(123456789012345678949)) + S = Native.GF(ZZ(123456789012345678949)) R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -170,7 +170,7 @@ end end @testset "FpAbsPowerSeriesRingElem.binary_ops" begin - S = GF(ZZ(123456789012345678949)) + S = Native.GF(ZZ(123456789012345678949)) R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -190,7 +190,7 @@ end end @testset "FpAbsPowerSeriesRingElem.adhoc_binary_ops" begin - S = GF(ZZ(123456789012345678949)) + S = Native.GF(ZZ(123456789012345678949)) R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -208,7 +208,7 @@ end end @testset "FpAbsPowerSeriesRingElem.comparison" begin - S = GF(ZZ(123456789012345678949)) + S = Native.GF(ZZ(123456789012345678949)) R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -224,7 +224,7 @@ end end @testset "FpAbsPowerSeriesRingElem.adhoc_comparison" begin - S = GF(ZZ(123456789012345678949)) + S = Native.GF(ZZ(123456789012345678949)) R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -244,7 +244,7 @@ end end @testset "FpAbsPowerSeriesRingElem.powering" begin - S = GF(ZZ(123456789012345678949)) + S = Native.GF(ZZ(123456789012345678949)) R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -261,7 +261,7 @@ end end @testset "FpAbsPowerSeriesRingElem.shift" begin - S = GF(ZZ(123456789012345678949)) + S = Native.GF(ZZ(123456789012345678949)) R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -283,7 +283,7 @@ end end @testset "FpAbsPowerSeriesRingElem.truncation" begin - S = GF(ZZ(123456789012345678949)) + S = Native.GF(ZZ(123456789012345678949)) R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 2x + x^3 @@ -304,7 +304,7 @@ end end @testset "FpAbsPowerSeriesRingElem.exact_division" begin - S = GF(ZZ(123456789012345678949)) + S = Native.GF(ZZ(123456789012345678949)) R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = x + x^3 @@ -322,7 +322,7 @@ end end @testset "FpAbsPowerSeriesRingElem.adhoc_exact_division" begin - S = GF(ZZ(123456789012345678949)) + S = Native.GF(ZZ(123456789012345678949)) R, x = power_series_ring(ZZ, 30, "x", model=:capped_absolute) a = x + x^3 @@ -342,7 +342,7 @@ end end @testset "FpAbsPowerSeriesRingElem.inversion" begin - S = GF(ZZ(123456789012345678949)) + S = Native.GF(ZZ(123456789012345678949)) R, x = power_series_ring(S, 30, "x", model=:capped_absolute) a = 1 + x + 2x^2 + O(x^5) @@ -354,7 +354,7 @@ end end @testset "FpAbsPowerSeriesRingElem.integral_derivative" begin - S = GF(ZZ(31)) + S = Native.GF(ZZ(31)) R, x = power_series_ring(S, 10, "x"; model=:capped_absolute) for iter = 1:100 @@ -365,7 +365,7 @@ end end @testset "FpAbsPowerSeriesRingElem.square_root" begin - S = GF(ZZ(31)) + S = Native.GF(ZZ(31)) R, x = power_series_ring(S, 30, "x", model=:capped_absolute) for iter = 1:300 @@ -375,7 +375,7 @@ end end for p in [2, 7, 19, 65537] - R = GF(ZZ(p)) + R = Native.GF(ZZ(p)) S, x = power_series_ring(R, 10, "x", model=:capped_absolute) @@ -406,7 +406,7 @@ end end @testset "FpAbsPowerSeriesRingElem.unsafe_operators" begin - S = GF(ZZ(31)) + S = Native.GF(ZZ(31)) R, x = power_series_ring(S, 30, "x", model=:capped_absolute) for iter = 1:300 diff --git a/test/flint/gfp_fmpz_mat-test.jl b/test/flint/gfp_fmpz_mat-test.jl index 3a0ad2aa2d..72ed3f16e9 100644 --- a/test/flint/gfp_fmpz_mat-test.jl +++ b/test/flint/gfp_fmpz_mat-test.jl @@ -1,6 +1,6 @@ @testset "FpMatrix.constructors" begin - Z2 = GF(ZZ(2)) - Z3 = GF(ZZ(3)) + Z2 = Native.GF(ZZ(2)) + Z3 = Native.GF(ZZ(3)) R = FpMatrixSpace(Z2, 2, 2) @@ -142,7 +142,7 @@ end @testset "FpMatrix.similar" begin - Z13 = GF(ZZ(13)) + Z13 = Native.GF(ZZ(13)) S = FpMatrixSpace(Z13, 2, 2) s = S(ZZRingElem(3)) @@ -164,7 +164,7 @@ end end @testset "FpMatrix.printing" begin - Z2 = GF(ZZ(2)) + Z2 = Native.GF(ZZ(2)) R = FpMatrixSpace(Z2, 2, 2) a = R(1) @@ -174,9 +174,9 @@ end end @testset "FpMatrix.manipulation" begin - Z11 = GF(ZZ(11)) + Z11 = Native.GF(ZZ(11)) R = FpMatrixSpace(Z11, 2, 2) - Z23 = GF(ZZ(23)) + Z23 = Native.GF(ZZ(23)) S = FpMatrixSpace(Z23, 2, 2) ar = [ 1 2; 3 4] @@ -225,7 +225,7 @@ end @test iszero(e) - @test_throws ErrorException one(matrix_space(GF(ZZ(2)), 1, 2)) + @test_throws ErrorException one(matrix_space(Native.GF(ZZ(2)), 1, 2)) @test is_square(a) @@ -256,11 +256,11 @@ end end @testset "FpMatrix.unary_ops" begin - Z17 = GF(ZZ(17)) + Z17 = Native.GF(ZZ(17)) R = matrix_space(Z17, 3, 4) RR = matrix_space(Z17, 4, 3) - Z2 = GF(ZZ(2)) + Z2 = Native.GF(ZZ(2)) S = matrix_space(Z2, 3, 4) a = R([ 1 2 3 1; 3 2 1 2; 1 3 2 0]) @@ -275,7 +275,7 @@ end end @testset "FpMatrix.binary_ops" begin - Z17 = GF(ZZ(17)) + Z17 = Native.GF(ZZ(17)) R = matrix_space(Z17, 3, 4) a = R([ 1 2 3 1; 3 2 1 2; 1 3 2 0]) @@ -299,7 +299,7 @@ end end @testset "FpMatrix.row_col_swapping" begin - R = GF(ZZ(17)) + R = Native.GF(ZZ(17)) a = matrix(R, [1 2; 3 4; 5 6]) @@ -338,10 +338,10 @@ end end @testset "FpMatrix.adhoc_binary" begin - Z17 = GF(ZZ(17)) + Z17 = Native.GF(ZZ(17)) R = matrix_space(Z17, 3, 4) - Z2 = GF(ZZ(2)) + Z2 = Native.GF(ZZ(2)) a = R([ 1 2 3 1; 3 2 1 2; 1 3 2 0]) @@ -377,7 +377,7 @@ end end @testset "FpMatrix.comparison" begin - Z17 = GF(ZZ(17)) + Z17 = Native.GF(ZZ(17)) R = matrix_space(Z17, 3, 4) @@ -391,7 +391,7 @@ end end @testset "FpMatrix.adhoc_comparison" begin - Z17 = GF(ZZ(17)) + Z17 = Native.GF(ZZ(17)) R = matrix_space(Z17, 3, 4) @@ -405,7 +405,7 @@ end end @testset "FpMatrix.powering" begin - Z17 = GF(ZZ(17)) + Z17 = Native.GF(ZZ(17)) R = matrix_space(Z17, 3, 4) @@ -425,10 +425,10 @@ end end @testset "FpMatrix.row_echelon_form" begin - Z17 = GF(ZZ(17)) + Z17 = Native.GF(ZZ(17)) R = matrix_space(Z17, 3, 4) RR = matrix_space(Z17, 4, 3) - Z2 = GF(ZZ(2)) + Z2 = Native.GF(ZZ(2)) S = matrix_space(Z2, 3, 4) a = R([ 1 2 3 1; 3 2 1 2; 1 3 2 0]) @@ -459,10 +459,10 @@ end end @testset "FpMatrix.trace_det" begin - Z17 = GF(ZZ(17)) + Z17 = Native.GF(ZZ(17)) R = matrix_space(Z17, 3, 4) RR = matrix_space(Z17, 4, 3) - Z2 = GF(ZZ(2)) + Z2 = Native.GF(ZZ(2)) S = matrix_space(Z2, 3, 4) a = R([ 1 2 3 1; 3 2 1 2; 1 3 2 0]) @@ -491,10 +491,10 @@ end end @testset "FpMatrix.rank" begin - Z17 = GF(ZZ(17)) + Z17 = Native.GF(ZZ(17)) R = matrix_space(Z17, 3, 4) RR = matrix_space(Z17, 4, 3) - Z2 = GF(ZZ(2)) + Z2 = Native.GF(ZZ(2)) S = matrix_space(Z2, 3, 4) a = R([ 1 2 3 1; 3 2 1 2; 1 3 2 0]) @@ -517,10 +517,10 @@ end end @testset "FpMatrix.inv" begin - Z17 = GF(ZZ(17)) + Z17 = Native.GF(ZZ(17)) R = matrix_space(Z17, 3, 4) RR = matrix_space(Z17, 4, 3) - Z2 = GF(ZZ(2)) + Z2 = Native.GF(ZZ(2)) S = matrix_space(Z2, 3, 4) a = R([ 1 2 3 1; 3 2 1 2; 1 3 2 0]) @@ -540,7 +540,7 @@ end @testset "FpMatrix.swap_rows" begin - Z17 = GF(ZZ(17)) + Z17 = Native.GF(ZZ(17)) A = matrix(Z17, 5, 1, [1, 2, 3, 4, 5]) @@ -555,7 +555,7 @@ end end @testset "FpMatrix.view" begin - Z17 = GF(ZZ(17)) + Z17 = Native.GF(ZZ(17)) R = matrix_space(Z17, 3, 3) S = matrix_space(Z17, 3, 4) @@ -614,7 +614,7 @@ end end @testset "FpMatrix.sub" begin - Z17 = GF(ZZ(17)) + Z17 = Native.GF(ZZ(17)) S = matrix_space(Z17, 3, 3) A = S([1 2 3; 4 5 6; 7 8 9]) @@ -638,7 +638,7 @@ end end @testset "FpMatrix.concatenation" begin - Z17 = GF(ZZ(17)) + Z17 = Native.GF(ZZ(17)) R = matrix_space(Z17, 3, 3) S = matrix_space(Z17, 3, 4) @@ -674,7 +674,7 @@ end end @testset "FpMatrix.conversion" begin - Z17 = GF(ZZ(17)) + Z17 = Native.GF(ZZ(17)) R = matrix_space(Z17, 3, 3) S = matrix_space(ZZ, 3, 3) @@ -700,7 +700,7 @@ end end @testset "FpMatrix.charpoly" begin - R = GF(ZZ(17)) + R = Native.GF(ZZ(17)) for dim = 0:5 S = matrix_space(R, dim, dim) @@ -718,7 +718,7 @@ end end @testset "FpMatrix.rand" begin - R = GF(ZZ(17)) + R = Native.GF(ZZ(17)) S = matrix_space(R, 3, 3) M = rand(S, 1:5) diff --git a/test/flint/gfp_fmpz_mpoly-test.jl b/test/flint/gfp_fmpz_mpoly-test.jl index 4d81abf4c2..3824997809 100644 --- a/test/flint/gfp_fmpz_mpoly-test.jl +++ b/test/flint/gfp_fmpz_mpoly-test.jl @@ -1,5 +1,5 @@ @testset "FpMPolyRingElem.constructors" begin - R = GF(ZZRingElem(23)) + R = Native.GF(ZZRingElem(23)) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -61,7 +61,7 @@ end @testset "FpMPolyRingElem.printing" begin - S, (x, y) = polynomial_ring(GF(ZZRingElem(23)), ["x", "y"]) + S, (x, y) = polynomial_ring(Native.GF(ZZRingElem(23)), ["x", "y"]) @test !occursin(r"{", string(S)) @@ -72,7 +72,7 @@ end end @testset "FpMPolyRingElem.manipulation" begin - R = GF(ZZRingElem(23)) + R = Native.GF(ZZRingElem(23)) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -210,7 +210,7 @@ end end @testset "FpMPolyRingElem.multivariate_coeff" begin - R = GF(ZZRingElem(23)) + R = Native.GF(ZZRingElem(23)) for ord in Nemo.flint_orderings S, (x, y, z) = polynomial_ring(R, ["x", "y", "z"]; ordering=ord) @@ -228,7 +228,7 @@ end end @testset "FpMPolyRingElem.unary_ops" begin - R = GF(ZZRingElem(23)) + R = Native.GF(ZZRingElem(23)) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -245,7 +245,7 @@ end end @testset "FpMPolyRingElem.binary_ops" begin - R = GF(ZZRingElem(23)) + R = Native.GF(ZZRingElem(23)) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -268,7 +268,7 @@ end end @testset "FpMPolyRingElem.adhoc_binary" begin - R = GF(ZZRingElem(23)) + R = Native.GF(ZZRingElem(23)) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -304,7 +304,7 @@ end end @testset "FpMPolyRingElem.adhoc_comparison" begin - R = GF(ZZRingElem(23)) + R = Native.GF(ZZRingElem(23)) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -326,7 +326,7 @@ end end @testset "FpMPolyRingElem.powering" begin - R = GF(ZZRingElem(23)) + R = Native.GF(ZZRingElem(23)) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -353,7 +353,7 @@ end end @testset "FpMPolyRingElem.divides" begin - R = GF(ZZRingElem(23)) + R = Native.GF(ZZRingElem(23)) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -387,7 +387,7 @@ end end @testset "FpMPolyRingElem.euclidean_division" begin - R = GF(ZZRingElem(23)) + R = Native.GF(ZZRingElem(23)) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -423,7 +423,7 @@ end end @testset "FpMPolyRingElem.ideal_reduction" begin - R = GF(ZZRingElem(23)) + R = Native.GF(ZZRingElem(23)) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -472,7 +472,7 @@ end end @testset "FpMPolyRingElem.gcd" begin - R = GF(ZZRingElem(23)) + R = Native.GF(ZZRingElem(23)) for num_vars = 1:4 var_names = ["x$j" for j in 1:num_vars] @@ -498,7 +498,7 @@ end end @testset "FpMPolyRingElem.factor" begin - R = GF(ZZRingElem(23)) + R = Native.GF(ZZRingElem(23)) R, (x, y, z) = polynomial_ring(R, ["x", "y", "z"]) @test_throws ArgumentError factor(R(0)) @@ -520,7 +520,7 @@ end end @testset "FpMPolyRingElem.sqrt" begin - R = GF(ZZRingElem(23)) + R = Native.GF(ZZRingElem(23)) for num_vars = 1:4 var_names = ["x$j" for j in 1:num_vars] @@ -546,7 +546,7 @@ end end @testset "FpMPolyRingElem.evaluation" begin - R = GF(ZZRingElem(23)) + R = Native.GF(ZZRingElem(23)) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -607,7 +607,7 @@ end end @testset "FpMPolyRingElem.valuation" begin - R = GF(ZZRingElem(23)) + R = Native.GF(ZZRingElem(23)) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -645,7 +645,7 @@ end end @testset "FpMPolyRingElem.derivative" begin - R = GF(ZZRingElem(23)) + R = Native.GF(ZZRingElem(23)) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -665,7 +665,7 @@ end end @testset "FpMPolyRingElem.unsafe" begin - R23 = GF(ZZRingElem(23)) + R23 = Native.GF(ZZRingElem(23)) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -723,7 +723,7 @@ end end @testset "FpMPolyRingElem.exponents" begin - R23 = GF(ZZRingElem(23)) + R23 = Native.GF(ZZRingElem(23)) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -798,7 +798,7 @@ end end @testset "FpMPolyRingElem.promote_rule" begin - R = GF(ZZRingElem(2)) + R = Native.GF(ZZRingElem(2)) Rx, (x, ) = polynomial_ring(R, ["x"]) Sy, (y, ) = polynomial_ring(Rx, ["y"]) @test y == @inferred (R(1) * y) diff --git a/test/flint/gfp_fmpz_poly-test.jl b/test/flint/gfp_fmpz_poly-test.jl index 693917bfb4..6efaa05def 100644 --- a/test/flint/gfp_fmpz_poly-test.jl +++ b/test/flint/gfp_fmpz_poly-test.jl @@ -1,5 +1,5 @@ @testset "FpPolyRingElem.constructors" begin - R = GF(ZZRingElem(123456789012345678949)) + R = Native.GF(ZZRingElem(123456789012345678949)) S1 = PolyRing(R) S2 = PolyRing(R) @@ -61,7 +61,7 @@ end @testset "FpPolyRingElem.printing" begin - R = GF(ZZRingElem(123456789012345678949)) + R = Native.GF(ZZRingElem(123456789012345678949)) S, x = polynomial_ring(R, "x") f = x^3 + 2x^2 + x + 1 @@ -69,7 +69,7 @@ end end @testset "FpPolyRingElem.manipulation" begin - R = GF(ZZRingElem(123456789012345678949)) + R = Native.GF(ZZRingElem(123456789012345678949)) S, x = polynomial_ring(R, "x") @test iszero(zero(S)) @@ -116,7 +116,7 @@ end end @testset "FpPolyRingElem.polynomial" begin - R = GF(ZZ(23)) + R = Native.GF(ZZ(23)) f = polynomial(R, []) g = polynomial(R, [1, 2, 3]) @@ -136,7 +136,7 @@ end end @testset "FpPolyRingElem.similar" begin - R = GF(ZZ(23)) + R = Native.GF(ZZ(23)) f = polynomial(R, [1, 2, 3]) g = similar(f) @@ -151,7 +151,7 @@ end end @testset "FpPolyRingElem.binary_ops" begin - R = GF(ZZRingElem(123456789012345678949)) + R = Native.GF(ZZRingElem(123456789012345678949)) S, x = polynomial_ring(R, "x") f = x^2 + 2x + 1 @@ -165,7 +165,7 @@ end end @testset "FpPolyRingElem.adhoc_binary" begin - R = GF(ZZRingElem(123456789012345678949)) + R = Native.GF(ZZRingElem(123456789012345678949)) S, x = polynomial_ring(R, "x") f = x^2 + 2x + 1 @@ -209,7 +209,7 @@ end end @testset "FpPolyRingElem.comparison" begin - R = GF(ZZRingElem(123456789012345678949)) + R = Native.GF(ZZRingElem(123456789012345678949)) S, x = polynomial_ring(R, "x") f = x^2 + 2x + 1 @@ -221,7 +221,7 @@ end end @testset "FpPolyRingElem.adhoc_comparison" begin - R = GF(ZZRingElem(123456789012345678949)) + R = Native.GF(ZZRingElem(123456789012345678949)) S, x = polynomial_ring(R, "x") f = x^2 + 2x + 1 @@ -240,7 +240,7 @@ end end @testset "FpPolyRingElem.unary_ops" begin - R = GF(ZZRingElem(123456789012345678949)) + R = Native.GF(ZZRingElem(123456789012345678949)) S, x = polynomial_ring(R, "x") f = x^2 + 2x + 1 @@ -249,7 +249,7 @@ end end @testset "FpPolyRingElem.truncation" begin - R = GF(ZZRingElem(123456789012345678949)) + R = Native.GF(ZZRingElem(123456789012345678949)) S, x = polynomial_ring(R, "x") f = x^2 + 2x + 1 @@ -265,7 +265,7 @@ end end @testset "FpPolyRingElem.reverse" begin - R = GF(ZZRingElem(123456789012345678949)) + R = Native.GF(ZZRingElem(123456789012345678949)) S, x = polynomial_ring(R, "x") f = x^2 + 2x + 3 @@ -274,7 +274,7 @@ end end @testset "FpPolyRingElem.shift" begin - R = GF(ZZRingElem(123456789012345678949)) + R = Native.GF(ZZRingElem(123456789012345678949)) S, x = polynomial_ring(R, "x") f = x^2 + 2x + 1 @@ -289,7 +289,7 @@ end end @testset "FpPolyRingElem.powering" begin - R = GF(ZZRingElem(123456789012345678949)) + R = Native.GF(ZZRingElem(123456789012345678949)) S, x = polynomial_ring(R, "x") f = x^2 + 2x + 1 @@ -300,7 +300,7 @@ end end @testset "FpPolyRingElem.exact_division" begin - R = GF(ZZRingElem(123456789012345678949)) + R = Native.GF(ZZRingElem(123456789012345678949)) S, x = polynomial_ring(R, "x") f = x^2 + 2x + 1 @@ -310,7 +310,7 @@ end end @testset "FpPolyRingElem.adhoc_exact_division" begin - R = GF(ZZRingElem(123456789012345678949)) + R = Native.GF(ZZRingElem(123456789012345678949)) S, x = polynomial_ring(R, "x") f = x^2 + 2x + 1 @@ -323,7 +323,7 @@ end end @testset "FpPolyRingElem.modular_arithmetic" begin - R = GF(ZZRingElem(123456789012345678949)) + R = Native.GF(ZZRingElem(123456789012345678949)) S, x = polynomial_ring(R, "x") f = 3*x^2 + x + 2 @@ -344,7 +344,7 @@ end end @testset "FpPolyRingElem.euclidean_division" begin - R = GF(ZZRingElem(123456789012345678949)) + R = Native.GF(ZZRingElem(123456789012345678949)) S, x = polynomial_ring(R, "x") f = x^2 + 2x + 1 @@ -356,7 +356,7 @@ end end @testset "FpPolyRingElem.gcd" begin - R = GF(ZZRingElem(123456789012345678949)) + R = Native.GF(ZZRingElem(123456789012345678949)) S, x = polynomial_ring(R, "x") f = x^2 + 2x + 1 @@ -369,7 +369,7 @@ end end @testset "FpPolyRingElem.gcdinv" begin - R = GF(ZZRingElem(123456789012345678949)) + R = Native.GF(ZZRingElem(123456789012345678949)) S, x = polynomial_ring(R, "x") f = x^2 + 2x + 1 @@ -379,7 +379,7 @@ end end @testset "FpPolyRingElem.square_root" begin - for R in [GF(ZZ(2)), GF(ZZ(23))] + for R in [Native.GF(ZZ(2)), Native.GF(ZZ(23))] S, x = polynomial_ring(R, "x") for iter in 1:1000 @@ -413,7 +413,7 @@ end end @testset "FpPolyRingElem.evaluation" begin - R = GF(ZZRingElem(123456789012345678949)) + R = Native.GF(ZZRingElem(123456789012345678949)) S, x = polynomial_ring(R, "x") f = x^2 + 2x + 1 @@ -433,7 +433,7 @@ end end @testset "FpPolyRingElem.composition" begin - R = GF(ZZRingElem(123456789012345678949)) + R = Native.GF(ZZRingElem(123456789012345678949)) S, x = polynomial_ring(R, "x") f = x^2 + 2x + 1 @@ -443,7 +443,7 @@ end end @testset "FpPolyRingElem.derivative" begin - R = GF(ZZRingElem(123456789012345678949)) + R = Native.GF(ZZRingElem(123456789012345678949)) S, x = polynomial_ring(R, "x") f = x^2 + 2x + 1 @@ -452,7 +452,7 @@ end end @testset "FpPolyRingElem.integral" begin - R = GF(ZZRingElem(123456789012345678949)) + R = Native.GF(ZZRingElem(123456789012345678949)) S, x = polynomial_ring(R, "x") f = x^2 + 2x + 1 @@ -461,7 +461,7 @@ end end @testset "FpPolyRingElem.resultant" begin - R = GF(ZZRingElem(123456789012345678949)) + R = Native.GF(ZZRingElem(123456789012345678949)) S, x = polynomial_ring(R, "x") f = 5x^2 + 2x + 1 @@ -471,7 +471,7 @@ end end @testset "FpPolyRingElem.discriminant" begin - R = GF(ZZRingElem(123456789012345678949)) + R = Native.GF(ZZRingElem(123456789012345678949)) S, x = polynomial_ring(R, "x") f = x^2 + 2x + 1 @@ -480,7 +480,7 @@ end end @testset "FpPolyRingElem.lift" begin - R = GF(ZZRingElem(123456789012345678949)) + R = Native.GF(ZZRingElem(123456789012345678949)) S, x = polynomial_ring(R, "x") T, y = polynomial_ring(ZZ, "y") @@ -491,7 +491,7 @@ end end @testset "FpPolyRingElem.is_irreducible" begin - R = GF(ZZRingElem(123456789012345678949)) + R = Native.GF(ZZRingElem(123456789012345678949)) S, x = polynomial_ring(R, "x") f = x^2 + 2x + 1 @@ -500,27 +500,19 @@ end end @testset "FpPolyRingElem.is_squarefree" begin - R = GF(ZZRingElem(123456789012345678949)) - Rx, x = polynomial_ring(R, "x") + R = Native.GF(ZZRingElem(123456789012345678949)) + S, x = polynomial_ring(R, "x") f = x^2 + 2x + 1 @test is_squarefree(f) == false - - @test !is_squarefree(Rx(0)) - @test is_squarefree(Rx(1)) - @test is_squarefree(Rx(2)) - @test is_squarefree(Rx(4)) end @testset "FpPolyRingElem.factor" begin - R = GF(ZZRingElem(123456789012345678949)) + R = Native.GF(ZZRingElem(123456789012345678949)) S, x = polynomial_ring(R, "x") F = R - @test_throws ArgumentError factor(S(0)) - @test_throws ArgumentError factor_squarefree(S(0)) - f = 3*(x^2 + 2x + 1) g = x^3 + 3x + 1 @@ -549,7 +541,7 @@ end end @testset "FpPolyRingElem.remove_valuation" begin - R = GF(ZZRingElem(123456789012345678949)) + R = Native.GF(ZZRingElem(123456789012345678949)) S, y = polynomial_ring(R, "y") f = 7y^2 + 3y + 2 diff --git a/test/flint/gfp_fmpz_rel_series-test.jl b/test/flint/gfp_fmpz_rel_series-test.jl index 61b5c594bc..1f462663ad 100644 --- a/test/flint/gfp_fmpz_rel_series-test.jl +++ b/test/flint/gfp_fmpz_rel_series-test.jl @@ -3,7 +3,7 @@ end @testset "FpRelPowerSeriesRingElem.constructors" begin - R = GF(ZZ(123456789012345678949)) + R = Native.GF(ZZ(123456789012345678949)) S1 = RelPowerSeriesRing(R, 30) S2 = RelPowerSeriesRing(R, 30) @@ -54,7 +54,7 @@ end end @testset "FpRelPowerSeriesRingElem.printing" begin - R = GF(ZZ(123456789012345678949)) + R = Native.GF(ZZ(123456789012345678949)) S, x = power_series_ring(R, 30, "x") b = x^2 + x + O(x^4) @@ -62,7 +62,7 @@ end end @testset "FpRelPowerSeriesRingElem.manipulation" begin - R = GF(ZZ(123456789012345678949)) + R = Native.GF(ZZ(123456789012345678949)) S, x = power_series_ring(R, 30, "x") @test max_precision(S) == 30 @@ -100,7 +100,7 @@ end end @testset "FpRelPowerSeriesRingElem.similar" begin - R0 = GF(ZZ(23)) + R0 = Native.GF(ZZ(23)) R, x = power_series_ring(R0, 10, "x") S, y = power_series_ring(ZZ, 10, "y") @@ -148,7 +148,7 @@ end end @testset "FpRelPowerSeriesRingElem.rel_series" begin - R = GF(ZZ(23)) + R = Native.GF(ZZ(23)) f = rel_series(R, [1, 2, 3], 3, 5, 2, "y") @test isa(f, FpRelPowerSeriesRingElem) @@ -191,7 +191,7 @@ end end @testset "FpRelPowerSeriesRingElem.unary_ops" begin - R = GF(ZZ(123456789012345678949)) + R = Native.GF(ZZ(123456789012345678949)) S, x = power_series_ring(R, 30, "x") a = 2x + x^3 @@ -203,7 +203,7 @@ end end @testset "FpRelPowerSeriesRingElem.binary_ops" begin - R = GF(ZZ(123456789012345678949)) + R = Native.GF(ZZ(123456789012345678949)) S, x = power_series_ring(R, 30, "x") a = 2x + x^3 @@ -343,7 +343,7 @@ end end @testset "FpRelPowerSeriesRingElem.adhoc_binary_ops" begin - R = GF(ZZ(123456789012345678949)) + R = Native.GF(ZZ(123456789012345678949)) S, x = power_series_ring(R, 30, "x") a = 2x + x^3 @@ -361,7 +361,7 @@ end end @testset "FpRelPowerSeriesRingElem.comparison" begin - R = GF(ZZ(123456789012345678949)) + R = Native.GF(ZZ(123456789012345678949)) S, x = power_series_ring(R, 30, "x") a = 2x + x^3 @@ -383,7 +383,7 @@ end end @testset "FpRelPowerSeriesRingElem.adhoc_comparison" begin - R = GF(ZZ(123456789012345678949)) + R = Native.GF(ZZ(123456789012345678949)) S, x = power_series_ring(R, 30, "x") a = 2x + x^3 @@ -418,7 +418,7 @@ end end @testset "FpRelPowerSeriesRingElem.powering" begin - R = GF(ZZ(123456789012345678949)) + R = Native.GF(ZZ(123456789012345678949)) S, x = power_series_ring(R, 30, "x") a = 2x + x^3 @@ -442,7 +442,7 @@ end end @testset "FpRelPowerSeriesRingElem.shift" begin - R = GF(ZZ(123456789012345678949)) + R = Native.GF(ZZ(123456789012345678949)) S, x = power_series_ring(R, 30, "x") a = 2x + x^3 @@ -466,7 +466,7 @@ end end @testset "FpRelPowerSeriesRingElem.truncation" begin - R = GF(ZZ(123456789012345678949)) + R = Native.GF(ZZ(123456789012345678949)) S, x = power_series_ring(R, 30, "x") a = 2x + x^3 @@ -486,7 +486,7 @@ end end @testset "FpRelPowerSeriesRingElem.inversion" begin - R = GF(ZZ(123456789012345678949)) + R = Native.GF(ZZ(123456789012345678949)) S, x = power_series_ring(R, 30, "x") a = 1 + x + 2x^2 + O(x^5) @@ -498,7 +498,7 @@ end end @testset "FpRelPowerSeriesRingElem.exact_division" begin - R = GF(ZZ(123456789012345678949)) + R = Native.GF(ZZ(123456789012345678949)) S, x = power_series_ring(R, 30, "x") a = x + x^3 @@ -516,7 +516,7 @@ end end @testset "FpRelPowerSeriesRingElem.adhoc_exact_division" begin - R = GF(ZZ(123456789012345678949)) + R = Native.GF(ZZ(123456789012345678949)) S, x = power_series_ring(R, 30, "x") a = x + x^3 @@ -538,7 +538,7 @@ end end @testset "FpRelPowerSeriesRingElem.square_root" begin - S = GF(ZZRingElem(31)) + S = Native.GF(ZZRingElem(31)) R, x = power_series_ring(S, 30, "x") for iter = 1:300 @@ -548,7 +548,7 @@ end end for p in [2, 7, 19, 65537] - R = GF(ZZRingElem(p)) + R = Native.GF(ZZRingElem(p)) S, x = power_series_ring(R, 10, "x") @@ -579,7 +579,7 @@ end end @testset "FpRelPowerSeriesRingElem.special_functions" begin - R = GF(ZZ(123456789012345678949)) + R = Native.GF(ZZ(123456789012345678949)) S, x = power_series_ring(R, 30, "x") @test isequal(exp(x + O(x^5)), 56584361630658436185*x^4+102880657510288065791*x^3+61728394506172839475*x^2+x+1+O(x^5)) @@ -590,7 +590,7 @@ end end @testset "FpRelPowerSeriesRingElem.unsafe_operators" begin - S = GF(ZZ(31)) + S = Native.GF(ZZ(31)) R, x = power_series_ring(S, 30, "x") for iter = 1:300 diff --git a/test/flint/gfp_mat-test.jl b/test/flint/gfp_mat-test.jl index caa972191c..a8002e7a3e 100644 --- a/test/flint/gfp_mat-test.jl +++ b/test/flint/gfp_mat-test.jl @@ -1,6 +1,6 @@ @testset "fpMatrix.constructors" begin - Z2 = GF(2) - Z3 = GF(3) + Z2 = Native.GF(2) + Z3 = Native.GF(3) R = fpMatrixSpace(Z2, 2, 2) @@ -171,7 +171,7 @@ end @testset "fpMatrix.similar" begin - Z13 = GF(13) + Z13 = Native.GF(13) S = fpMatrixSpace(Z13, 2, 2) s = S(ZZRingElem(3)) @@ -199,7 +199,7 @@ end end @testset "fpMatrix.printing" begin - Z2 = GF(2) + Z2 = Native.GF(2) R = fpMatrixSpace(Z2, 2, 2) a = R(1) @@ -209,9 +209,9 @@ end end @testset "fpMatrix.manipulation" begin - Z11 = GF(11) + Z11 = Native.GF(11) R = fpMatrixSpace(Z11, 2, 2) - Z23 = GF(23) + Z23 = Native.GF(23) S = fpMatrixSpace(Z23, 2, 2) ar = [ 1 2; 3 4] @@ -260,7 +260,7 @@ end @test iszero(e) - @test_throws ErrorException one(matrix_space(GF(2), 1, 2)) + @test_throws ErrorException one(matrix_space(Native.GF(2), 1, 2)) @test is_square(a) @@ -281,11 +281,11 @@ end end @testset "fpMatrix.unary_ops" begin - Z17 = GF(17) + Z17 = Native.GF(17) R = matrix_space(Z17, 3, 4) RR = matrix_space(Z17, 4, 3) - Z2 = GF(2) + Z2 = Native.GF(2) S = matrix_space(Z2, 3, 4) a = R([ 1 2 3 1; 3 2 1 2; 1 3 2 0]) @@ -300,7 +300,7 @@ end end @testset "fpMatrix.binary_ops" begin - Z17 = GF(17) + Z17 = Native.GF(17) R = matrix_space(Z17, 3, 4) a = R([ 1 2 3 1; 3 2 1 2; 1 3 2 0]) @@ -363,10 +363,10 @@ end end @testset "fpMatrix.adhoc_binary" begin - Z17 = GF(17) + Z17 = Native.GF(17) R = matrix_space(Z17, 3, 4) - Z2 = GF(2) + Z2 = Native.GF(2) a = R([ 1 2 3 1; 3 2 1 2; 1 3 2 0]) @@ -402,7 +402,7 @@ end end @testset "fpMatrix.comparison" begin - Z17 = GF(17) + Z17 = Native.GF(17) R = matrix_space(Z17, 3, 4) @@ -416,7 +416,7 @@ end end @testset "fpMatrix.adhoc_comparison" begin - Z17 = GF(17) + Z17 = Native.GF(17) R = matrix_space(Z17, 3, 4) @@ -430,7 +430,7 @@ end end @testset "fpMatrix.powering" begin - Z17 = GF(17) + Z17 = Native.GF(17) R = matrix_space(Z17, 3, 4) @@ -453,17 +453,17 @@ end for iters = 1:100 m = rand(0:100) n = rand(0:100) - S = matrix_space(GF(7), m, n) + S = matrix_space(Native.GF(7), m, n) M = rand(S) r, N = rref(M) @test is_rref(N) end - Z17 = GF(17) + Z17 = Native.GF(17) R = matrix_space(Z17, 3, 4) RR = matrix_space(Z17, 4, 3) - Z2 = GF(2) + Z2 = Native.GF(2) S = matrix_space(Z2, 3, 4) a = R([ 1 2 3 1; 3 2 1 2; 1 3 2 0]) @@ -491,7 +491,7 @@ end end @testset "fpMatrix.howell_form" begin - Z17 = GF(17) + Z17 = Native.GF(17) R = matrix_space(Z17, 3, 3) a = R([4 1 0; 0 0 5; 0 0 0 ]) @@ -511,10 +511,10 @@ end end @testset "fpMatrix.trace_det" begin - Z17 = GF(17) + Z17 = Native.GF(17) R = matrix_space(Z17, 3, 4) RR = matrix_space(Z17, 4, 3) - Z2 = GF(2) + Z2 = Native.GF(2) S = matrix_space(Z2, 3, 4) a = R([ 1 2 3 1; 3 2 1 2; 1 3 2 0]) @@ -545,10 +545,10 @@ end end @testset "fpMatrix.rank" begin - Z17 = GF(17) + Z17 = Native.GF(17) R = matrix_space(Z17, 3, 4) RR = matrix_space(Z17, 4, 3) - Z2 = GF(2) + Z2 = Native.GF(2) S = matrix_space(Z2, 3, 4) a = R([ 1 2 3 1; 3 2 1 2; 1 3 2 0]) @@ -571,10 +571,10 @@ end end @testset "fpMatrix.inv" begin - Z17 = GF(17) + Z17 = Native.GF(17) R = matrix_space(Z17, 3, 4) RR = matrix_space(Z17, 4, 3) - Z2 = GF(2) + Z2 = Native.GF(2) S = matrix_space(Z2, 3, 4) a = R([ 1 2 3 1; 3 2 1 2; 1 3 2 0]) @@ -593,7 +593,7 @@ end end @testset "fpMatrix.solve" begin - Z17 = GF(17) + Z17 = Native.GF(17) R = matrix_space(Z17, 3, 3) S = matrix_space(Z17, 3, 4) @@ -683,7 +683,7 @@ end @testset "fpMatrix.lu" begin - Z17 = GF(17) + Z17 = Native.GF(17) R = matrix_space(Z17, 3, 3) S = matrix_space(Z17, 3, 4) @@ -710,7 +710,7 @@ end end @testset "fpMatrix.swap_rows" begin - Z17 = GF(17) + Z17 = Native.GF(17) A = matrix(Z17, 5, 1, [1, 2, 3, 4, 5]) @@ -724,7 +724,7 @@ end @test_throws BoundsError swap_rows(A, 4, 6) end @testset "fpMatrix.view" begin - Z17 = GF(17) + Z17 = Native.GF(17) R = matrix_space(Z17, 3, 3) S = matrix_space(Z17, 3, 4) @@ -781,7 +781,7 @@ end end @testset "fpMatrix.sub" begin - Z17 = GF(17) + Z17 = Native.GF(17) S = matrix_space(Z17, 3, 3) A = S([1 2 3; 4 5 6; 7 8 9]) @@ -805,7 +805,7 @@ end end @testset "fpMatrix.concatenation" begin - Z17 = GF(17) + Z17 = Native.GF(17) R = matrix_space(Z17, 3, 3) S = matrix_space(Z17, 3, 4) @@ -841,7 +841,7 @@ end end @testset "fpMatrix.conversion" begin - Z17 = GF(17) + Z17 = Native.GF(17) R = matrix_space(Z17, 3, 3) S = matrix_space(ZZ, 3, 3) @@ -864,7 +864,7 @@ end end @testset "fpMatrix.charpoly" begin - R = GF(17) + R = Native.GF(17) for dim = 0:5 S = matrix_space(R, dim, dim) @@ -882,7 +882,7 @@ end end @testset "fpMatrix.rand" begin - R = GF(17) + R = Native.GF(17) S = matrix_space(R, 3, 3) M = rand(S, 1:5) diff --git a/test/flint/gfp_mpoly-test.jl b/test/flint/gfp_mpoly-test.jl index 8cf361df89..5102f048bc 100644 --- a/test/flint/gfp_mpoly-test.jl +++ b/test/flint/gfp_mpoly-test.jl @@ -1,5 +1,5 @@ @testset "fpMPolyRingElem.constructors" begin - R = GF(23) + R = Native.GF(23) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -79,14 +79,14 @@ end end - RR = GF(29) + RR = Native.GF(29) S, (x, y) = polynomial_ring(R, ["x", "y"]) M = MPolyBuildCtx(S) @test_throws ErrorException push_term!(M, one(RR), zeros(Int, 2)) end @testset "fpMPolyRingElem.printing" begin - S, (x, y) = polynomial_ring(GF(23), ["x", "y"]) + S, (x, y) = polynomial_ring(Native.GF(23), ["x", "y"]) @test !occursin(r"{", string(S)) @@ -97,7 +97,7 @@ end end @testset "fpMPolyRingElem.manipulation" begin - R = GF(23) + R = Native.GF(23) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -229,7 +229,7 @@ end end @testset "fpMPolyRingElem.multivariate_coeff" begin - R = GF(23) + R = Native.GF(23) for ord in Nemo.flint_orderings S, (x, y, z) = polynomial_ring(R, ["x", "y", "z"]; ordering=ord) @@ -247,7 +247,7 @@ end end @testset "fpMPolyRingElem.unary_ops" begin - R = GF(23) + R = Native.GF(23) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -264,7 +264,7 @@ end end @testset "fpMPolyRingElem.binary_ops" begin - R = GF(23) + R = Native.GF(23) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -287,7 +287,7 @@ end end @testset "fpMPolyRingElem.adhoc_binary" begin - R = GF(23) + R = Native.GF(23) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -323,7 +323,7 @@ end end @testset "fpMPolyRingElem.adhoc_comparison" begin - R = GF(23) + R = Native.GF(23) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -345,7 +345,7 @@ end end @testset "fpMPolyRingElem.powering" begin - R = GF(23) + R = Native.GF(23) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -372,7 +372,7 @@ end end @testset "fpMPolyRingElem.divides" begin - R = GF(23) + R = Native.GF(23) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -406,7 +406,7 @@ end end @testset "fpMPolyRingElem.euclidean_division" begin - R = GF(23) + R = Native.GF(23) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -442,7 +442,7 @@ end end @testset "fpMPolyRingElem.ideal_reduction" begin - R = GF(23) + R = Native.GF(23) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -491,7 +491,7 @@ end end @testset "fpMPolyRingElem.gcd" begin - R = GF(23) + R = Native.GF(23) for num_vars = 1:4 var_names = ["x$j" for j in 1:num_vars] @@ -517,7 +517,7 @@ end end @testset "fpMPolyRingElem.factor" begin - R = GF(23) + R = Native.GF(23) R, (x, y, z) = polynomial_ring(R, ["x", "y", "z"]) @test_throws ArgumentError factor(R(0)) @@ -539,7 +539,7 @@ end end @testset "fpMPolyRingElem.sqrt" begin - R = GF(23) + R = Native.GF(23) for num_vars = 1:4 var_names = ["x$j" for j in 1:num_vars] @@ -565,7 +565,7 @@ end end @testset "fpMPolyRingElem.evaluation" begin - R = GF(23) + R = Native.GF(23) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -653,7 +653,7 @@ end end @testset "fpMPolyRingElem.valuation" begin - R = GF(23) + R = Native.GF(23) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -691,7 +691,7 @@ end end @testset "fpMPolyRingElem.derivative" begin - R = GF(23) + R = Native.GF(23) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -711,7 +711,7 @@ end end @testset "fpMPolyRingElem.unsafe" begin - R23 = GF(23) + R23 = Native.GF(23) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -769,7 +769,7 @@ end end @testset "fpMPolyRingElem.exponents" begin - R23 = GF(23) + R23 = Native.GF(23) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -844,14 +844,14 @@ end end @testset "fpMPolyRingElem.promote_rule" begin - R = GF(2) + R = Native.GF(2) Rx, (x, ) = polynomial_ring(R, ["x"]) Sy, (y, ) = polynomial_ring(Rx, ["y"]) @test y == @inferred (R(1) * y) end @testset "fpMPolyRingElem.gcd_with_cofactors" begin - R, (x, y, z) = polynomial_ring(GF(23), [:x, :y, :z]) + R, (x, y, z) = polynomial_ring(Native.GF(23), [:x, :y, :z]) @test gcd_with_cofactors(x, y) == (1, x, y) diff --git a/test/flint/gfp_poly-test.jl b/test/flint/gfp_poly-test.jl index ec43b50c73..1865ac8c60 100644 --- a/test/flint/gfp_poly-test.jl +++ b/test/flint/gfp_poly-test.jl @@ -1,5 +1,5 @@ @testset "fpPolyRingElem.constructors" begin - R = GF(17) + R = Native.GF(17) S1 = PolyRing(R) S2 = PolyRing(R) @@ -14,11 +14,11 @@ @test parent_type(fpPolyRingElem) == fpPolyRing @test dense_poly_type(fpFieldElem) == fpPolyRingElem - S = GF(19) + S = Native.GF(19) Sy, y = polynomial_ring(R, "y") RRx, xx = polynomial_ring(R, "x") - RRRx, xxx = polynomial_ring(GF(17), "xx") + RRRx, xxx = polynomial_ring(Native.GF(17), "xx") @test var(Rx) == Symbol("x") @@ -94,7 +94,7 @@ end @testset "fpPolyRingElem.polynomial" begin - R = GF(23) + R = Native.GF(23) f = polynomial(R, []) g = polynomial(R, [1, 2, 3]) @@ -114,7 +114,7 @@ end end @testset "zzModPolyRingElem.similar" begin - R = GF(23) + R = Native.GF(23) f = polynomial(R, [1, 2, 3]) g = similar(f) @@ -129,7 +129,7 @@ end end @testset "fpPolyRingElem.printing" begin - R = GF(17) + R = Native.GF(17) Rx, x = polynomial_ring(R, "x") a = x^3 + x + 1 @@ -138,7 +138,7 @@ end end @testset "fpPolyRingElem.manipulation" begin - R = GF(17) + R = Native.GF(17) Rx, x = polynomial_ring(R, "x") @test isone(one(Rx)) @@ -171,7 +171,7 @@ end end @testset "fpPolyRingElem.unary_ops" begin - R = GF(23) + R = Native.GF(23) Rx, x = polynomial_ring(R, "x") f = x^2 + R(13)*x + R(5) @@ -180,7 +180,7 @@ end end @testset "fpPolyRingElem.binary_ops" begin - R = GF(23) + R = Native.GF(23) Rx, x = polynomial_ring(R, "x") f = x^2 + R(13)*x + R(5) @@ -197,10 +197,10 @@ end end @testset "fpPolyRingElem.adhoc_binary" begin - R = GF(113) + R = Native.GF(113) Rx, x = polynomial_ring(R, "x") - S = GF(19) + S = Native.GF(19) f = x^2 + R(2)x + R(1) g = x^3 + R(3)x^2 + x @@ -233,7 +233,7 @@ end end @testset "fpPolyRingElem.powering" begin - R = GF(23) + R = Native.GF(23) Rx, x = polynomial_ring(R, "x") f = x^2 + R(13)x + R(5) @@ -246,7 +246,7 @@ end end @testset "fpPolyRingElem.comparison" begin - R = GF(23) + R = Native.GF(23) Rx, x = polynomial_ring(R, "x") Ry, y = polynomial_ring(R, "y") @@ -255,7 +255,7 @@ end end @testset "fpPolyRingElem.adhoc_comparison" begin - R = GF(7) + R = Native.GF(7) S, x = polynomial_ring(R, "x") f = x^2 + 2x + 1 @@ -274,7 +274,7 @@ end end @testset "fpPolyRingElem.truncation" begin - R = GF(23) + R = Native.GF(23) Rx, x = polynomial_ring(R, "x") f = x^5 + x^4 + 2 *x^2 @@ -289,7 +289,7 @@ end end @testset "fpPolyRingElem.mullow" begin - R = GF(23) + R = Native.GF(23) Rx, x = polynomial_ring(R, "x") f = x^5 + x^4 + 2 *x^2 @@ -300,7 +300,7 @@ end end @testset "fpPolyRingElem.reverse" begin - R = GF(23) + R = Native.GF(23) Rx, x = polynomial_ring(R, "x") f = x^5 + x^4 + 2 *x^2 + 1 @@ -313,7 +313,7 @@ end end @testset "fpPolyRingElem.shift" begin - R = GF(23) + R = Native.GF(23) Rx, x = polynomial_ring(R, "x") f = x^5 + x^4 + 2 *x^2 + 1 @@ -335,7 +335,7 @@ end end @testset "fpPolyRingElem.division" begin - R = GF(23) + R = Native.GF(23) Rx, x = polynomial_ring(R, "x") f = x^5 + x^4 + 2 *x^2 + x @@ -375,7 +375,7 @@ end end @testset "fpPolyRingElem.adhoc_exact_division" begin - R = GF(23) + R = Native.GF(23) S, x = polynomial_ring(R, "x") f = x^2 + 2x + 1 @@ -388,7 +388,7 @@ end end @testset "fpPolyRingElem.gcd" begin - R = GF(23) + R = Native.GF(23) Rx, x = polynomial_ring(R, "x") f = x^5 + x^4 + 2 *x^2 + x @@ -405,7 +405,7 @@ end end @testset "fpPolyRingElem.modular_arithmetic" begin - R = GF(487326487) + R = Native.GF(487326487) S, x = polynomial_ring(R, "x") f = 3*x^2 + x + 2 @@ -424,7 +424,7 @@ end end @testset "fpPolyRingElem.resultant" begin - R = GF(23) + R = Native.GF(23) Rx, x = polynomial_ring(R, "x") f = x^5 + x^4 + 2 *x^2 + x @@ -439,7 +439,7 @@ end end @testset "fpPolyRingElem.evaluate" begin - R = GF(23) + R = Native.GF(23) Rx, x = polynomial_ring(R, "x") f = x^5 + x^4 + 2 *x^2 + x @@ -463,7 +463,7 @@ end end @testset "fpPolyRingElem.derivative" begin - R = GF(23) + R = Native.GF(23) Rx, x = polynomial_ring(R, "x") f = x^5 + x^4 + 2 *x^2 + x @@ -476,7 +476,7 @@ end end @testset "fpPolyRingElem.integral" begin - R = GF(7) + R = Native.GF(7) S, x = polynomial_ring(R, "x") f = x^2 + 2x + 1 @@ -485,7 +485,7 @@ end end @testset "fpPolyRingElem.compose" begin - R = GF(23) + R = Native.GF(23) Rx, x = polynomial_ring(R, "x") f = x^5 + x^4 + 2 *x^2 + x @@ -499,7 +499,7 @@ end end @testset "fpPolyRingElem.interpolate" begin - R = GF(23) + R = Native.GF(23) Rx, x = polynomial_ring(R, "x") xval = [ R(0), R(1), R(2), R(3) ] @@ -513,7 +513,7 @@ end end @testset "fpPolyRingElem.inflate" begin - R = GF(23) + R = Native.GF(23) Rx, x = polynomial_ring(R, "x") f = x^6 + x^4 + 2 *x^2 @@ -527,7 +527,7 @@ end end @testset "fpPolyRingElem.deflate" begin - R = GF(23) + R = Native.GF(23) Rx, x = polynomial_ring(R, "x") f = x^6 + x^4 + 2 *x^2 @@ -541,7 +541,7 @@ end end @testset "fpPolyRingElem.lifting" begin - R = GF(23) + R = Native.GF(23) Rx, x = polynomial_ring(R, "x") Zy,y = polynomial_ring(ZZ, "y") @@ -554,7 +554,7 @@ end end @testset "fpPolyRingElem.is_irreducible" begin - R = GF(23) + R = Native.GF(23) Rx, x = polynomial_ring(R, "x") f = x^6 + x^4 + 2 *x^2 @@ -567,7 +567,7 @@ end end @testset "fpPolyRingElem.is_squarefree" begin - R = GF(23) + R = Native.GF(23) Rx, x = polynomial_ring(R, "x") f = x^6 + x^4 + 2 *x^2 @@ -583,7 +583,7 @@ end end @testset "fpPolyRingElem.square_root" begin - for R in [GF(2), GF(23)] + for R in [Native.GF(2), Native.GF(23)] S, x = polynomial_ring(R, "x") for iter in 1:1000 @@ -617,7 +617,7 @@ end end @testset "fpPolyRingElem.factor" begin - R = GF(23) + R = Native.GF(23) Rx, x = polynomial_ring(R, "x") @test_throws ArgumentError factor(Rx(0)) @@ -650,14 +650,14 @@ end end @testset "fpPolyRingElem.canonicalization" begin - R = GF(23) + R = Native.GF(23) Rx, x = polynomial_ring(R, "x") @test canonical_unit(5*x) == R(5) end @testset "fpPolyRingElem.remove_valuation" begin - R = GF(23) + R = Native.GF(23) Rx, x = polynomial_ring(R, "x") f = (x + 1)^10 * (x + 2) * (x + 3) diff --git a/test/flint/gfp_rel_series-test.jl b/test/flint/gfp_rel_series-test.jl index e8d92b20c8..2dd66233ae 100644 --- a/test/flint/gfp_rel_series-test.jl +++ b/test/flint/gfp_rel_series-test.jl @@ -3,7 +3,7 @@ end @testset "fpRelPowerSeriesRingElem.constructors" begin - R = GF(17) + R = Native.GF(17) S1 = RelPowerSeriesRing(R, 30) S2 = RelPowerSeriesRing(R, 30) @@ -52,7 +52,7 @@ end end @testset "fpRelPowerSeriesRingElem.printing" begin - R = GF(17) + R = Native.GF(17) S, x = power_series_ring(R, 30, "x") b = x^2 + x + O(x^4) @@ -60,7 +60,7 @@ end end @testset "fpRelPowerSeriesRingElem.manipulation" begin - R = GF(17) + R = Native.GF(17) S, x = power_series_ring(R, 30, "x") @test max_precision(S) == 30 @@ -96,7 +96,7 @@ end end @testset "fpRelPowerSeriesRingElem.similar" begin - R0 = GF(23) + R0 = Native.GF(23) R, x = power_series_ring(R0, 10, "x") S, y = power_series_ring(ZZ, 10, "y") @@ -144,7 +144,7 @@ end end @testset "fpRelPowerSeriesRingElem.rel_series" begin - R = GF(23) + R = Native.GF(23) f = rel_series(R, [1, 2, 3], 3, 5, 2, "y") @test isa(f, fpRelPowerSeriesRingElem) @@ -187,7 +187,7 @@ end end @testset "fpRelPowerSeriesRingElem.unary_ops" begin - R = GF(17) + R = Native.GF(17) S, x = power_series_ring(R, 30, "x") a = 2x + x^3 @@ -199,7 +199,7 @@ end end @testset "fpRelPowerSeriesRingElem.binary_ops" begin - R = GF(17) + R = Native.GF(17) S, x = power_series_ring(R, 30, "x") a = 2x + x^3 @@ -337,7 +337,7 @@ end end @testset "fpRelPowerSeriesRingElem.adhoc_binary_ops" begin - R = GF(17) + R = Native.GF(17) S, x = power_series_ring(R, 30, "x") a = 2x + x^3 @@ -355,7 +355,7 @@ end end @testset "fpRelPowerSeriesRingElem.comparison" begin - R = GF(17) + R = Native.GF(17) S, x = power_series_ring(R, 30, "x") a = 2x + x^3 @@ -375,7 +375,7 @@ end end @testset "fpRelPowerSeriesRingElem.adhoc_comparison" begin - R = GF(17) + R = Native.GF(17) S, x = power_series_ring(R, 30, "x") a = 2x + x^3 @@ -395,7 +395,7 @@ end end @testset "fpRelPowerSeriesRingElem.powering" begin - R = GF(17) + R = Native.GF(17) S, x = power_series_ring(R, 30, "x") a = 2x + x^3 @@ -415,7 +415,7 @@ end end @testset "fpRelPowerSeriesRingElem.shift" begin - R = GF(17) + R = Native.GF(17) S, x = power_series_ring(R, 30, "x") a = 2x + x^3 @@ -437,7 +437,7 @@ end end @testset "fpRelPowerSeriesRingElem.truncation" begin - R = GF(17) + R = Native.GF(17) S, x = power_series_ring(R, 30, "x") a = 2x + x^3 @@ -457,7 +457,7 @@ end end @testset "fpRelPowerSeriesRingElem.inversion" begin - R = GF(17) + R = Native.GF(17) S, x = power_series_ring(R, 30, "x") a = 1 + x + 2x^2 + O(x^5) @@ -469,7 +469,7 @@ end end @testset "fpRelPowerSeriesRingElem.exact_division" begin - R = GF(17) + R = Native.GF(17) S, x = power_series_ring(R, 30, "x") a = x + x^3 @@ -487,7 +487,7 @@ end end @testset "fpRelPowerSeriesRingElem.adhoc_exact_division" begin - R = GF(17) + R = Native.GF(17) S, x = power_series_ring(R, 30, "x") a = x + x^3 @@ -509,7 +509,7 @@ end end @testset "fpRelPowerSeriesRingElem.square_root" begin - S = GF(31) + S = Native.GF(31) R, x = power_series_ring(S, 30, "x") for iter = 1:300 @@ -519,7 +519,7 @@ end end for p in [2, 7, 19, 65537] - R = GF(p) + R = Native.GF(p) S, x = power_series_ring(R, 10, "x") @@ -550,7 +550,7 @@ end end @testset "fpRelPowerSeriesRingElem.special_functions" begin - R = GF(17) + R = Native.GF(17) S, x = power_series_ring(R, 30, "x") @test isequal(exp(x + O(x^5)), 1+x+9*x^2+3*x^3+5*x^4+O(x^5)) @@ -561,7 +561,7 @@ end end @testset "fpRelPowerSeriesRingElem.unsafe_operators" begin - S = GF(17) + S = Native.GF(17) R, x = power_series_ring(S, 30, "x") for iter = 1:300