From 60fbb7d8b2ff3533e733447c24efce0d826fa8a2 Mon Sep 17 00:00:00 2001 From: Johannes Schmitt Date: Fri, 19 Apr 2024 23:22:07 +0200 Subject: [PATCH 01/14] Use `CacheDictType` (#1724) --- src/flint/fq_default_extended.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/flint/fq_default_extended.jl b/src/flint/fq_default_extended.jl index cf8c21a4f..f091aa768 100644 --- a/src/flint/fq_default_extended.jl +++ b/src/flint/fq_default_extended.jl @@ -595,7 +595,7 @@ function _fq_field_from_nmod_poly_in_disguise(f::FqPolyRingElem, s::Symbol) return z end -const FqDefaultFiniteFieldIDFqDefaultPoly = Dict{Tuple{FqPolyRingElem, Symbol, Bool}, FqField}() +const FqDefaultFiniteFieldIDFqDefaultPoly = CacheDictType{Tuple{FqPolyRingElem, Symbol, Bool}, FqField}() function FqField(f::FqPolyRingElem, s::Symbol, cached::Bool = false, absolute::Bool = false) return get_cached!(FqDefaultFiniteFieldIDFqDefaultPoly, (f, s, absolute), cached) do From 023d38530b591e8ec07232e9f468cdc1a64a9d76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Fri, 19 Apr 2024 23:29:44 +0200 Subject: [PATCH 02/14] Sort out deprecations and aliases (#1704) --- src/Aliases.jl | 53 +++++++++++++++------------------------ src/Deprecations.jl | 60 ++++++++++++++++++++++++++++++++++++++++++++- src/Nemo.jl | 6 ++--- 3 files changed, 82 insertions(+), 37 deletions(-) diff --git a/src/Aliases.jl b/src/Aliases.jl index 027f2eed5..a16377689 100644 --- a/src/Aliases.jl +++ b/src/Aliases.jl @@ -1,38 +1,25 @@ -include(joinpath(pathof(AbstractAlgebra), "..", "Aliases.jl")) +# alternative names for some functions from Base +# (this list contained stuff along the lines of `@alias is_equal isequal`, but everything has moved to AbstractAlgebra) -# make some Julia names compatible with our naming conventions -@alias is_equal isequal -@alias is_finite isfinite -@alias is_inf isinf -@alias is_integer isinteger -@alias is_less isless -@alias is_real isreal +# TODO: next breaking release: remove the if guard around the block +if @__MODULE__() == Nemo + + # alternative names for some functions from LinearAlgebra + # we don't use the `@alias` macro here because we provide custom + # docstrings for these aliases + const eigenvalues = eigvals +end + +# predeclare some functions to allow defining aliases for some of our own functions +function eigenvalues_simple end @alias eigvals_simple eigenvalues_simple # for consistency with eigvals/eigenvalues -# renamed for 0.40.0 -Base.@deprecate_binding FlintPadicField PadicField -Base.@deprecate_binding padic PadicFieldElem -Base.@deprecate_binding FlintQadicField QadicField -Base.@deprecate_binding qadic QadicFieldElem -# renamed for 0.41.0 -Base.@deprecate_binding arb_poly ArbPolyRingElem -Base.@deprecate_binding arb_mat ArbMatrix -Base.@deprecate_binding arb ArbFieldElem -Base.@deprecate_binding acb_poly AcbPolyRingElem -Base.@deprecate_binding acb_mat AcbMatrix -Base.@deprecate_binding acb AcbFieldElem -Base.@deprecate_binding ca CalciumFieldElem -Base.@deprecate_binding Loc LocalizedEuclideanRing -Base.@deprecate_binding LocElem LocalizedEuclideanRingElem -Base.@deprecate_binding lll_ctx LLLContext -Base.@deprecate_binding qqbar QQBarFieldElem -Base.@deprecate_binding CalciumQQBarField QQBarField -Base.@deprecate_binding FlintQQiField Nemo.QQiField false -Base.@deprecate_binding fmpqi Nemo.QQiFieldElem false -Base.@deprecate_binding FlintZZiRing Nemo.ZZiRing false -Base.@deprecate_binding fmpzi Nemo.ZZiRingElem false -Base.@deprecate_binding fmpzUnitRange ZZRingElemUnitRange -Base.@deprecate_binding AnticNumberField AbsSimpleNumField -Base.@deprecate_binding nf_elem AbsSimpleNumFieldElem +# TODO: next breaking release: remove this block +# Oscar includes this file for historical reasons, but expects it to contain the Base.@deprecate_binding calls. +# Until this is changed and released there, we thus need to include the deprecations here. +@static if Symbol(@__MODULE__()) in [:Hecke, :Oscar] + Nemo.@include_deprecated_bindings() +end + diff --git a/src/Deprecations.jl b/src/Deprecations.jl index 0a6b94774..7ed87049b 100644 --- a/src/Deprecations.jl +++ b/src/Deprecations.jl @@ -1,5 +1,63 @@ -# Deprecated in 0.39.* +############################################################################### +# +# Aliases +# +############################################################################### + +# ALL aliases here are only a temporary measure to allow for a smooth transition downstream. +# they will be replaced by deprecations eventually + +#= currently none =# + +############################################################################### +# +# Deprecated bindings +# +############################################################################### + +# Deprecated bindings don't get reexported automatically in Hecke/Oscar/etc. +# By calling this macro from the respective packages, we can ensure that the deprecated bindings are available there. +macro include_deprecated_bindings() + return esc(quote + # renamed and deprecated for 0.40.0 + Base.@deprecate_binding FlintPadicField PadicField + Base.@deprecate_binding padic PadicFieldElem + Base.@deprecate_binding FlintQadicField QadicField + Base.@deprecate_binding qadic QadicFieldElem + # renamed and deprecated for 0.41.0 + Base.@deprecate_binding arb_poly ArbPolyRingElem + Base.@deprecate_binding arb_mat ArbMatrix + Base.@deprecate_binding arb ArbFieldElem + Base.@deprecate_binding acb_poly AcbPolyRingElem + Base.@deprecate_binding acb_mat AcbMatrix + Base.@deprecate_binding acb AcbFieldElem + Base.@deprecate_binding ca CalciumFieldElem + Base.@deprecate_binding Loc LocalizedEuclideanRing + Base.@deprecate_binding LocElem LocalizedEuclideanRingElem + Base.@deprecate_binding lll_ctx LLLContext + Base.@deprecate_binding qqbar QQBarFieldElem + Base.@deprecate_binding CalciumQQBarField QQBarField + Base.@deprecate_binding FlintQQiField Nemo.QQiField false + Base.@deprecate_binding fmpqi Nemo.QQiFieldElem false + Base.@deprecate_binding FlintZZiRing Nemo.ZZiRing false + Base.@deprecate_binding fmpzi Nemo.ZZiRingElem false + Base.@deprecate_binding fmpzUnitRange ZZRingElemUnitRange + Base.@deprecate_binding AnticNumberField AbsSimpleNumField + Base.@deprecate_binding nf_elem AbsSimpleNumFieldElem + + end) +end + +@include_deprecated_bindings() + +############################################################################### +# +# Deprecations +# +############################################################################### + +# Deprecated in 0.39.* @deprecate divisible(x::Int, y::Int) is_divisible_by(x, y) @deprecate divisible(x::ZZRingElem, y::Int) is_divisible_by(x, y) @deprecate divisible(x::ZZRingElem, y::ZZRingElem) is_divisible_by(x, y) diff --git a/src/Nemo.jl b/src/Nemo.jl index a71a4d3f1..ae76c82f1 100644 --- a/src/Nemo.jl +++ b/src/Nemo.jl @@ -192,9 +192,11 @@ import AbstractAlgebra: Set import AbstractAlgebra: set_attribute! import AbstractAlgebra: Solve +AbstractAlgebra.@include_deprecated_bindings() + include("Exports.jl") -const eigenvalues = eigvals # alternative name for the function from LinearAlgebra +include("Aliases.jl") ############################################################################### # @@ -645,8 +647,6 @@ end include("Deprecations.jl") -include("Aliases.jl") - include("Native.jl") end # module From 22e3908737efeb539bf0adfd8f9d2998eaead105 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Mon, 22 Apr 2024 14:58:34 +0200 Subject: [PATCH 03/14] Consistently use `ZZ/QQ` instead of mix of `ZZ/QQ` and `FlintZZ/FlintQQ` (#1718) * Consistently use `QQ` instead of mix of `QQ` and `FlintQQ` * Consistently use `ZZ` instead of mix of `ZZ` and `FlintZZ` * Remove ancient references to `FlintFiniteField` --- benchmarks/bernoulli_polynomials.jl | 2 +- benchmarks/charpoly_integers.jl | 4 +- benchmarks/det_commutative_ring.jl | 2 +- benchmarks/det_field.jl | 2 +- benchmarks/det_polynomials.jl | 2 +- benchmarks/fateman.jl | 2 +- benchmarks/minpoly_finite_field.jl | 2 +- benchmarks/minpoly_integers.jl | 4 +- benchmarks/solve_polynomials.jl | 2 +- docs/src/developer/parents.md | 2 +- docs/src/integer.md | 6 +- docs/src/qadic.md | 4 +- src/HeckeMiscFiniteField.jl | 2 +- src/HeckeMiscInteger.jl | 2 +- src/HeckeMiscMatrix.jl | 16 +-- src/HeckeMiscPoly.jl | 4 +- src/HeckeMoreStuff.jl | 18 +-- src/Nemo.jl | 7 +- src/antic/nf_elem.jl | 8 +- src/arb/ComplexPoly.jl | 2 +- src/arb/RealPoly.jl | 2 +- src/arb/acb_poly.jl | 2 +- src/arb/arb_poly.jl | 2 +- src/calcium/qqbar.jl | 2 +- src/flint/FlintTypes.jl | 6 +- src/flint/fmpq.jl | 6 +- src/flint/fmpq_abs_series.jl | 2 +- src/flint/fmpq_mat.jl | 10 +- src/flint/fmpq_mpoly.jl | 6 +- src/flint/fmpq_poly.jl | 2 +- src/flint/fmpq_rel_series.jl | 2 +- src/flint/fmpz.jl | 22 +-- src/flint/fmpz_abs_series.jl | 2 +- src/flint/fmpz_laurent_series.jl | 2 +- src/flint/fmpz_mat.jl | 4 +- src/flint/fmpz_mod.jl | 2 +- src/flint/fmpz_mod_mpoly.jl | 2 +- src/flint/fmpz_mpoly.jl | 6 +- src/flint/fmpz_poly.jl | 2 +- src/flint/fmpz_rel_series.jl | 2 +- src/flint/fq_default.jl | 2 +- src/flint/fq_nmod_mpoly.jl | 2 +- src/flint/nmod.jl | 2 +- src/flint/nmod_mpoly.jl | 2 +- src/flint/padic.jl | 8 +- src/flint/qadic.jl | 2 +- src/gaussiannumbers/ZZi.jl | 8 +- src/gaussiannumbers/continued_fraction.jl | 4 +- test/HeckeMiscLocalization-test.jl | 12 +- test/Rings-test.jl | 4 +- test/antic/nf_elem-test.jl | 12 +- test/calcium/ca-test.jl | 6 +- test/calcium/qqbar-test.jl | 4 +- test/flint/fmpq-test.jl | 20 +-- test/flint/fmpq_mat-test.jl | 72 +++++----- test/flint/fmpq_mpoly-test.jl | 44 +++--- test/flint/fmpq_poly-test.jl | 2 +- test/flint/fmpz-test.jl | 40 +++--- test/flint/fmpz_mat-test.jl | 160 +++++++++++----------- test/flint/fmpz_mod-test.jl | 2 +- test/flint/fmpz_mod_mat-test.jl | 2 +- test/flint/fmpz_mpoly-test.jl | 44 +++--- test/flint/fmpz_poly-test.jl | 2 +- test/flint/fq-test.jl | 6 +- test/flint/fq_default-test.jl | 8 +- test/flint/fq_default_mat-test.jl | 4 +- test/flint/fq_default_poly-test.jl | 2 +- test/flint/fq_mat-test.jl | 2 +- test/flint/fq_nmod-test.jl | 4 +- test/flint/fq_nmod_mat-test.jl | 2 +- test/flint/gfp_mat-test.jl | 2 +- test/flint/nmod-test.jl | 2 +- test/flint/nmod_mat-test.jl | 2 +- test/flint/nmod_mpoly-test.jl | 44 +++--- test/flint/padic-test.jl | 4 +- test/flint/qadic-test.jl | 4 +- 76 files changed, 360 insertions(+), 361 deletions(-) diff --git a/benchmarks/bernoulli_polynomials.jl b/benchmarks/bernoulli_polynomials.jl index 6fca95e8a..0a920e148 100644 --- a/benchmarks/bernoulli_polynomials.jl +++ b/benchmarks/bernoulli_polynomials.jl @@ -1,7 +1,7 @@ function benchmark_bernoulli() print("benchmark_bernoulli ... ") - R, x = FlintQQ["x"] + R, x = QQ["x"] S, t = power_series_ring(R, 1000, "t") u = t + O(t^1000) diff --git a/benchmarks/charpoly_integers.jl b/benchmarks/charpoly_integers.jl index ee048010f..d55428046 100644 --- a/benchmarks/charpoly_integers.jl +++ b/benchmarks/charpoly_integers.jl @@ -1,6 +1,6 @@ function benchmark_charpoly_int() print("benchmark_charpoly_int ... ") - M = matrix_space(FlintZZ, 80, 80)() + M = matrix_space(ZZ, 80, 80)() for i in 1:80 for j in 1:80 @@ -8,6 +8,6 @@ function benchmark_charpoly_int() end end - tt = @elapsed charpoly(polynomial_ring(FlintZZ, "x")[1], M) + tt = @elapsed charpoly(polynomial_ring(ZZ, "x")[1], M) println("$tt") end diff --git a/benchmarks/det_commutative_ring.jl b/benchmarks/det_commutative_ring.jl index fa29340d3..7da873873 100644 --- a/benchmarks/det_commutative_ring.jl +++ b/benchmarks/det_commutative_ring.jl @@ -1,7 +1,7 @@ function benchmark_znz_det() print("benchmark_znz_det ... ") n = 2003 * 1009 - Zn, = residue_ring(FlintZZ, n) + Zn, = residue_ring(ZZ, n) R, x = polynomial_ring(Zn, "x") M = matrix_space(R, 80, 80)() diff --git a/benchmarks/det_field.jl b/benchmarks/det_field.jl index 3110a9661..a8ddb5890 100644 --- a/benchmarks/det_field.jl +++ b/benchmarks/det_field.jl @@ -1,6 +1,6 @@ function benchmark_nf_det() print("benchmark_nf_det ... ") - QQx, x = polynomial_ring(FlintQQ, "x") + QQx, x = polynomial_ring(QQ, "x") K, a = AbsSimpleNumField(x^3 + 3*x + 1, "a") M = matrix_space(K, 80, 80)() diff --git a/benchmarks/det_polynomials.jl b/benchmarks/det_polynomials.jl index 02e98da76..39f4284e0 100644 --- a/benchmarks/det_polynomials.jl +++ b/benchmarks/det_polynomials.jl @@ -1,6 +1,6 @@ function benchmark_det_poly_ring() print("benchmark_det_poly_ring ... ") - ZZx, x = polynomial_ring(FlintZZ, "x") + ZZx, x = polynomial_ring(ZZ, "x") M = matrix_space(ZZx, 40, 40)() for i in 1:40 diff --git a/benchmarks/fateman.jl b/benchmarks/fateman.jl index 6e7550368..d2f1a2b68 100644 --- a/benchmarks/fateman.jl +++ b/benchmarks/fateman.jl @@ -1,6 +1,6 @@ function benchmark_fateman() print("benchmark_fateman ... ") - R, x = polynomial_ring(FlintZZ, "x") + R, x = polynomial_ring(ZZ, "x") S, y = polynomial_ring(R, "y") T, z = polynomial_ring(S, "z") U, t = polynomial_ring(T, "t") diff --git a/benchmarks/minpoly_finite_field.jl b/benchmarks/minpoly_finite_field.jl index 31d05e431..41c4d0034 100644 --- a/benchmarks/minpoly_finite_field.jl +++ b/benchmarks/minpoly_finite_field.jl @@ -1,7 +1,7 @@ function benchmark_minpoly_finite_field() print("benchmark_minpoly_finite_field ... ") - F, s = FlintFiniteField(103, 2, "s") + F, s = finite_field(103, 2, "s") M = matrix_space(F, 80, 80)() diff --git a/benchmarks/minpoly_integers.jl b/benchmarks/minpoly_integers.jl index 637a5ec6f..a37e54ec4 100644 --- a/benchmarks/minpoly_integers.jl +++ b/benchmarks/minpoly_integers.jl @@ -1,6 +1,6 @@ function benchmark_minpoly_integers() print("benchmark_minpoly_integers ... ") - M = matrix_space(FlintZZ, 80, 80)() + M = matrix_space(ZZ, 80, 80)() for i in 1:40 for j in 1:40 @@ -14,7 +14,7 @@ function benchmark_minpoly_integers() similarity!(M, rand(1:80), ZZRingElem(rand(-3:3))) end - tt = @elapsed minpoly(polynomial_ring(FlintZZ, "x")[1], M) + tt = @elapsed minpoly(polynomial_ring(ZZ, "x")[1], M) println("$tt") end diff --git a/benchmarks/solve_polynomials.jl b/benchmarks/solve_polynomials.jl index 79b97d129..6c38a51d2 100644 --- a/benchmarks/solve_polynomials.jl +++ b/benchmarks/solve_polynomials.jl @@ -1,6 +1,6 @@ function benchmark_solve_poly() print("benchmark_solve_poly ... ") - R, x = polynomial_ring(FlintZZ, "x") + R, x = polynomial_ring(ZZ, "x") S, y = polynomial_ring(R, "y") M = matrix_space(S, 20, 20)() diff --git a/docs/src/developer/parents.md b/docs/src/developer/parents.md index 46f1b2faa..a616a5435 100644 --- a/docs/src/developer/parents.md +++ b/docs/src/developer/parents.md @@ -45,7 +45,7 @@ As all elements and parents in Nemo are objects, those objects have types which we refer to as the element type and parent type respectively. For example, Flint integers have type `ZZRingElem` and the parent object they all -belong to, `FlintZZ` has type `ZZRing`. +belong to, `ZZ` has type `ZZRing`. More complex parents and elements are parameterised. For example, generic univariate polynomials over a base ring `R` are parameterised by `R`. The diff --git a/docs/src/integer.md b/docs/src/integer.md index 50ceda967..69aa5c397 100644 --- a/docs/src/integer.md +++ b/docs/src/integer.md @@ -8,15 +8,15 @@ end # Integers The default integer type in Nemo is provided by Flint. The associated ring of -integers is represented by the constant parent object called `FlintZZ`. +integers is represented by the constant parent object called `ZZ`. For convenience we define ``` -ZZ = FlintZZ +ZZ = ZZ ``` -so that integers can be constructed using `ZZ` instead of `FlintZZ`. Note that +so that integers can be constructed using `ZZ` instead of `ZZ`. Note that this is the name of a specific parent object, not the name of its type. The types of the integer ring parent objects and elements of the associated diff --git a/docs/src/qadic.md b/docs/src/qadic.md index 947d96bbc..2e83fea1e 100644 --- a/docs/src/qadic.md +++ b/docs/src/qadic.md @@ -146,9 +146,9 @@ c = R(2) k = precision(a) m = prime(R) n = valuation(b) -Qx, x = FlintQQ["x"] +Qx, x = QQ["x"] p = lift(Qx, a) -Zy, y = FlintZZ["y"] +Zy, y = ZZ["y"] q = lift(Zy, divexact(a, b)) ``` diff --git a/src/HeckeMiscFiniteField.jl b/src/HeckeMiscFiniteField.jl index bb7f07282..32d71a9f9 100644 --- a/src/HeckeMiscFiniteField.jl +++ b/src/HeckeMiscFiniteField.jl @@ -76,7 +76,7 @@ Base.eltype(::fqPolyRepField) = fqPolyRepFieldElem # FqPolyRepField function Base.iterate(F::FqPolyRepField) - return zero(F), zeros(FlintZZ, degree(F)) + return zero(F), zeros(ZZ, degree(F)) end function Base.iterate(F::FqPolyRepField, st::Vector{ZZRingElem}) diff --git a/src/HeckeMiscInteger.jl b/src/HeckeMiscInteger.jl index 9f005c4d9..cbc05d70e 100644 --- a/src/HeckeMiscInteger.jl +++ b/src/HeckeMiscInteger.jl @@ -249,7 +249,7 @@ for sym in (:trunc, :round, :ceil, :floor) # support `trunc(ZZRingElem, m)` etc. where m is a matrix of reals function Base.$sym(::Type{ZZMatrix}, a::Matrix{<:Real}) s = Base.size(a) - m = zero_matrix(FlintZZ, s[1], s[2]) + m = zero_matrix(ZZ, s[1], s[2]) for i = 1:s[1], j = 1:s[2] m[i, j] = Base.$sym(ZZRingElem, a[i, j]) end diff --git a/src/HeckeMiscMatrix.jl b/src/HeckeMiscMatrix.jl index a23232c0d..0ea222653 100644 --- a/src/HeckeMiscMatrix.jl +++ b/src/HeckeMiscMatrix.jl @@ -6,7 +6,7 @@ # This function is really slow... function denominator(M::QQMatrix) - d = one(FlintZZ) + d = one(ZZ) for i in 1:nrows(M) for j in 1:ncols(M) d = lcm!(d, d, denominator(M[i, j])) @@ -18,7 +18,7 @@ end transpose!(A::Union{ZZMatrix,QQMatrix}) = is_square(A) ? transpose!(A, A) : transpose(A) function matrix(A::Matrix{ZZRingElem}) - m = matrix(FlintZZ, A) + m = matrix(ZZ, A) return m end @@ -137,7 +137,7 @@ end It returns a lift of the matrix to the integers. """ function lift(a::Generic.Mat{EuclideanRingResidueRingElem{ZZRingElem}}) - z = zero_matrix(FlintZZ, nrows(a), ncols(a)) + z = zero_matrix(ZZ, nrows(a), ncols(a)) for i in 1:nrows(a) for j in 1:ncols(a) z[i, j] = lift(a[i, j]) @@ -147,7 +147,7 @@ function lift(a::Generic.Mat{EuclideanRingResidueRingElem{ZZRingElem}}) end function lift(a::ZZModMatrix) - z = zero_matrix(FlintZZ, nrows(a), ncols(a)) + z = zero_matrix(ZZ, nrows(a), ncols(a)) GC.@preserve a z begin for i in 1:nrows(a) for j in 1:ncols(a) @@ -166,7 +166,7 @@ function lift(x::FpMatrix) end function lift(a::Generic.Mat{ZZModRingElem}) - z = zero_matrix(FlintZZ, nrows(a), ncols(a)) + z = zero_matrix(ZZ, nrows(a), ncols(a)) for i in 1:nrows(a) for j in 1:ncols(a) z[i, j] = lift(a[i, j]) @@ -227,7 +227,7 @@ mod_sym!(M::ZZMatrix, B::Integer) = mod_sym!(M, ZZRingElem(B)) Reduces every entry modulo $p$ into the symmetric residue system. """ function mod_sym(M::ZZMatrix, B::ZZRingElem) - N = zero_matrix(FlintZZ, nrows(M), ncols(M)) + N = zero_matrix(ZZ, nrows(M), ncols(M)) ccall((:fmpz_mat_scalar_smod, libflint), Nothing, (Ref{ZZMatrix}, Ref{ZZMatrix}, Ref{ZZRingElem}), N, M, B) return N end @@ -293,11 +293,11 @@ left and/ or right transformation matrices are computed as well. """ function snf_with_transform(A::ZZMatrix, l::Bool=true, r::Bool=true) if r - R = identity_matrix(FlintZZ, ncols(A)) + R = identity_matrix(ZZ, ncols(A)) end if l - L = identity_matrix(FlintZZ, nrows(A)) + L = identity_matrix(ZZ, nrows(A)) end # TODO: if only one trafo is required, start with the HNF that does not # compute the trafo diff --git a/src/HeckeMiscPoly.jl b/src/HeckeMiscPoly.jl index 6de828a2f..94ca83ccc 100644 --- a/src/HeckeMiscPoly.jl +++ b/src/HeckeMiscPoly.jl @@ -195,7 +195,7 @@ end function roots(R::T, f::QQPolyRingElem) where {T<:Union{fqPolyRepField,fpField}} Rt, t = polynomial_ring(R, "t", cached=false) - fp = polynomial_ring(FlintZZ, cached=false)[1](f * denominator(f)) + fp = polynomial_ring(ZZ, cached=false)[1](f * denominator(f)) fpp = Rt(fp) return roots(fpp) end @@ -228,7 +228,7 @@ function is_power(a::Union{fpField, FpFieldElem, fqPolyRepFieldElem,FqPolyRepFie end s = order(parent(a)) if gcd(s - 1, m) == 1 - return true, a^invmod(FlintZZ(m), s - 1) + return true, a^invmod(ZZ(m), s - 1) end St, t = polynomial_ring(parent(a), "t", cached=false) f = t^m - a diff --git a/src/HeckeMoreStuff.jl b/src/HeckeMoreStuff.jl index 5a0712ea7..e1561718b 100644 --- a/src/HeckeMoreStuff.jl +++ b/src/HeckeMoreStuff.jl @@ -3,7 +3,7 @@ function Base.copy(a::ZZRingElem) end function QQMatrix(x::ZZMatrix) - z = zero_matrix(FlintQQ, nrows(x), ncols(x)) + z = zero_matrix(QQ, nrows(x), ncols(x)) ccall((:fmpq_mat_set_fmpz_mat, libflint), Nothing, (Ref{QQMatrix}, Ref{ZZMatrix}), z, x) return z end @@ -134,9 +134,9 @@ function roots(f::ZZModPolyRingElem, fac::Fac{ZZRingElem}) return _res end -ZZMatrix(M::Matrix{Int}) = matrix(FlintZZ, M) +ZZMatrix(M::Matrix{Int}) = matrix(ZZ, M) -order(::ZZRingElem) = FlintZZ +order(::ZZRingElem) = ZZ function sub!(z::Vector{QQFieldElem}, x::Vector{QQFieldElem}, y::Vector{ZZRingElem}) for i in 1:length(z) @@ -186,7 +186,7 @@ function Base.round(::Type{ZZRingElem}, x::ArbFieldElem) end function Base.round(::Type{ZZMatrix}, C::ArbMatrix) - v = zero_matrix(FlintZZ, nrows(C), ncols(C)) + v = zero_matrix(ZZ, nrows(C), ncols(C)) for i = 1:nrows(C) for j = 1:ncols(C) @@ -206,7 +206,7 @@ real(x::QQFieldElem) = x norm(x::ZZRingElem) = abs(x) -number_field(::ZZRing) = FlintQQ +number_field(::ZZRing) = QQ function Base.hash(f::zzModMPolyRingElem, h::UInt) return UInt(1) # TODO: enhance or throw error @@ -371,7 +371,7 @@ function basis(K::AbsSimpleNumField) return d end -base_field(_::AbsSimpleNumField) = FlintQQ +base_field(_::AbsSimpleNumField) = QQ ################################################################################ # @@ -512,7 +512,7 @@ $b\in Z[t]$, $\deg(a) = \deg(b)$ and $d>0$ minimal in $Z$. This function returns $b$. """ function numerator(a::AbsSimpleNumFieldElem) - _one = one(FlintZZ) + _one = one(ZZ) z = deepcopy(a) ccall((:nf_elem_set_den, libantic), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{ZZRingElem}, Ref{AbsSimpleNumField}), @@ -1364,7 +1364,7 @@ function lift(M::fqPolyRepMatrix, R::zzModRing) N = zero_matrix(R, nrows(M), ncols(M)) for i = 1:nrows(M) for j = 1:ncols(M) - N[i, j] = FlintZZ(coeff(M[i, j], 0)) + N[i, j] = ZZ(coeff(M[i, j], 0)) end end return N @@ -1479,7 +1479,7 @@ end Base.replace!(::typeof(-), m::ZZMatrix) = -m function (A::AbsSimpleNumField)(a::ZZPolyRingElem) - return A(FlintQQ["x"][1](a)) + return A(QQ["x"][1](a)) end diff --git a/src/Nemo.jl b/src/Nemo.jl index ae76c82f1..2edc43331 100644 --- a/src/Nemo.jl +++ b/src/Nemo.jl @@ -566,13 +566,12 @@ const _ecm_nCs = Vector{Int}[_ecm_nC] ############################################################################### # -# Set domain for ZZ, QQ, PadicField, finite_field to Flint +# Set domain for ZZ, QQ to Flint # ############################################################################### -const ZZ = FlintZZ -const QQ = FlintQQ -#const FiniteField = FlintFiniteField +const FlintZZ = ZZ +const FlintQQ = QQ ############################################################################### # diff --git a/src/antic/nf_elem.jl b/src/antic/nf_elem.jl index b19695d1e..8ad68a30c 100644 --- a/src/antic/nf_elem.jl +++ b/src/antic/nf_elem.jl @@ -1202,8 +1202,8 @@ supplied, a default dollar sign will be used to represent the variable. """ function cyclotomic_field(n::Int, s::VarName = "z_$n", t = "_\$"; cached = true) n > 0 || throw(ArgumentError("conductor must be positive, not $n")) - Zx, x = polynomial_ring(FlintZZ, gensym(); cached = false) - Qx, = polynomial_ring(FlintQQ, t; cached = cached) + Zx, x = polynomial_ring(ZZ, gensym(); cached = false) + Qx, = polynomial_ring(QQ, t; cached = cached) f = cyclotomic(n, x) C, g = number_field(Qx(f), Symbol(s); cached = cached, check = false) set_attribute!(C, :show => show_cyclo, :cyclo => n) @@ -1237,8 +1237,8 @@ constructed, should be printed. If it is not supplied, a default dollar sign will be used to represent the variable. """ function cyclotomic_real_subfield(n::Int, s::VarName = "(z_$n + 1/z_$n)", t = "\$"; cached = true) - Zx, x = polynomial_ring(FlintZZ, gensym(); cached = false) - Qx, = polynomial_ring(FlintQQ, t; cached = cached) + Zx, x = polynomial_ring(ZZ, gensym(); cached = false) + Qx, = polynomial_ring(QQ, t; cached = cached) f = cos_minpoly(n, x) R, a = number_field(Qx(f), Symbol(s); cached = cached, check = false) set_attribute!(R, :show => show_maxreal, :maxreal => n) diff --git a/src/arb/ComplexPoly.jl b/src/arb/ComplexPoly.jl index ed3e5ec60..b4c4e5a65 100644 --- a/src/arb/ComplexPoly.jl +++ b/src/arb/ComplexPoly.jl @@ -186,7 +186,7 @@ contained in the (constant) polynomial $x$, along with that integer $z$ in case it is, otherwise sets $t$ to `false`. """ function unique_integer(x::ComplexPoly) - z = ZZPolyRing(FlintZZ, var(parent(x)))() + z = ZZPolyRing(ZZ, var(parent(x)))() unique = ccall((:acb_poly_get_unique_fmpz_poly, libarb), Int, (Ref{ZZPolyRingElem}, Ref{ComplexPoly}), z, x) return (unique != 0, z) diff --git a/src/arb/RealPoly.jl b/src/arb/RealPoly.jl index 0efc4a7c0..b0c2f9654 100644 --- a/src/arb/RealPoly.jl +++ b/src/arb/RealPoly.jl @@ -176,7 +176,7 @@ contained in each of the coefficients of $x$, otherwise sets $t$ to `false`. In the former case, $z$ is set to the integer polynomial. """ function unique_integer(x::RealPoly) - z = ZZPolyRing(FlintZZ, var(parent(x)))() + z = ZZPolyRing(ZZ, var(parent(x)))() unique = ccall((:arb_poly_get_unique_fmpz_poly, libarb), Int, (Ref{ZZPolyRingElem}, Ref{RealPoly}), z, x) return (unique != 0, z) diff --git a/src/arb/acb_poly.jl b/src/arb/acb_poly.jl index 22968317a..8d1a17306 100644 --- a/src/arb/acb_poly.jl +++ b/src/arb/acb_poly.jl @@ -193,7 +193,7 @@ contained in the (constant) polynomial $x$, along with that integer $z$ in case it is, otherwise sets $t$ to `false`. """ function unique_integer(x::AcbPolyRingElem) - z = ZZPolyRing(FlintZZ, var(parent(x)))() + z = ZZPolyRing(ZZ, var(parent(x)))() unique = ccall((:acb_poly_get_unique_fmpz_poly, libarb), Int, (Ref{ZZPolyRingElem}, Ref{AcbPolyRingElem}), z, x) return (unique != 0, z) diff --git a/src/arb/arb_poly.jl b/src/arb/arb_poly.jl index eb07ee06a..8bb85aeab 100644 --- a/src/arb/arb_poly.jl +++ b/src/arb/arb_poly.jl @@ -189,7 +189,7 @@ contained in each of the coefficients of $x$, otherwise sets $t$ to `false`. In the former case, $z$ is set to the integer polynomial. """ function unique_integer(x::ArbPolyRingElem) - z = ZZPolyRing(FlintZZ, var(parent(x)))() + z = ZZPolyRing(ZZ, var(parent(x)))() unique = ccall((:arb_poly_get_unique_fmpz_poly, libarb), Int, (Ref{ZZPolyRingElem}, Ref{ArbPolyRingElem}), z, x) return (unique != 0, z) diff --git a/src/calcium/qqbar.jl b/src/calcium/qqbar.jl index 0f23a7b0b..c7aad9b57 100644 --- a/src/calcium/qqbar.jl +++ b/src/calcium/qqbar.jl @@ -34,7 +34,7 @@ characteristic(::QQBarField) = 0 # todo: want a C function for this function Base.hash(a::QQBarFieldElem, h::UInt) - R, x = polynomial_ring(FlintZZ, "x") + R, x = polynomial_ring(ZZ, "x") return xor(hash(minpoly(R, a)), h) end diff --git a/src/flint/FlintTypes.jl b/src/flint/FlintTypes.jl index 2488c353b..fae885e47 100644 --- a/src/flint/FlintTypes.jl +++ b/src/flint/FlintTypes.jl @@ -35,7 +35,7 @@ julia> ZZ(2)^100 struct ZZRing <: Ring end -const FlintZZ = ZZRing() +const ZZ = ZZRing() integer_ring() = ZZRing() @@ -163,9 +163,9 @@ julia> QQ(1//6) - QQ(1//7) struct QQField <: FracField{ZZRingElem} end -const FlintQQ = QQField() +const QQ = QQField() -rational_field() = FlintQQ +rational_field() = QQ @doc qq_field_doc mutable struct QQFieldElem <: FracElem{ZZRingElem} diff --git a/src/flint/fmpq.jl b/src/flint/fmpq.jl index b91be9478..deb90a1a7 100644 --- a/src/flint/fmpq.jl +++ b/src/flint/fmpq.jl @@ -28,13 +28,13 @@ QQFieldElem(a::ZZRingElem, b::Integer) = QQFieldElem(a, ZZRingElem(b)) QQFieldElem(a::Integer, b::ZZRingElem) = QQFieldElem(ZZRingElem(a), b) -parent(a::QQFieldElem) = FlintQQ +parent(a::QQFieldElem) = QQ parent_type(::Type{QQFieldElem}) = QQField elem_type(::Type{QQField}) = QQFieldElem -base_ring(a::QQField) = FlintZZ +base_ring(a::QQField) = ZZ is_domain_type(::Type{QQFieldElem}) = true @@ -1230,4 +1230,4 @@ Rational(z::ZZRingElem) = Rational{BigInt}(z) # ############################################################################### -fraction_field(base::ZZRing) = FlintQQ +fraction_field(base::ZZRing) = QQ diff --git a/src/flint/fmpq_abs_series.jl b/src/flint/fmpq_abs_series.jl index 9839d33f5..87a3c9ee1 100644 --- a/src/flint/fmpq_abs_series.jl +++ b/src/flint/fmpq_abs_series.jl @@ -26,7 +26,7 @@ elem_type(::Type{QQAbsPowerSeriesRing}) = QQAbsPowerSeriesRingElem parent_type(::Type{QQAbsPowerSeriesRingElem}) = QQAbsPowerSeriesRing -base_ring(R::QQAbsPowerSeriesRing) = FlintQQ +base_ring(R::QQAbsPowerSeriesRing) = QQ abs_series_type(::Type{QQFieldElem}) = QQAbsPowerSeriesRingElem diff --git a/src/flint/fmpq_mat.jl b/src/flint/fmpq_mat.jl index 8f1776962..01901e68d 100644 --- a/src/flint/fmpq_mat.jl +++ b/src/flint/fmpq_mat.jl @@ -14,9 +14,9 @@ elem_type(::Type{QQMatrixSpace}) = QQMatrix parent_type(::Type{QQMatrix}) = QQMatrixSpace -base_ring(a::QQMatrixSpace) = FlintQQ +base_ring(a::QQMatrixSpace) = QQ -base_ring(a::QQMatrix) = FlintQQ +base_ring(a::QQMatrix) = QQ dense_matrix_type(::Type{QQFieldElem}) = QQMatrix @@ -1106,7 +1106,7 @@ end ################################################################################ function nullspace(A::QQMatrix) - AZZ = zero_matrix(FlintZZ, nrows(A), ncols(A)) + AZZ = zero_matrix(ZZ, nrows(A), ncols(A)) ccall((:fmpq_mat_get_fmpz_mat_rowwise, libflint), Nothing, (Ref{ZZMatrix}, Ptr{Nothing}, Ref{QQMatrix}), AZZ, C_NULL, A) N = similar(AZZ, ncols(A), ncols(A)) @@ -1125,8 +1125,8 @@ function nullspace(A::QQMatrix) NQQ = view(NQQ, 1:nrows(NQQ), 1:nullity) # Produce a 1 in the lowest non-zero entry of any column - s = FlintQQ() - t = FlintQQ() + s = QQ() + t = QQ() for j in 1:nullity # Find lowest non-zero entry for i in nrows(NQQ):-1:1 diff --git a/src/flint/fmpq_mpoly.jl b/src/flint/fmpq_mpoly.jl index d27211d43..691528da9 100644 --- a/src/flint/fmpq_mpoly.jl +++ b/src/flint/fmpq_mpoly.jl @@ -28,7 +28,7 @@ end number_of_variables(a::QQMPolyRing) = ccall((:fmpq_mpoly_ctx_nvars, libflint), Int, (Ref{QQMPolyRing}, ), a) -base_ring(a::QQMPolyRing) = FlintQQ +base_ring(a::QQMPolyRing) = QQ function internal_ordering(a::QQMPolyRing) b = ccall((:fmpq_mpoly_ctx_ord, libflint), Cint, (Ref{QQMPolyRing}, ), a) @@ -1218,8 +1218,8 @@ end function (R::QQMPolyRing)(a::Vector{Any}, b::Vector{Vector{T}}) where T n = nvars(R) length(a) != length(b) && error("Coefficient and exponent vector must have the same length") - newa = map(FlintQQ, a) - newb = map(x -> map(FlintZZ, x), b) + newa = map(QQ, a) + newb = map(x -> map(ZZ, x), b) newaa = convert(Vector{QQFieldElem}, newa) newbb = convert(Vector{Vector{ZZRingElem}}, newb) diff --git a/src/flint/fmpq_poly.jl b/src/flint/fmpq_poly.jl index 3508b2284..dcba1e7a6 100644 --- a/src/flint/fmpq_poly.jl +++ b/src/flint/fmpq_poly.jl @@ -16,7 +16,7 @@ elem_type(::Type{QQPolyRing}) = QQPolyRingElem dense_poly_type(::Type{QQFieldElem}) = QQPolyRingElem -base_ring(a::QQPolyRing) = FlintQQ +base_ring(a::QQPolyRing) = QQ parent(a::QQPolyRingElem) = a.parent diff --git a/src/flint/fmpq_rel_series.jl b/src/flint/fmpq_rel_series.jl index 2f40cf84c..0ef5b5a7a 100644 --- a/src/flint/fmpq_rel_series.jl +++ b/src/flint/fmpq_rel_series.jl @@ -22,7 +22,7 @@ elem_type(::Type{QQRelPowerSeriesRing}) = QQRelPowerSeriesRingElem parent_type(::Type{QQRelPowerSeriesRingElem}) = QQRelPowerSeriesRing -base_ring(R::QQRelPowerSeriesRing) = FlintQQ +base_ring(R::QQRelPowerSeriesRing) = QQ rel_series_type(::Type{QQFieldElem}) = QQRelPowerSeriesRingElem diff --git a/src/flint/fmpz.jl b/src/flint/fmpz.jl index 0c408fc71..1451c7b0b 100644 --- a/src/flint/fmpz.jl +++ b/src/flint/fmpz.jl @@ -43,9 +43,9 @@ parent_type(::Type{ZZRingElem}) = ZZRing @doc raw""" parent(a::ZZRingElem) -Returns the unique Flint integer parent object `FlintZZ`. +Returns the unique Flint integer parent object `ZZ`. """ -parent(a::ZZRingElem) = FlintZZ +parent(a::ZZRingElem) = ZZ elem_type(::Type{ZZRing}) = ZZRingElem @@ -1279,11 +1279,11 @@ and $b$ and integers $s$ and $t$ such that $g = as + bt$. """ function gcdx(a::ZZRingElem, b::ZZRingElem) # Just to conform with Julia's definition - a == b == 0 && return zero(FlintZZ), one(FlintZZ), zero(FlintZZ) + a == b == 0 && return zero(ZZ), one(ZZ), zero(ZZ) - d = FlintZZ() - x = FlintZZ() - y = FlintZZ() + d = ZZ() + x = ZZ() + y = ZZ() ccall((:fmpz_xgcd_canonical_bezout, libflint), Nothing, (Ref{ZZRingElem}, Ref{ZZRingElem}, Ref{ZZRingElem}, Ref{ZZRingElem}, Ref{ZZRingElem}), d, x, y, a, b) return d, x, y @@ -1599,7 +1599,7 @@ function divisors end function divisors(a::ZZRingElem) iszero(a) && throw(DomainError("Argument must be non-zero")) - divs = ZZRingElem[one(FlintZZ)] + divs = ZZRingElem[one(ZZ)] isone(a) && return divs for (p,e) in factor(a) @@ -1613,7 +1613,7 @@ function divisors(a::ZZRingElem) return divs end -divisors(a::Int) = Int.(divisors(FlintZZ(a))) +divisors(a::Int) = Int.(divisors(ZZ(a))) @doc raw""" prime_divisors(a::ZZRingElem) @@ -1630,7 +1630,7 @@ end Return the prime divisors of $a$ in an array. We require $a \neq 0$. """ -prime_divisors(a::Int) = Int.(prime_divisors(FlintZZ(a))) +prime_divisors(a::Int) = Int.(prime_divisors(ZZ(a))) is_prime(x::UInt) = Bool(ccall((:n_is_prime, libflint), Cint, (UInt,), x)) @@ -2312,7 +2312,7 @@ popcount(x::ZZRingElem) = Int(ccall((:fmpz_popcnt, libflint), UInt, Return the previous power of $2$ up to including $x$. """ prevpow2(x::ZZRingElem) = x < 0 ? -prevpow2(-x) : - (x <= 2 ? x : one(FlintZZ) << (ndigits(x, 2) - 1)) + (x <= 2 ? x : one(ZZ) << (ndigits(x, 2) - 1)) @doc raw""" nextpow2(x::ZZRingElem) @@ -2327,7 +2327,7 @@ julia> nextpow2(ZZ(12)) ``` """ nextpow2(x::ZZRingElem) = x < 0 ? -nextpow2(-x) : - (x <= 2 ? x : one(FlintZZ) << ndigits(x - 1, 2)) + (x <= 2 ? x : one(ZZ) << ndigits(x - 1, 2)) @doc raw""" trailing_zeros(x::ZZRingElem) diff --git a/src/flint/fmpz_abs_series.jl b/src/flint/fmpz_abs_series.jl index d7b479020..c94590c03 100644 --- a/src/flint/fmpz_abs_series.jl +++ b/src/flint/fmpz_abs_series.jl @@ -25,7 +25,7 @@ elem_type(::Type{ZZAbsPowerSeriesRing}) = ZZAbsPowerSeriesRingElem parent_type(::Type{ZZAbsPowerSeriesRingElem}) = ZZAbsPowerSeriesRing -base_ring(R::ZZAbsPowerSeriesRing) = FlintZZ +base_ring(R::ZZAbsPowerSeriesRing) = ZZ abs_series_type(::Type{ZZRingElem}) = ZZAbsPowerSeriesRingElem diff --git a/src/flint/fmpz_laurent_series.jl b/src/flint/fmpz_laurent_series.jl index cfc5cb1af..32f366127 100644 --- a/src/flint/fmpz_laurent_series.jl +++ b/src/flint/fmpz_laurent_series.jl @@ -28,7 +28,7 @@ parent(a::ZZLaurentSeriesRingElem) = a.parent elem_type(::Type{ZZLaurentSeriesRing}) = ZZLaurentSeriesRingElem -base_ring(R::ZZLaurentSeriesRing) = FlintZZ +base_ring(R::ZZLaurentSeriesRing) = ZZ is_domain_type(::Type{ZZLaurentSeriesRingElem}) = true diff --git a/src/flint/fmpz_mat.jl b/src/flint/fmpz_mat.jl index e52b36e9e..e1b1cb9bb 100644 --- a/src/flint/fmpz_mat.jl +++ b/src/flint/fmpz_mat.jl @@ -14,9 +14,9 @@ elem_type(::Type{ZZMatrixSpace}) = ZZMatrix parent_type(::Type{ZZMatrix}) = ZZMatrixSpace -base_ring(a::ZZMatrixSpace) = FlintZZ +base_ring(a::ZZMatrixSpace) = ZZ -base_ring(a::ZZMatrix) = FlintZZ +base_ring(a::ZZMatrix) = ZZ dense_matrix_type(::Type{ZZRingElem}) = ZZMatrix diff --git a/src/flint/fmpz_mod.jl b/src/flint/fmpz_mod.jl index 3ff497190..8d759b524 100644 --- a/src/flint/fmpz_mod.jl +++ b/src/flint/fmpz_mod.jl @@ -14,7 +14,7 @@ parent_type(::Type{ZZModRingElem}) = ZZModRing elem_type(::Type{ZZModRing}) = ZZModRingElem -base_ring(a::ZZModRing) = FlintZZ +base_ring(a::ZZModRing) = ZZ parent(a::ZZModRingElem) = a.parent diff --git a/src/flint/fmpz_mod_mpoly.jl b/src/flint/fmpz_mod_mpoly.jl index 314115dd0..ec916f53e 100644 --- a/src/flint/fmpz_mod_mpoly.jl +++ b/src/flint/fmpz_mod_mpoly.jl @@ -1047,7 +1047,7 @@ function (R::($rtype))(a::Vector, b::Vector{Vector{T}}) where T n = nvars(R) length(a) != length(b) && error("Coefficient and exponent vector must have the same length") newa = map(base_ring(R), a) - newb = map(x -> map(FlintZZ, x), b) + newb = map(x -> map(ZZ, x), b) newaa = convert(Vector{($ctype)}, newa) newbb = convert(Vector{Vector{ZZRingElem}}, newb) for i in 1:length(newbb) diff --git a/src/flint/fmpz_mpoly.jl b/src/flint/fmpz_mpoly.jl index 0eef820fa..cb241d1c0 100644 --- a/src/flint/fmpz_mpoly.jl +++ b/src/flint/fmpz_mpoly.jl @@ -28,7 +28,7 @@ end number_of_variables(a::ZZMPolyRing) = ccall((:fmpz_mpoly_ctx_nvars, libflint), Int, (Ref{ZZMPolyRing}, ), a) -base_ring(a::ZZMPolyRing) = FlintZZ +base_ring(a::ZZMPolyRing) = ZZ function internal_ordering(a::ZZMPolyRing) b = ccall((:fmpz_mpoly_ctx_ord, libflint), Cint, (Ref{ZZMPolyRing}, ), a) @@ -1128,8 +1128,8 @@ end function (R::ZZMPolyRing)(a::Vector{Any}, b::Vector{Vector{T}}) where T n = nvars(R) length(a) != length(b) && error("Coefficient and exponent vector must have the same length") - newa = map(FlintZZ, a) - newb = map(x -> map(FlintZZ, x), b) + newa = map(ZZ, a) + newb = map(x -> map(ZZ, x), b) newaa = convert(Vector{ZZRingElem}, newa) newbb = convert(Vector{Vector{ZZRingElem}}, newb) diff --git a/src/flint/fmpz_poly.jl b/src/flint/fmpz_poly.jl index 6156832ad..f1bc8e551 100644 --- a/src/flint/fmpz_poly.jl +++ b/src/flint/fmpz_poly.jl @@ -16,7 +16,7 @@ elem_type(::Type{ZZPolyRing}) = ZZPolyRingElem dense_poly_type(::Type{ZZRingElem}) = ZZPolyRingElem -base_ring(a::ZZPolyRing) = FlintZZ +base_ring(a::ZZPolyRing) = ZZ parent(a::ZZPolyRingElem) = a.parent diff --git a/src/flint/fmpz_rel_series.jl b/src/flint/fmpz_rel_series.jl index 2756dc6a4..98e7bf518 100644 --- a/src/flint/fmpz_rel_series.jl +++ b/src/flint/fmpz_rel_series.jl @@ -22,7 +22,7 @@ elem_type(::Type{ZZRelPowerSeriesRing}) = ZZRelPowerSeriesRingElem parent_type(::Type{ZZRelPowerSeriesRingElem}) = ZZRelPowerSeriesRing -base_ring(R::ZZRelPowerSeriesRing) = FlintZZ +base_ring(R::ZZRelPowerSeriesRing) = ZZ rel_series_type(::Type{ZZRingElem}) = ZZRelPowerSeriesRingElem diff --git a/src/flint/fq_default.jl b/src/flint/fq_default.jl index 6058635e1..0beb99ee0 100644 --- a/src/flint/fq_default.jl +++ b/src/flint/fq_default.jl @@ -837,7 +837,7 @@ end ############################################################################### # -# FlintFiniteField constructor +# FqField constructor # ############################################################################### diff --git a/src/flint/fq_nmod_mpoly.jl b/src/flint/fq_nmod_mpoly.jl index bc2cda09c..4cf476783 100644 --- a/src/flint/fq_nmod_mpoly.jl +++ b/src/flint/fq_nmod_mpoly.jl @@ -1091,7 +1091,7 @@ function (R::fqPolyRepMPolyRing)(a::Vector{<:Any}, b::Vector{Vector{T}}) where T n = nvars(R) length(a) != length(b) && error("Coefficient and exponent vector must have the same length") newa = map(base_ring(R), a) - newb = map(x -> map(FlintZZ, x), b) + newb = map(x -> map(ZZ, x), b) newaa = convert(Vector{fqPolyRepFieldElem}, newa) newbb = convert(Vector{Vector{ZZRingElem}}, newb) diff --git a/src/flint/nmod.jl b/src/flint/nmod.jl index 9e3802c83..fda2fae86 100644 --- a/src/flint/nmod.jl +++ b/src/flint/nmod.jl @@ -14,7 +14,7 @@ parent_type(::Type{zzModRingElem}) = zzModRing elem_type(::Type{zzModRing}) = zzModRingElem -base_ring(a::zzModRing) = FlintZZ +base_ring(a::zzModRing) = ZZ parent(a::zzModRingElem) = a.parent diff --git a/src/flint/nmod_mpoly.jl b/src/flint/nmod_mpoly.jl index f5cdb02d3..812697b37 100644 --- a/src/flint/nmod_mpoly.jl +++ b/src/flint/nmod_mpoly.jl @@ -1152,7 +1152,7 @@ function (R::($rtype))(a::Vector, b::Vector{Vector{T}}) where T n = nvars(R) length(a) != length(b) && error("Coefficient and exponent vector must have the same length") newa = map(base_ring(R), a) - newb = map(x -> map(FlintZZ, x), b) + newb = map(x -> map(ZZ, x), b) newaa = convert(Vector{($ctype)}, newa) newbb = convert(Vector{Vector{ZZRingElem}}, newb) for i in 1:length(newbb) diff --git a/src/flint/padic.jl b/src/flint/padic.jl index b541b46fc..d30b73621 100644 --- a/src/flint/padic.jl +++ b/src/flint/padic.jl @@ -99,7 +99,7 @@ function Base.deepcopy_internal(a::PadicFieldElem, dict::IdDict) end function Base.hash(a::PadicFieldElem, h::UInt) - return xor(hash(lift(FlintQQ, a), h), xor(hash(prime(parent(a)), h), h)) + return xor(hash(lift(QQ, a), h), xor(hash(prime(parent(a)), h), h)) end @doc raw""" @@ -225,18 +225,18 @@ function expressify(x::PadicFieldElem; context = nothing) if iszero(x) push!(sum.args, 0) elseif pmode == 0 # terse - push!(sum.args, expressify(lift(FlintQQ, x), context = context)) + push!(sum.args, expressify(lift(QQ, x), context = context)) else pp = prime(parent(x)) p = BigInt(pp) v = valuation(x) if v >= 0 - u = BigInt(lift(FlintZZ, x)) + u = BigInt(lift(ZZ, x)) if v > 0 u = div(u, p^v) end else - u = lift(FlintZZ, x*p^-v) + u = lift(ZZ, x*p^-v) end if pmode == 1 # series diff --git a/src/flint/qadic.jl b/src/flint/qadic.jl index 7c59c9a59..ab6845e82 100644 --- a/src/flint/qadic.jl +++ b/src/flint/qadic.jl @@ -116,7 +116,7 @@ function Base.deepcopy_internal(a::QadicFieldElem, dict::IdDict{Any, Any}) end function Base.hash(a::QadicFieldElem, h::UInt) - return xor(hash(lift(QQPolyRing(FlintQQ, :x), a), h), + return xor(hash(lift(QQPolyRing(QQ, :x), a), h), xor(hash([prime(parent(a)),degree(parent(a))], h), h)) end diff --git a/src/gaussiannumbers/ZZi.jl b/src/gaussiannumbers/ZZi.jl index 920e68723..33ee95125 100644 --- a/src/gaussiannumbers/ZZi.jl +++ b/src/gaussiannumbers/ZZi.jl @@ -10,9 +10,9 @@ parent_type(::Type{ZZiRingElem}) = ZZiRing parent(a::ZZiRingElem) = FlintZZi -base_ring(a::ZZiRing) = FlintZZ +base_ring(a::ZZiRing) = ZZ -base_ring(a::ZZiRingElem) = FlintZZ +base_ring(a::ZZiRingElem) = ZZ is_domain_type(::Type{ZZiRingElem}) = true @@ -125,7 +125,7 @@ end function rand_bits(::ZZiRing, b::Int) t = rand(0:b) - return ZZiRingElem(rand_bits(FlintZZ, t), rand_bits(FlintZZ, b - t)) + return ZZiRingElem(rand_bits(ZZ, t), rand_bits(ZZ, b - t)) end ############################################################################### @@ -758,7 +758,7 @@ function gcdx(a::ZZiRingElem, b::ZZiRingElem) u = canonical_unit(a) return (divexact(a, u), inv(u), zero(FlintZZi)) end - m = zero_matrix(FlintZZ, 4, 2) + m = zero_matrix(ZZ, 4, 2) m[1,1] = a.x; m[1,2] = a.y m[2,1] = -a.y; m[2,2] = a.x m[3,1] = b.x; m[3,2] = b.y diff --git a/src/gaussiannumbers/continued_fraction.jl b/src/gaussiannumbers/continued_fraction.jl index 2d69d6c1f..26d88dcdc 100644 --- a/src/gaussiannumbers/continued_fraction.jl +++ b/src/gaussiannumbers/continued_fraction.jl @@ -228,7 +228,7 @@ end function continued_fraction_with_matrix(x::QQFieldElem; limit::Int = 0) cf, m = _continued_fraction_exact(numerator(x), denominator(x), limit, true) - return cf, matrix(FlintZZ, 2, 2, [m...]) + return cf, matrix(ZZ, 2, 2, [m...]) end function _doit_ball!( @@ -335,7 +335,7 @@ fraction of $x$ along with the matrix giving the last two convergents. function continued_fraction_with_matrix(x::ArbFieldElem; limit::Int = 0) xln, xld, xrn, xrd = _left_and_right(x) cf, m = _continued_fraction_ball(xln, xld, xrn, xrd, limit, true) - return cf, matrix(FlintZZ, 2, 2, [m...]) + return cf, matrix(ZZ, 2, 2, [m...]) end ############################################################################### diff --git a/test/HeckeMiscLocalization-test.jl b/test/HeckeMiscLocalization-test.jl index 860487033..1d6d674d0 100644 --- a/test/HeckeMiscLocalization-test.jl +++ b/test/HeckeMiscLocalization-test.jl @@ -1,7 +1,7 @@ @testset "Localization" begin - R = FlintZZ - Qx, x = FlintQQ["x"] + R = ZZ + Qx, x = QQ["x"] @testset "Constructor" begin @@ -9,13 +9,13 @@ L = localization(R, 17) @test elem_type(L) == LocalizedEuclideanRingElem{ZZRingElem} - @test base_ring(L) == FlintZZ - @test base_ring(L()) == FlintZZ + @test base_ring(L) == ZZ + @test base_ring(L()) == ZZ L = localization(R, [2, R(3)]) @test elem_type(L) == LocalizedEuclideanRingElem{ZZRingElem} - @test base_ring(L) == FlintZZ - @test base_ring(L()) == FlintZZ + @test base_ring(L) == ZZ + @test base_ring(L()) == ZZ @test parent_type(LocalizedEuclideanRingElem{QQPolyRingElem}) == LocalizedEuclideanRing{QQPolyRingElem} diff --git a/test/Rings-test.jl b/test/Rings-test.jl index fa8524318..b7bcbbca1 100644 --- a/test/Rings-test.jl +++ b/test/Rings-test.jl @@ -1,5 +1,5 @@ -const ring_to_mat = Dict(FlintZZ => ZZMatrix, - FlintQQ => QQMatrix, +const ring_to_mat = Dict(ZZ => ZZMatrix, + QQ => QQMatrix, residue_ring(ZZ, 9)[1] => zzModMatrix, GF(5) => fpMatrix, finite_field(3, 2, "b")[1] => fqPolyRepMatrix, diff --git a/test/antic/nf_elem-test.jl b/test/antic/nf_elem-test.jl index 10674fb6a..0dffd6354 100644 --- a/test/antic/nf_elem-test.jl +++ b/test/antic/nf_elem-test.jl @@ -56,7 +56,7 @@ end @testset "AbsSimpleNumFieldElem.fmpz_mat_conversions" begin R, x = polynomial_ring(QQ, "x") K, a = number_field(x^3 + 3x + 1, "a") - M = matrix_space(FlintZZ, 1, 3)(0) + M = matrix_space(ZZ, 1, 3)(0) M[1, 1] = 1 M[1, 2] = 2 @@ -70,7 +70,7 @@ end Nemo.elem_to_mat_row!(M, 1, d, b) @test d == 3 - @test M == matrix_space(FlintZZ, 1, 3)([1 1 5]) + @test M == matrix_space(ZZ, 1, 3)([1 1 5]) end @testset "AbsSimpleNumFieldElem.fmpq_poly_conversion" begin @@ -315,12 +315,12 @@ end K, a = number_field(x^2 + 28, "a") b = -1//4 * a + 1//2 Mb = representation_matrix(b) - @test base_ring(Mb) == FlintQQ - @test Mb == FlintQQ[1//2 -1//4; 7 1//2] + @test base_ring(Mb) == QQ + @test Mb == QQ[1//2 -1//4; 7 1//2] Mbb, d = representation_matrix_q(b) - @test Mbb == FlintZZ[2 -1; 28 2] + @test Mbb == ZZ[2 -1; 28 2] @test d == 4 - @test base_ring(Mbb) == FlintZZ + @test base_ring(Mbb) == ZZ end @testset "AbsSimpleNumFieldElem.Polynomials" begin diff --git a/test/calcium/ca-test.jl b/test/calcium/ca-test.jl index 337d98563..42b5dd1f8 100644 --- a/test/calcium/ca-test.jl +++ b/test/calcium/ca-test.jl @@ -243,10 +243,10 @@ end c = C(1+2im) t = C(pi) - @test FlintZZ(n) == 3 + @test ZZ(n) == 3 - @test FlintQQ(h) == QQFieldElem(1) // 2 - @test_throws ErrorException FlintZZ(h) + @test QQ(h) == QQFieldElem(1) // 2 + @test_throws ErrorException ZZ(h) @test CalciumQQBar(h) == QQBarFieldElem(1) // 2 @test CalciumQQBar(c) == QQBarFieldElem(1+2im) diff --git a/test/calcium/qqbar-test.jl b/test/calcium/qqbar-test.jl index 0db92cff3..67ff2d042 100644 --- a/test/calcium/qqbar-test.jl +++ b/test/calcium/qqbar-test.jl @@ -103,8 +103,8 @@ end @test (u >> 3) == u // 8 @test (u << 3) == 8 * u - ZZx, x = polynomial_ring(FlintZZ, "x") - QQy, y = polynomial_ring(FlintQQ, "x") + ZZx, x = polynomial_ring(ZZ, "x") + QQy, y = polynomial_ring(QQ, "x") @test minpoly(ZZx, u) == x^2 - 2 @test minpoly(QQy, u) == y^2 - 2 diff --git a/test/flint/fmpq-test.jl b/test/flint/fmpq-test.jl index e1f7b508a..c2fd168d8 100644 --- a/test/flint/fmpq-test.jl +++ b/test/flint/fmpq-test.jl @@ -6,7 +6,7 @@ end @testset "QQFieldElem.conformance_tests" begin # TODO: make this work with test_Field_interface_recursive - test_Field_interface_recursive(FlintQQ) + test_Field_interface_recursive(QQ) end @testset "QQFieldElem.issingletontype" begin @@ -56,7 +56,7 @@ end @test QQFieldElem(3, -5) == -QQFieldElem(3, 5) - @test FlintQQ(2//typemin(Int)) == 1//(div(typemin(Int), 2)) + @test QQ(2//typemin(Int)) == 1//(div(typemin(Int), 2)) @test QQFieldElem(2^62, 1) == 2^62 @@ -81,7 +81,7 @@ end @testset "QQFieldElem.rand" begin for bits in 1:100 - t = rand_bits(FlintQQ, bits) + t = rand_bits(QQ, bits) @test height_bits(t) <= bits end @@ -93,7 +93,7 @@ end end @testset "QQFieldElem.printing" begin - a = FlintQQ(1, 2) + a = QQ(1, 2) @test string(a) == "1//2" end @@ -596,7 +596,7 @@ end @testset "QQFieldElem.unsafe" begin a = QQFieldElem(32//17) b = QQFieldElem(23//11) - c = one(FlintQQ) + c = one(QQ) b_copy = deepcopy(b) c_copy = deepcopy(c) @@ -630,12 +630,12 @@ end end @testset "QQFieldElem.printing" begin - @test FlintQQ === rational_field() - @test PrettyPrinting.detailed(FlintQQ) == "Rational field" - @test PrettyPrinting.oneline(FlintQQ) == "Rational field" - @test PrettyPrinting.supercompact(FlintQQ) == "QQ" + @test QQ === rational_field() + @test PrettyPrinting.detailed(QQ) == "Rational field" + @test PrettyPrinting.oneline(QQ) == "Rational field" + @test PrettyPrinting.supercompact(QQ) == "QQ" io = PrettyPrinting.pretty(IOBuffer()) - print(IOContext(io, :supercompact => true), PrettyPrinting.Lowercase(), FlintQQ) + print(IOContext(io, :supercompact => true), PrettyPrinting.Lowercase(), QQ) @test String(take!(io)) == "QQ" end diff --git a/test/flint/fmpq_mat-test.jl b/test/flint/fmpq_mat-test.jl index 6fa5772ab..7937779c1 100644 --- a/test/flint/fmpq_mat-test.jl +++ b/test/flint/fmpq_mat-test.jl @@ -4,7 +4,7 @@ @test elem_type(S) == QQMatrix @test elem_type(QQMatrixSpace) == QQMatrix @test parent_type(QQMatrix) == QQMatrixSpace - @test base_ring(S) == FlintQQ + @test base_ring(S) == QQ @test nrows(S) == 3 @test ncols(S) == 3 @@ -87,31 +87,31 @@ arr2 = [1, 2, 3, 4, 5, 6] for T in [ZZRingElem, Int, BigInt, Rational{Int}, Rational{BigInt}] - M = matrix(FlintQQ, map(T, arr)) + M = matrix(QQ, map(T, arr)) @test isa(M, QQMatrix) - @test base_ring(M) == FlintQQ + @test base_ring(M) == QQ - M2 = matrix(FlintQQ, 2, 3, map(T, arr2)) + M2 = matrix(QQ, 2, 3, map(T, arr2)) @test isa(M2, QQMatrix) - @test base_ring(M2) == FlintQQ + @test base_ring(M2) == QQ @test nrows(M2) == 2 @test ncols(M2) == 3 - @test_throws ErrorConstrDimMismatch matrix(FlintQQ, 2, 2, map(T, arr2)) - @test_throws ErrorConstrDimMismatch matrix(FlintQQ, 2, 4, map(T, arr2)) + @test_throws ErrorConstrDimMismatch matrix(QQ, 2, 2, map(T, arr2)) + @test_throws ErrorConstrDimMismatch matrix(QQ, 2, 4, map(T, arr2)) end - M3 = zero_matrix(FlintQQ, 2, 3) + M3 = zero_matrix(QQ, 2, 3) @test isa(M3, QQMatrix) - @test base_ring(M3) == FlintQQ + @test base_ring(M3) == QQ - M4 = identity_matrix(FlintQQ, 3) + M4 = identity_matrix(QQ, 3) @test isa(M4, QQMatrix) - @test base_ring(M4) == FlintQQ + @test base_ring(M4) == QQ - a = zero_matrix(FlintQQ, 2, 2) - b = zero_matrix(FlintQQ, 2, 3) + a = zero_matrix(QQ, 2, 2) + b = zero_matrix(QQ, 2, 3) @test a in [a, b] @test a in [b, a] @test !(a in [b]) @@ -147,7 +147,7 @@ end end @testset "QQMatrix.is_zero_entry" begin - M = matrix(FlintQQ, [1 2 3;4 0 6;0 8 9]) + M = matrix(QQ, [1 2 3;4 0 6;0 8 9]) for i in 1:3, j in 1:3 @test is_zero_entry(M, i, j) == (M[i, j] == 0) end @@ -193,7 +193,7 @@ end @test deepcopy(A) == A - a = matrix(FlintQQ, 4, 4, [-1//2 ZZRingElem(2)^100 3 -4; 5 -1//2 ZZRingElem(2)^100 6; 7 5 -1//2 8; 9 10 11 12]) + a = matrix(QQ, 4, 4, [-1//2 ZZRingElem(2)^100 3 -4; 5 -1//2 ZZRingElem(2)^100 6; 7 5 -1//2 8; 9 10 11 12]) @test hash(a, UInt(5)) == hash(deepcopy(a), UInt(5)) @test hash(view(a, 1,1, 2,2)) == hash(view(a, 1,1, 2,2)) @@ -257,14 +257,14 @@ end end @testset "QQMatrix.sub" begin - S = matrix_space(FlintQQ, 3, 3) + S = matrix_space(QQ, 3, 3) A = S([1 2 3; 4 5 6; 7 8 9]) B = @inferred sub(A, 1, 1, 2, 2) @test typeof(B) == QQMatrix - @test B == matrix_space(FlintQQ, 2, 2)([1 2; 4 5]) + @test B == matrix_space(QQ, 2, 2)([1 2; 4 5]) B[1, 1] = 10 @test A == S([1 2 3; 4 5 6; 7 8 9]) @@ -272,10 +272,10 @@ end C = @inferred sub(B, 1:2, 1:2) @test typeof(C) == QQMatrix - @test C == matrix_space(FlintQQ, 2, 2)([10 2; 4 5]) + @test C == matrix_space(QQ, 2, 2)([10 2; 4 5]) C[1, 1] = 20 - @test B == matrix_space(FlintQQ, 2, 2)([10 2; 4 5]) + @test B == matrix_space(QQ, 2, 2)([10 2; 4 5]) @test A == S([1 2 3; 4 5 6; 7 8 9]) end @@ -428,40 +428,40 @@ end end @testset "QQMatrix.row_col_swapping" begin - a = matrix(FlintQQ, [1 2; 3 4; 5 6]) + a = matrix(QQ, [1 2; 3 4; 5 6]) - @test swap_rows(a, 1, 3) == matrix(FlintQQ, [5 6; 3 4; 1 2]) + @test swap_rows(a, 1, 3) == matrix(QQ, [5 6; 3 4; 1 2]) swap_rows!(a, 2, 3) - @test a == matrix(FlintQQ, [1 2; 5 6; 3 4]) + @test a == matrix(QQ, [1 2; 5 6; 3 4]) - @test swap_cols(a, 1, 2) == matrix(FlintQQ, [2 1; 6 5; 4 3]) + @test swap_cols(a, 1, 2) == matrix(QQ, [2 1; 6 5; 4 3]) swap_cols!(a, 2, 1) - @test a == matrix(FlintQQ, [2 1; 6 5; 4 3]) + @test a == matrix(QQ, [2 1; 6 5; 4 3]) - a = matrix(FlintQQ, [1 2; 3 4]) - @test reverse_rows(a) == matrix(FlintQQ, [3 4; 1 2]) + a = matrix(QQ, [1 2; 3 4]) + @test reverse_rows(a) == matrix(QQ, [3 4; 1 2]) reverse_rows!(a) - @test a == matrix(FlintQQ, [3 4; 1 2]) + @test a == matrix(QQ, [3 4; 1 2]) - a = matrix(FlintQQ, [1 2; 3 4]) - @test reverse_cols(a) == matrix(FlintQQ, [2 1; 4 3]) + a = matrix(QQ, [1 2; 3 4]) + @test reverse_cols(a) == matrix(QQ, [2 1; 4 3]) reverse_cols!(a) - @test a == matrix(FlintQQ, [2 1; 4 3]) + @test a == matrix(QQ, [2 1; 4 3]) - a = matrix(FlintQQ, [1 2 3; 3 4 5; 5 6 7]) + a = matrix(QQ, [1 2 3; 3 4 5; 5 6 7]) - @test reverse_rows(a) == matrix(FlintQQ, [5 6 7; 3 4 5; 1 2 3]) + @test reverse_rows(a) == matrix(QQ, [5 6 7; 3 4 5; 1 2 3]) reverse_rows!(a) - @test a == matrix(FlintQQ, [5 6 7; 3 4 5; 1 2 3]) + @test a == matrix(QQ, [5 6 7; 3 4 5; 1 2 3]) - a = matrix(FlintQQ, [1 2 3; 3 4 5; 5 6 7]) - @test reverse_cols(a) == matrix(FlintQQ, [3 2 1; 5 4 3; 7 6 5]) + a = matrix(QQ, [1 2 3; 3 4 5; 5 6 7]) + @test reverse_cols(a) == matrix(QQ, [3 2 1; 5 4 3; 7 6 5]) reverse_cols!(a) - @test a == matrix(FlintQQ, [3 2 1; 5 4 3; 7 6 5]) + @test a == matrix(QQ, [3 2 1; 5 4 3; 7 6 5]) end @testset "QQMatrix.inversion" begin diff --git a/test/flint/fmpq_mpoly-test.jl b/test/flint/fmpq_mpoly-test.jl index 3384d4f01..a48e8f3f4 100644 --- a/test/flint/fmpq_mpoly-test.jl +++ b/test/flint/fmpq_mpoly-test.jl @@ -1,5 +1,5 @@ @testset "QQMPolyRingElem.constructors" begin - R = FlintQQ + R = QQ for num_vars = 0:10 var_names = ["x$j" for j in 1:num_vars] @@ -82,7 +82,7 @@ end @testset "QQMPolyRingElem.printing" begin - S, (x, y) = polynomial_ring(FlintQQ, ["x", "y"]) + S, (x, y) = polynomial_ring(QQ, ["x", "y"]) @test !occursin(r"{", string(S)) @@ -97,7 +97,7 @@ end end @testset "QQMPolyRingElem.hash" begin - S, (x, y) = polynomial_ring(FlintQQ, ["x", "y"]) + S, (x, y) = polynomial_ring(QQ, ["x", "y"]) p = y^ZZRingElem(2)^100 @@ -106,7 +106,7 @@ end end @testset "QQMPolyRingElem.manipulation" begin - R = FlintQQ + R = QQ for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -197,7 +197,7 @@ end @test !is_monomial(2*gen(S, 1)*gen(S, num_vars)) monomialexp = unique([UInt[rand(0:10) for j in 1:num_vars] for k in 1:10]) - coeffs = [rand(FlintQQ, 1:10) for k in 1:length(monomialexp)] + coeffs = [rand(QQ, 1:10) for k in 1:length(monomialexp)] h = S(coeffs, monomialexp) @test length(h) == length(monomialexp) for k in 1:length(h) @@ -235,7 +235,7 @@ end end @testset "QQMPolyRingElem.multivariate_coeff" begin - R = FlintQQ + R = QQ for ord in Nemo.flint_orderings S, (x, y, z) = polynomial_ring(R, ["x", "y", "z"]; internal_ordering=ord) @@ -254,7 +254,7 @@ z^4-4*x*y-10*x*z^2+8*y^2*z^5-9*y^2*z^3 end @testset "QQMPolyRingElem.unary_ops" begin - R = FlintQQ + R = QQ for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -271,7 +271,7 @@ end end @testset "QQMPolyRingElem.binary_ops" begin - R = FlintQQ + R = QQ for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -294,7 +294,7 @@ end end @testset "QQMPolyRingElem.adhoc_binary" begin - R = FlintQQ + R = QQ for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -334,7 +334,7 @@ end end @testset "QQMPolyRingElem.adhoc_comparison" begin - R = FlintQQ + R = QQ for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -360,7 +360,7 @@ end end @testset "QQMPolyRingElem.powering" begin - R = FlintQQ + R = QQ for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -387,7 +387,7 @@ end end @testset "QQMPolyRingElem.divides" begin - R = FlintQQ + R = QQ for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -416,7 +416,7 @@ end end @testset "QQMPolyRingElem.euclidean_division" begin - R = FlintQQ + R = QQ for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -452,7 +452,7 @@ end end @testset "QQMPolyRingElem.ideal_reduction" begin - R = FlintQQ + R = QQ for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -505,7 +505,7 @@ end var_names = ["x$j" for j in 1:num_vars] ord = rand_ordering() - S, varlist = polynomial_ring(FlintQQ, var_names, internal_ordering = ord) + S, varlist = polynomial_ring(QQ, var_names, internal_ordering = ord) for iter = 1:10 f = rand(S, 0:4, 0:5, -10:10) @@ -525,7 +525,7 @@ end end @testset "QQMPolyRingElem.factor" begin - R, (x, y, z) = polynomial_ring(FlintQQ, ["x", "y", "z"]) + R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]) @test_throws ArgumentError factor(R(0)) @test_throws ArgumentError factor_squarefree(R(0)) @@ -550,7 +550,7 @@ end var_names = ["x$j" for j in 1:num_vars] ord = rand_ordering() - S, varlist = polynomial_ring(FlintQQ, var_names, internal_ordering = ord) + S, varlist = polynomial_ring(QQ, var_names, internal_ordering = ord) for iter = 1:10 f = rand(S, 0:4, 0:5, -10:10) @@ -570,7 +570,7 @@ end end @testset "QQMPolyRingElem.evaluation" begin - R = FlintQQ + R = QQ for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -653,7 +653,7 @@ end end @testset "QQMPolyRingElem.valuation" begin - R = FlintQQ + R = QQ for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -691,7 +691,7 @@ end end @testset "QQMPolyRingElem.derivative_integral" begin - R = FlintQQ + R = QQ for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -715,7 +715,7 @@ end var_names = ["x$j" for j in 1:num_vars] ord = rand_ordering() - R, vars_R = polynomial_ring(FlintQQ, var_names; internal_ordering=ord) + R, vars_R = polynomial_ring(QQ, var_names; internal_ordering=ord) for iter in 1:10 f = R() @@ -749,7 +749,7 @@ end var_names = ["x$j" for j in 1:num_vars] ord = rand_ordering() - R, vars_R = polynomial_ring(FlintQQ, var_names; internal_ordering=ord) + R, vars_R = polynomial_ring(QQ, var_names; internal_ordering=ord) for iter in 1:10 f = R() diff --git a/test/flint/fmpq_poly-test.jl b/test/flint/fmpq_poly-test.jl index 7e2f6d16d..d95d4c0cc 100644 --- a/test/flint/fmpq_poly-test.jl +++ b/test/flint/fmpq_poly-test.jl @@ -588,7 +588,7 @@ end end @testset "QQPolyRingElem.remove_valuation" begin - S, y = polynomial_ring(FlintQQ, "y") + S, y = polynomial_ring(QQ, "y") f = 7y^2 + 3y + 2 g = f^5*(11y^3 - 2y^2 + 5) diff --git a/test/flint/fmpz-test.jl b/test/flint/fmpz-test.jl index 85eaa7a65..81720b13c 100644 --- a/test/flint/fmpz-test.jl +++ b/test/flint/fmpz-test.jl @@ -5,7 +5,7 @@ function test_elem(R::ZZRing) end @testset "ZZRingElem.conformance_tests" begin - test_Ring_interface_recursive(FlintZZ) + test_Ring_interface_recursive(ZZ) end @testset "ZZRingElem.issingletontype" begin @@ -55,30 +55,30 @@ end end @testset "ZZRingElem.rand" begin - test_rand(FlintZZ, 1:9) - test_rand(FlintZZ, Int16(1):Int16(9)) - test_rand(FlintZZ, big(1):big(9)) - test_rand(FlintZZ, ZZRingElem(1):ZZRingElem(9)) - test_rand(FlintZZ, [3,9,2]) - test_rand(FlintZZ, Int16[3,9,2]) - test_rand(FlintZZ, BigInt[3,9,2]) - test_rand(FlintZZ, ZZRingElem[3,9,2]) + test_rand(ZZ, 1:9) + test_rand(ZZ, Int16(1):Int16(9)) + test_rand(ZZ, big(1):big(9)) + test_rand(ZZ, ZZRingElem(1):ZZRingElem(9)) + test_rand(ZZ, [3,9,2]) + test_rand(ZZ, Int16[3,9,2]) + test_rand(ZZ, BigInt[3,9,2]) + test_rand(ZZ, ZZRingElem[3,9,2]) for bits in 0:100 - t = rand_bits(FlintZZ, bits) + t = rand_bits(ZZ, bits) @test abs(t) < ZZRingElem(2)^bits @test bits < 1 || abs(t) >= ZZRingElem(2)^(bits - 1) end for i = 1:100 nbits = rand(2:100) - n = rand_bits_prime(FlintZZ, nbits) + n = rand_bits_prime(ZZ, nbits) @test ndigits(n, 2) == nbits @test is_prime(n) end - @test_throws DomainError rand_bits_prime(FlintZZ, -1) - @test_throws DomainError rand_bits_prime(FlintZZ, 0) - @test_throws DomainError rand_bits_prime(FlintZZ, 1) + @test_throws DomainError rand_bits_prime(ZZ, -1) + @test_throws DomainError rand_bits_prime(ZZ, 0) + @test_throws DomainError rand_bits_prime(ZZ, 1) # in a range for e in [0, 1, 2, 3, 32, 64, 65, 100, 129, 500] @@ -731,7 +731,7 @@ end @testset "ZZRingElem.unsafe" begin a = ZZRingElem(32) b = ZZRingElem(23) - c = one(FlintZZ) + c = one(ZZ) d = ZZRingElem(-3) r = ZZRingElem() b_copy = deepcopy(b) @@ -1419,12 +1419,12 @@ end end @testset "ZZRingElem.printing" begin - @test FlintZZ === integer_ring() - @test PrettyPrinting.detailed(FlintZZ) == "Integer ring" - @test PrettyPrinting.oneline(FlintZZ) == "Integer ring" - @test PrettyPrinting.supercompact(FlintZZ) == "ZZ" + @test ZZ === integer_ring() + @test PrettyPrinting.detailed(ZZ) == "Integer ring" + @test PrettyPrinting.oneline(ZZ) == "Integer ring" + @test PrettyPrinting.supercompact(ZZ) == "ZZ" io = PrettyPrinting.pretty(IOBuffer()) - print(IOContext(io, :supercompact => true), PrettyPrinting.Lowercase(), FlintZZ) + print(IOContext(io, :supercompact => true), PrettyPrinting.Lowercase(), ZZ) @test String(take!(io)) == "ZZ" end diff --git a/test/flint/fmpz_mat-test.jl b/test/flint/fmpz_mat-test.jl index 661f2871c..f2c29f5de 100644 --- a/test/flint/fmpz_mat-test.jl +++ b/test/flint/fmpz_mat-test.jl @@ -1,10 +1,10 @@ @testset "ZZMatrix.constructors" begin - S = matrix_space(FlintZZ, 3, 3) + S = matrix_space(ZZ, 3, 3) @test elem_type(S) == ZZMatrix @test elem_type(ZZMatrixSpace) == ZZMatrix @test parent_type(ZZMatrix) == ZZMatrixSpace - @test base_ring(S) == FlintZZ + @test base_ring(S) == ZZ @test nrows(S) == 3 @test ncols(S) == 3 @@ -43,31 +43,31 @@ arr2 = [1, 2, 3, 4, 5, 6] for T in [ZZRingElem, Int, BigInt] - M = matrix(FlintZZ, map(T, arr)) + M = matrix(ZZ, map(T, arr)) @test isa(M, ZZMatrix) - @test base_ring(M) == FlintZZ + @test base_ring(M) == ZZ - M2 = matrix(FlintZZ, 2, 3, map(T, arr2)) + M2 = matrix(ZZ, 2, 3, map(T, arr2)) @test isa(M2, ZZMatrix) - @test base_ring(M2) == FlintZZ + @test base_ring(M2) == ZZ @test nrows(M2) == 2 @test ncols(M2) == 3 - @test_throws ErrorConstrDimMismatch matrix(FlintZZ, 2, 2, map(T, arr2)) - @test_throws ErrorConstrDimMismatch matrix(FlintZZ, 2, 4, map(T, arr2)) + @test_throws ErrorConstrDimMismatch matrix(ZZ, 2, 2, map(T, arr2)) + @test_throws ErrorConstrDimMismatch matrix(ZZ, 2, 4, map(T, arr2)) end - M3 = zero_matrix(FlintZZ, 2, 3) + M3 = zero_matrix(ZZ, 2, 3) @test isa(M3, ZZMatrix) - @test base_ring(M3) == FlintZZ + @test base_ring(M3) == ZZ - M4 = identity_matrix(FlintZZ, 3) + M4 = identity_matrix(ZZ, 3) @test isa(M4, ZZMatrix) - @test base_ring(M4) == FlintZZ + @test base_ring(M4) == ZZ - a = zero_matrix(FlintZZ, 2, 2) - b = zero_matrix(FlintZZ, 2, 3) + a = zero_matrix(ZZ, 2, 2) + b = zero_matrix(ZZ, 2, 3) @test a in [a, b] @test a in [b, a] @test !(a in [b]) @@ -76,7 +76,7 @@ end @testset "ZZMatrix.$sim_zero" for sim_zero in (similar, zero) - S = matrix_space(FlintZZ, 3, 3) + S = matrix_space(ZZ, 3, 3) s = S(ZZRingElem(3)) t = sim_zero(s) @@ -111,14 +111,14 @@ end end @testset "ZZMatrix.is_zero_entry" begin - M = matrix(FlintZZ, [1 2 3;4 0 6;0 8 9]) + M = matrix(ZZ, [1 2 3;4 0 6;0 8 9]) for i in 1:3, j in 1:3 @test is_zero_entry(M, i, j) == (M[i, j] == 0) end end @testset "ZZMatrix.printing" begin - S = matrix_space(FlintZZ, 3, 3) + S = matrix_space(ZZ, 3, 3) f = S(ZZRingElem(3)) # test that default Julia printing is not used @@ -129,7 +129,7 @@ end # Basic tests. A = [[1 2 3]; [4 5 6]] Abig = BigInt[[1 2 3]; [4 5 6]] - S = matrix_space(FlintZZ, 2, 3) + S = matrix_space(ZZ, 2, 3) B = S(A) @test Matrix{Int}(B) == A @@ -141,7 +141,7 @@ end end @testset "ZZMatrix.manipulation" begin - S = matrix_space(FlintZZ, 3, 3) + S = matrix_space(ZZ, 3, 3) A = S([ZZRingElem(2) 3 5; 1 4 7; 9 6 3]) B = S([ZZRingElem(1) 4 7; 9 6 7; 4 3 3]) @@ -157,7 +157,7 @@ end @test deepcopy(A) == A - a = matrix(FlintZZ, 4, 4, [-1 ZZRingElem(2)^100 3 -4; 5 -1 ZZRingElem(2)^100 6; 7 5 -1 8; 9 10 11 12]) + a = matrix(ZZ, 4, 4, [-1 ZZRingElem(2)^100 3 -4; 5 -1 ZZRingElem(2)^100 6; 7 5 -1 8; 9 10 11 12]) @test hash(a, UInt(5)) == hash(deepcopy(a), UInt(5)) @test hash(view(a, 1,1, 2,2)) == hash(view(a, 2,2, 3,3)) @@ -176,14 +176,14 @@ end end @testset "ZZMatrix.view" begin - S = matrix_space(FlintZZ, 3, 3) + S = matrix_space(ZZ, 3, 3) A = S([1 2 3; 4 5 6; 7 8 9]) B = @inferred view(A, 1, 1, 2, 2) @test typeof(B) == ZZMatrix - @test B == matrix_space(FlintZZ, 2, 2)([1 2; 4 5]) + @test B == matrix_space(ZZ, 2, 2)([1 2; 4 5]) B[1, 1] = 10 @test A[1, 1] == 10 @@ -191,7 +191,7 @@ end C = @inferred view(B, 1:2, 1:2) @test typeof(C) == ZZMatrix - @test C == matrix_space(FlintZZ, 2, 2)([10 2; 4 5]) + @test C == matrix_space(ZZ, 2, 2)([10 2; 4 5]) C[1, 1] = 20 @test B[1, 1] == 20 @@ -204,7 +204,7 @@ end A = S([1 2 3; 4 5 6; 7 8 9]) v = @view A[2, :] - @test v isa AbstractVector{elem_type(FlintZZ)} + @test v isa AbstractVector{elem_type(ZZ)} @test length(v) == 3 @test v[1] == 4 @test collect(v) == [4, 5, 6] @@ -212,7 +212,7 @@ end @test A == S([1 2 3; 4 7 6; 7 8 9]) A = S([1 2 3; 4 5 6; 7 8 9]) v = @view A[:, 3] - @test v isa AbstractVector{elem_type(FlintZZ)} + @test v isa AbstractVector{elem_type(ZZ)} @test length(v) == 3 @test v[3] == 9 @test collect(v) == [3, 6, 9] @@ -221,14 +221,14 @@ end end @testset "ZZMatrix.sub" begin - S = matrix_space(FlintZZ, 3, 3) + S = matrix_space(ZZ, 3, 3) A = S([1 2 3; 4 5 6; 7 8 9]) B = @inferred sub(A, 1, 1, 2, 2) @test typeof(B) == ZZMatrix - @test B == matrix_space(FlintZZ, 2, 2)([1 2; 4 5]) + @test B == matrix_space(ZZ, 2, 2)([1 2; 4 5]) B[1, 1] = 10 @test A == S([1 2 3; 4 5 6; 7 8 9]) @@ -236,15 +236,15 @@ end C = @inferred sub(B, 1:2, 1:2) @test typeof(C) == ZZMatrix - @test C == matrix_space(FlintZZ, 2, 2)([10 2; 4 5]) + @test C == matrix_space(ZZ, 2, 2)([10 2; 4 5]) C[1, 1] = 20 - @test B == matrix_space(FlintZZ, 2, 2)([10 2; 4 5]) + @test B == matrix_space(ZZ, 2, 2)([10 2; 4 5]) @test A == S([1 2 3; 4 5 6; 7 8 9]) end @testset "ZZMatrix.unary_ops" begin - S = matrix_space(FlintZZ, 3, 3) + S = matrix_space(ZZ, 3, 3) A = S([ZZRingElem(2) 3 5; 1 4 7; 9 6 3]) B = S([ZZRingElem(-2) (-3) (-5); (-1) (-4) (-7); (-9) (-6) (-3)]) @@ -253,7 +253,7 @@ end end @testset "ZZMatrix.binary_ops" begin - S = matrix_space(FlintZZ, 3, 3) + S = matrix_space(ZZ, 3, 3) A = S([ZZRingElem(2) 3 5; 1 4 7; 9 6 3]) B = S([ZZRingElem(1) 4 7; 9 6 7; 4 3 3]) @@ -267,7 +267,7 @@ end end @testset "ZZMatrix.adhoc_binary" begin - S = matrix_space(FlintZZ, 3, 3) + S = matrix_space(ZZ, 3, 3) A = S([ZZRingElem(2) 3 5; 1 4 7; 9 6 3]) @@ -293,7 +293,7 @@ end end @testset "ZZMatrix.comparison" begin - S = matrix_space(FlintZZ, 3, 3) + S = matrix_space(ZZ, 3, 3) A = S([ZZRingElem(2) 3 5; 1 4 7; 9 6 3]) B = S([ZZRingElem(2) 3 5; 1 4 7; 9 6 3]) @@ -304,7 +304,7 @@ end end @testset "ZZMatrix.adhoc_comparison" begin - S = matrix_space(FlintZZ, 3, 3) + S = matrix_space(ZZ, 3, 3) A = S([ZZRingElem(2) 3 5; 1 4 7; 9 6 3]) @@ -317,7 +317,7 @@ end end @testset "ZZMatrix.powering" begin - S = matrix_space(FlintZZ, 3, 3) + S = matrix_space(ZZ, 3, 3) A = S([ZZRingElem(2) 3 5; 1 4 7; 9 6 3]) @@ -329,7 +329,7 @@ end end @testset "ZZMatrix.adhoc_exact_division" begin - S = matrix_space(FlintZZ, 3, 3) + S = matrix_space(ZZ, 3, 3) A = S([ZZRingElem(2) 3 5; 1 4 7; 9 6 3]) @@ -338,7 +338,7 @@ end end @testset "ZZMatrix.gram" begin - S = matrix_space(FlintZZ, 3, 3) + S = matrix_space(ZZ, 3, 3) A = S([ZZRingElem(2) 3 5; 1 4 7; 9 6 3]) @@ -346,7 +346,7 @@ end end @testset "ZZMatrix.trace" begin - S = matrix_space(FlintZZ, 3, 3) + S = matrix_space(ZZ, 3, 3) A = S([ZZRingElem(2) 3 5; 1 4 7; 9 6 3]) @@ -354,7 +354,7 @@ end end @testset "ZZMatrix.content" begin - S = matrix_space(FlintZZ, 3, 3) + S = matrix_space(ZZ, 3, 3) A = S([ZZRingElem(2) 3 5; 1 4 7; 9 6 3]) @@ -362,7 +362,7 @@ end end @testset "ZZMatrix.transpose" begin - S = matrix_space(FlintZZ, 3, 3) + S = matrix_space(ZZ, 3, 3) A = S([ZZRingElem(2) 3 5; 1 4 7; 9 6 3]) @@ -376,44 +376,44 @@ end end @testset "ZZMatrix.row_col_swapping" begin - a = matrix(FlintZZ, [1 2; 3 4; 5 6]) + a = matrix(ZZ, [1 2; 3 4; 5 6]) - @test swap_rows(a, 1, 3) == matrix(FlintZZ, [5 6; 3 4; 1 2]) + @test swap_rows(a, 1, 3) == matrix(ZZ, [5 6; 3 4; 1 2]) swap_rows!(a, 2, 3) - @test a == matrix(FlintZZ, [1 2; 5 6; 3 4]) + @test a == matrix(ZZ, [1 2; 5 6; 3 4]) - @test swap_cols(a, 1, 2) == matrix(FlintZZ, [2 1; 6 5; 4 3]) + @test swap_cols(a, 1, 2) == matrix(ZZ, [2 1; 6 5; 4 3]) swap_cols!(a, 2, 1) - @test a == matrix(FlintZZ, [2 1; 6 5; 4 3]) + @test a == matrix(ZZ, [2 1; 6 5; 4 3]) - a = matrix(FlintZZ, [1 2; 3 4]) - @test reverse_rows(a) == matrix(FlintZZ, [3 4; 1 2]) + a = matrix(ZZ, [1 2; 3 4]) + @test reverse_rows(a) == matrix(ZZ, [3 4; 1 2]) reverse_rows!(a) - @test a == matrix(FlintZZ, [3 4; 1 2]) + @test a == matrix(ZZ, [3 4; 1 2]) - a = matrix(FlintZZ, [1 2; 3 4]) - @test reverse_cols(a) == matrix(FlintZZ, [2 1; 4 3]) + a = matrix(ZZ, [1 2; 3 4]) + @test reverse_cols(a) == matrix(ZZ, [2 1; 4 3]) reverse_cols!(a) - @test a == matrix(FlintZZ, [2 1; 4 3]) + @test a == matrix(ZZ, [2 1; 4 3]) - a = matrix(FlintZZ, [1 2 3; 3 4 5; 5 6 7]) + a = matrix(ZZ, [1 2 3; 3 4 5; 5 6 7]) - @test reverse_rows(a) == matrix(FlintZZ, [5 6 7; 3 4 5; 1 2 3]) + @test reverse_rows(a) == matrix(ZZ, [5 6 7; 3 4 5; 1 2 3]) reverse_rows!(a) - @test a == matrix(FlintZZ, [5 6 7; 3 4 5; 1 2 3]) + @test a == matrix(ZZ, [5 6 7; 3 4 5; 1 2 3]) - a = matrix(FlintZZ, [1 2 3; 3 4 5; 5 6 7]) - @test reverse_cols(a) == matrix(FlintZZ, [3 2 1; 5 4 3; 7 6 5]) + a = matrix(ZZ, [1 2 3; 3 4 5; 5 6 7]) + @test reverse_cols(a) == matrix(ZZ, [3 2 1; 5 4 3; 7 6 5]) reverse_cols!(a) - @test a == matrix(FlintZZ, [3 2 1; 5 4 3; 7 6 5]) + @test a == matrix(ZZ, [3 2 1; 5 4 3; 7 6 5]) end @testset "ZZMatrix.scaling" begin - S = matrix_space(FlintZZ, 3, 3) + S = matrix_space(ZZ, 3, 3) A = S([ZZRingElem(2) 3 5; 1 4 7; 9 6 3]) @@ -424,7 +424,7 @@ end end @testset "ZZMatrix.inversion" begin - S = matrix_space(FlintZZ, 3, 3) + S = matrix_space(ZZ, 3, 3) A = S([ZZRingElem(2) 3 5; 1 4 7; 9 2 2]) B = S([-6 4 1; 61 (-41) (-9); -34 23 5]) @@ -444,7 +444,7 @@ end end @testset "ZZMatrix.pseudo_inversion" begin - S = matrix_space(FlintZZ, 3, 3) + S = matrix_space(ZZ, 3, 3) A = S([1 2 3; 1 2 3; 1 2 3]) B = S([1 0 1; 2 3 1; 5 6 7]) @@ -456,7 +456,7 @@ end end @testset "ZZMatrix.exact_division" begin - S = matrix_space(FlintZZ, 3, 3) + S = matrix_space(ZZ, 3, 3) A = S([ZZRingElem(2) 3 5; 1 4 7; 9 2 2]) B = S([2 3 4; 7 9 1; 5 4 5]) @@ -465,7 +465,7 @@ end end @testset "ZZMatrix.modular_reduction" begin - S = matrix_space(FlintZZ, 3, 3) + S = matrix_space(ZZ, 3, 3) A = S([ZZRingElem(2) 3 5; 1 4 7; 9 2 2]) B = S([2 0 2; 1 1 1; 0 2 2]) @@ -476,7 +476,7 @@ end end @testset "ZZMatrix.det" begin - S = matrix_space(FlintZZ, 3, 3) + S = matrix_space(ZZ, 3, 3) A = S([ZZRingElem(2) 3 5; 1 4 7; 19 3 7]) @@ -490,7 +490,7 @@ end end @testset "ZZMatrix.hadamard" begin - S = matrix_space(FlintZZ, 4, 4) + S = matrix_space(ZZ, 4, 4) @test is_hadamard(hadamard(S)) end @@ -528,7 +528,7 @@ end end @testset "ZZMatrix.hnf" begin - S = matrix_space(FlintZZ, 3, 3) + S = matrix_space(ZZ, 3, 3) A = S([ZZRingElem(2) 3 5; 1 4 7; 19 3 7]) @@ -551,7 +551,7 @@ end end @testset "ZZMatrix.lll" begin - S = matrix_space(FlintZZ, 3, 3) + S = matrix_space(ZZ, 3, 3) A = S([ZZRingElem(2) 3 5; 1 4 7; 19 3 7]) @@ -583,8 +583,8 @@ end end @testset "ZZMatrix.nullspace" begin - S = matrix_space(FlintZZ, 3, 3) - T = matrix_space(FlintZZ, 3, 1) + S = matrix_space(ZZ, 3, 3) + T = matrix_space(ZZ, 3, 1) A = S([ZZRingElem(2) 3 5; 1 4 7; 4 1 1]) @@ -602,7 +602,7 @@ end end @testset "ZZMatrix.rank" begin - S = matrix_space(FlintZZ, 3, 3) + S = matrix_space(ZZ, 3, 3) A = S([ZZRingElem(2) 3 5; 1 4 7; 4 1 1]) @@ -613,7 +613,7 @@ end for iters = 1:100 m = rand(0:100) n = rand(0:100) - S = matrix_space(FlintZZ, m, n) + S = matrix_space(ZZ, m, n) M = rand(S, -100:100) r, N, d = rref_rational(M) @@ -625,7 +625,7 @@ end @test is_rref(N2) end - S = matrix_space(FlintZZ, 3, 3) + S = matrix_space(ZZ, 3, 3) A = S([ZZRingElem(2) 3 5; 1 4 7; 4 1 1]) @@ -636,7 +636,7 @@ end end @testset "ZZMatrix.snf" begin - S = matrix_space(FlintZZ, 3, 3) + S = matrix_space(ZZ, 3, 3) A = S([ZZRingElem(2) 3 5; 1 4 7; 19 3 7]) @@ -650,11 +650,11 @@ end end @testset "ZZMatrix._solve_rational" begin - S = matrix_space(FlintZZ, 3, 3) + S = matrix_space(ZZ, 3, 3) A = S([ZZRingElem(2) 3 5; 1 4 7; 9 2 2]) - T = matrix_space(FlintZZ, 3, 1) + T = matrix_space(ZZ, 3, 1) B = T([ZZRingElem(4), 5, 7]) @@ -682,11 +682,11 @@ end AbstractAlgebra._solve_tril!(c, A, b) @test c == matrix(ZZ, 2, 1, [1, 1]) - S = matrix_space(FlintZZ, 3, 3) + S = matrix_space(ZZ, 3, 3) A = S([ZZRingElem(2) 3 5; 1 4 7; 9 2 2]) - T = matrix_space(FlintZZ, 3, 1) + T = matrix_space(ZZ, 3, 1) B = T([ZZRingElem(4), 5, 7]) @@ -769,9 +769,9 @@ end end @testset "ZZMatrix.concat" begin - S = matrix_space(FlintZZ, 3, 3) - T = matrix_space(FlintZZ, 3, 6) - U = matrix_space(FlintZZ, 6, 3) + S = matrix_space(ZZ, 3, 3) + T = matrix_space(ZZ, 3, 6) + U = matrix_space(ZZ, 6, 3) A = S([ZZRingElem(2) 3 5; 1 4 7; 9 6 3]) B = S([ZZRingElem(1) 4 7; 9 6 7; 4 3 3]) @@ -797,7 +797,7 @@ end end @testset "ZZMatrix.rand" begin - S = matrix_space(FlintZZ, 3, 3) + S = matrix_space(ZZ, 3, 3) M = rand(S, 1:9) @test parent(M) == S for i=1:3, j=1:3 diff --git a/test/flint/fmpz_mod-test.jl b/test/flint/fmpz_mod-test.jl index a7982ebe3..455220c2d 100644 --- a/test/flint/fmpz_mod-test.jl +++ b/test/flint/fmpz_mod-test.jl @@ -14,7 +14,7 @@ @test Nemo.promote_rule(elem_type(R), ZZRingElem) == elem_type(R) - @test base_ring(R) == FlintZZ + @test base_ring(R) == ZZ @test isa(R, Nemo.ZZModRing) diff --git a/test/flint/fmpz_mod_mat-test.jl b/test/flint/fmpz_mod_mat-test.jl index 6e3e94251..1511e7c25 100644 --- a/test/flint/fmpz_mod_mat-test.jl +++ b/test/flint/fmpz_mod_mat-test.jl @@ -305,7 +305,7 @@ end end @testset "ZZModMatrix.row_col_swapping" begin - R, = residue_ring(FlintZZ, ZZ(17)) + R, = residue_ring(ZZ, ZZ(17)) a = matrix(R, [1 2; 3 4; 5 6]) diff --git a/test/flint/fmpz_mpoly-test.jl b/test/flint/fmpz_mpoly-test.jl index 6b59c2f48..62392a676 100644 --- a/test/flint/fmpz_mpoly-test.jl +++ b/test/flint/fmpz_mpoly-test.jl @@ -1,5 +1,5 @@ @testset "ZZMPolyRingElem.constructors" begin - R = FlintZZ + R = ZZ for num_vars = 0:10 var_names = ["x$j" for j in 1:num_vars] @@ -82,7 +82,7 @@ end @testset "ZZMPolyRingElem.printing" begin - S, (x, y) = polynomial_ring(FlintZZ, ["x", "y"]) + S, (x, y) = polynomial_ring(ZZ, ["x", "y"]) @test !occursin(r"{", string(S)) @@ -97,7 +97,7 @@ end end @testset "ZZMPolyRingElem.hash" begin - S, (x, y) = polynomial_ring(FlintZZ, ["x", "y"]) + S, (x, y) = polynomial_ring(ZZ, ["x", "y"]) p = y^ZZRingElem(2)^100 @@ -106,7 +106,7 @@ end end @testset "ZZMPolyRingElem.manipulation" begin - R = FlintZZ + R = ZZ for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -186,7 +186,7 @@ end @test !is_monomial(2*gen(S, 1)*gen(S, num_vars)) monomialexp = unique([UInt[rand(0:10) for j in 1:num_vars] for k in 1:10]) - coeffs = [rand(FlintZZ, 1:10) for k in 1:length(monomialexp)] + coeffs = [rand(ZZ, 1:10) for k in 1:length(monomialexp)] h = S(coeffs, monomialexp) @test length(h) == length(monomialexp) for k in 1:length(h) @@ -224,7 +224,7 @@ end end @testset "ZZMPolyRingElem.multivariate_coeff" begin - R = FlintZZ + R = ZZ for ord in Nemo.flint_orderings S, (x, y, z) = polynomial_ring(R, ["x", "y", "z"]; internal_ordering=ord) @@ -242,7 +242,7 @@ end end @testset "ZZMPolyRingElem.unary_ops" begin - R = FlintZZ + R = ZZ for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -259,7 +259,7 @@ end end @testset "ZZMPolyRingElem.binary_ops" begin - R = FlintZZ + R = ZZ for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -282,7 +282,7 @@ end end @testset "ZZMPolyRingElem.adhoc_binary" begin - R = FlintZZ + R = ZZ for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -318,7 +318,7 @@ end end @testset "ZZMPolyRingElem.adhoc_comparison" begin - R = FlintZZ + R = ZZ for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -340,7 +340,7 @@ end end @testset "ZZMPolyRingElem.powering" begin - R = FlintZZ + R = ZZ for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -367,7 +367,7 @@ end end @testset "ZZMPolyRingElem.divides" begin - R = FlintZZ + R = ZZ for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -396,7 +396,7 @@ end end @testset "ZZMPolyRingElem.euclidean_division" begin - R = FlintZZ + R = ZZ for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -432,7 +432,7 @@ end end @testset "ZZMPolyRingElem.ideal_reduction" begin - R = FlintZZ + R = ZZ for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -485,7 +485,7 @@ end var_names = ["x$j" for j in 1:num_vars] ord = rand_ordering() - S, varlist = polynomial_ring(FlintZZ, var_names, internal_ordering = ord) + S, varlist = polynomial_ring(ZZ, var_names, internal_ordering = ord) for iter = 1:10 f = rand(S, 0:4, 0:5, -10:10) @@ -505,7 +505,7 @@ end end @testset "ZZMPolyRingElem.factor" begin - R, (x, y, z) = polynomial_ring(FlintZZ, ["x", "y", "z"]) + R, (x, y, z) = polynomial_ring(ZZ, ["x", "y", "z"]) @test_throws ArgumentError factor(R(0)) @test_throws ArgumentError factor_squarefree(R(0)) @@ -534,7 +534,7 @@ end var_names = ["x$j" for j in 1:num_vars] ord = rand_ordering() - S, varlist = polynomial_ring(FlintZZ, var_names, internal_ordering = ord) + S, varlist = polynomial_ring(ZZ, var_names, internal_ordering = ord) for iter = 1:10 f = rand(S, 0:4, 0:5, -10:10) @@ -554,7 +554,7 @@ end end @testset "ZZMPolyRingElem.evaluation" begin - R = FlintZZ + R = ZZ for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -638,7 +638,7 @@ end end @testset "ZZMPolyRingElem.valuation" begin - R = FlintZZ + R = ZZ for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -676,7 +676,7 @@ end end @testset "ZZMPolyRingElem.derivative" begin - R = FlintZZ + R = ZZ for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -700,7 +700,7 @@ end var_names = ["x$j" for j in 1:num_vars] ord = rand_ordering() - R, vars_R = polynomial_ring(FlintZZ, var_names; internal_ordering=ord) + R, vars_R = polynomial_ring(ZZ, var_names; internal_ordering=ord) for iter in 1:10 f = R() @@ -734,7 +734,7 @@ end var_names = ["x$j" for j in 1:num_vars] ord = rand_ordering() - R, vars_R = polynomial_ring(FlintZZ, var_names; internal_ordering=ord) + R, vars_R = polynomial_ring(ZZ, var_names; internal_ordering=ord) for iter in 1:10 f = R() diff --git a/test/flint/fmpz_poly-test.jl b/test/flint/fmpz_poly-test.jl index 2b749b79b..16a031e54 100644 --- a/test/flint/fmpz_poly-test.jl +++ b/test/flint/fmpz_poly-test.jl @@ -388,7 +388,7 @@ end end @testset "ZZPolyRingElem.factor" begin - Rx, x = polynomial_ring(FlintZZ, "x") + Rx, x = polynomial_ring(ZZ, "x") @test_throws ArgumentError factor(Rx(0)) @test_throws ArgumentError factor_squarefree(Rx(0)) diff --git a/test/flint/fq-test.jl b/test/flint/fq-test.jl index 26f36e264..bd0aed131 100644 --- a/test/flint/fq-test.jl +++ b/test/flint/fq-test.jl @@ -5,7 +5,7 @@ end @testset "FqPolyRepFieldElem.conformance_tests" begin test_Field_interface_recursive(Native.finite_field(ZZRingElem(7), 5, "z")[1]) - Sy, y = polynomial_ring(residue_ring(FlintZZ, 36893488147419103363)[1], "y") + Sy, y = polynomial_ring(residue_ring(ZZ, 36893488147419103363)[1], "y") T, z = Native.finite_field(y^2 + 1, "z") test_Field_interface_recursive(T) @@ -21,7 +21,7 @@ end @test elem_type(FqPolyRepField) == FqPolyRepFieldElem @test parent_type(FqPolyRepFieldElem) == FqPolyRepField - Sy, y = polynomial_ring(residue_ring(FlintZZ, 36893488147419103363)[1], "y") + Sy, y = polynomial_ring(residue_ring(ZZ, 36893488147419103363)[1], "y") Syy, yy = polynomial_ring(Native.GF(ZZRingElem(36893488147419103363)), "y") T, z = Native.finite_field(y^2 + 1, "z") @@ -64,7 +64,7 @@ end # check for primality T3, z3 = Native.finite_field(yy^2 + 1, "z", check=false) @test isa(T2, FqPolyRepField) - Syyy, yyy = polynomial_ring(residue_ring(FlintZZ, ZZ(4))[1], "y") + Syyy, yyy = polynomial_ring(residue_ring(ZZ, ZZ(4))[1], "y") @test yyy isa ZZModPolyRingElem @test_throws DomainError Native.finite_field(yyy^2+1, "z") end diff --git a/test/flint/fq_default-test.jl b/test/flint/fq_default-test.jl index ccd78c18d..86b6ed7ed 100644 --- a/test/flint/fq_default-test.jl +++ b/test/flint/fq_default-test.jl @@ -5,9 +5,9 @@ @test elem_type(FqField) == FqFieldElem @test parent_type(FqFieldElem) == FqField - Sy, y = polynomial_ring(residue_ring(FlintZZ, 36893488147419103363)[1], "y") + Sy, y = polynomial_ring(residue_ring(ZZ, 36893488147419103363)[1], "y") Syy, yy = polynomial_ring(Native.GF(ZZRingElem(36893488147419103363)), "y") - St, t = polynomial_ring(residue_ring(FlintZZ, 23)[1], "t") + St, t = polynomial_ring(residue_ring(ZZ, 23)[1], "t") Stt, tt = polynomial_ring(Native.GF(23), "y") T = FqField(y^2 + 1, :z) @@ -55,7 +55,7 @@ # check for primality T3, z3 = FqField(yy^2 + 1, :z, check=false) @test isa(T2, FqField) - Syyy, yyy = polynomial_ring(residue_ring(FlintZZ, ZZ(4))[1], "y") + Syyy, yyy = polynomial_ring(residue_ring(ZZ, ZZ(4))[1], "y") @test yyy isa ZZModPolyRingElem @test_throws DomainError FqField(yyy^2+1, :z) end @@ -107,7 +107,7 @@ end f = 3a^4 + 2a^3 + a + 5 - for R in [residue_ring(FlintZZ, 7)[1], residue_ring(FlintZZ, ZZ(7))[1], Native.GF(7), Native.GF(ZZ(7))] + for R in [residue_ring(ZZ, 7)[1], residue_ring(ZZ, ZZ(7))[1], Native.GF(7), Native.GF(ZZ(7))] S, y = polynomial_ring(R, "y") @test f == U(S(f)) diff --git a/test/flint/fq_default_mat-test.jl b/test/flint/fq_default_mat-test.jl index c351013af..638fa4877 100644 --- a/test/flint/fq_default_mat-test.jl +++ b/test/flint/fq_default_mat-test.jl @@ -90,7 +90,7 @@ @test parent(e) == R @test nrows(e) == 2 && ncols(e) == 2 - ar = matrix(FlintZZ, [ 1 1 1 ; 1 1 1; 1 1 1]) + ar = matrix(ZZ, [ 1 1 1 ; 1 1 1; 1 1 1]) @test_throws ErrorException R(ar) @@ -168,7 +168,7 @@ R, x = finite_field(ZZRingElem(23), 5, "x") S = matrix_space(R, 2, 2) - for R in [FlintZZ, residue_ring(FlintZZ, 23)[1], residue_ring(FlintZZ, ZZ(23))[1], Native.GF(23)] + for R in [ZZ, residue_ring(ZZ, 23)[1], residue_ring(ZZ, ZZ(23))[1], Native.GF(23)] M = matrix(R, 2, 2, [1, 2, 3, 4]) @test isa(S(M), MatElem) diff --git a/test/flint/fq_default_poly-test.jl b/test/flint/fq_default_poly-test.jl index bfea506e6..337b91c3f 100644 --- a/test/flint/fq_default_poly-test.jl +++ b/test/flint/fq_default_poly-test.jl @@ -61,7 +61,7 @@ @test isa(r, PolyRingElem) - for R in [FlintZZ, residue_ring(FlintZZ, 23)[1], residue_ring(FlintZZ, ZZ(23))[1], Native.GF(23), Native.GF(ZZ(23))] + for R in [ZZ, residue_ring(ZZ, 23)[1], residue_ring(ZZ, ZZ(23))[1], Native.GF(23), Native.GF(ZZ(23))] T, y = polynomial_ring(R, "y") f = 3y^2 + 2y + 1 diff --git a/test/flint/fq_mat-test.jl b/test/flint/fq_mat-test.jl index ee5c39299..214801839 100644 --- a/test/flint/fq_mat-test.jl +++ b/test/flint/fq_mat-test.jl @@ -90,7 +90,7 @@ @test parent(e) == R @test nrows(e) == 2 && ncols(e) == 2 - ar = matrix(FlintZZ, [ 1 1 1 ; 1 1 1; 1 1 1]) + ar = matrix(ZZ, [ 1 1 1 ; 1 1 1; 1 1 1]) @test_throws ErrorException R(ar) diff --git a/test/flint/fq_nmod-test.jl b/test/flint/fq_nmod-test.jl index 12ebd85c5..117aaa968 100644 --- a/test/flint/fq_nmod-test.jl +++ b/test/flint/fq_nmod-test.jl @@ -5,7 +5,7 @@ @test elem_type(fqPolyRepField) == fqPolyRepFieldElem @test parent_type(fqPolyRepFieldElem) == fqPolyRepField - Sy, y = polynomial_ring(residue_ring(FlintZZ, 3)[1], "y") + Sy, y = polynomial_ring(residue_ring(ZZ, 3)[1], "y") Syy, yy = Native.GF(3)["y"] T, z = Native.finite_field(y^2 + 1, "z") @@ -43,7 +43,7 @@ # check for primality T3, z3 = Native.finite_field(yy^2 + 1, "z", check=false) @test isa(T2, fqPolyRepField) - Syyy, yyy = polynomial_ring(residue_ring(FlintZZ, 4)[1], "y") + Syyy, yyy = polynomial_ring(residue_ring(ZZ, 4)[1], "y") @test yyy isa zzModPolyRingElem @test_throws DomainError Native.finite_field(yyy^2+1, "z") end diff --git a/test/flint/fq_nmod_mat-test.jl b/test/flint/fq_nmod_mat-test.jl index cd30f569f..7f37f0c7c 100644 --- a/test/flint/fq_nmod_mat-test.jl +++ b/test/flint/fq_nmod_mat-test.jl @@ -90,7 +90,7 @@ @test parent(e) == R @test nrows(e) == 2 && ncols(e) == 2 - ar = matrix(FlintZZ, [ 1 1 1 ; 1 1 1; 1 1 1]) + ar = matrix(ZZ, [ 1 1 1 ; 1 1 1; 1 1 1]) @test_throws ErrorException R(ar) diff --git a/test/flint/gfp_mat-test.jl b/test/flint/gfp_mat-test.jl index f81a73db6..d21dea46e 100644 --- a/test/flint/gfp_mat-test.jl +++ b/test/flint/gfp_mat-test.jl @@ -337,7 +337,7 @@ end end @testset "fpMatrix.row_col_swapping" begin - R, = residue_field(FlintZZ, 17) + R, = residue_field(ZZ, 17) a = matrix(R, [1 2; 3 4; 5 6]) diff --git a/test/flint/nmod-test.jl b/test/flint/nmod-test.jl index d3b13bd77..b5a0e64e2 100644 --- a/test/flint/nmod-test.jl +++ b/test/flint/nmod-test.jl @@ -26,7 +26,7 @@ end @test Nemo.promote_rule(elem_type(R), ZZRingElem) == elem_type(R) - @test base_ring(R) == FlintZZ + @test base_ring(R) == ZZ @test isa(R, Nemo.zzModRing) diff --git a/test/flint/nmod_mat-test.jl b/test/flint/nmod_mat-test.jl index ed800a12b..0ecd3ff84 100644 --- a/test/flint/nmod_mat-test.jl +++ b/test/flint/nmod_mat-test.jl @@ -337,7 +337,7 @@ end end @testset "zzModMatrix.row_col_swapping" begin - R, = residue_ring(FlintZZ, 17) + R, = residue_ring(ZZ, 17) a = matrix(R, [1 2; 3 4; 5 6]) diff --git a/test/flint/nmod_mpoly-test.jl b/test/flint/nmod_mpoly-test.jl index 4566feff0..e27171e2d 100644 --- a/test/flint/nmod_mpoly-test.jl +++ b/test/flint/nmod_mpoly-test.jl @@ -1,5 +1,5 @@ @testset "zzModMPolyRingElem.constructors" begin - R, = residue_ring(FlintZZ, 23) + R, = residue_ring(ZZ, 23) for num_vars = 0:10 var_names = ["x$j" for j in 1:num_vars] @@ -87,14 +87,14 @@ end end - RR, = residue_ring(FlintZZ, 29) + RR, = residue_ring(ZZ, 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 "zzModMPolyRingElem.printing" begin - S, (x, y) = polynomial_ring(residue_ring(FlintZZ, 23)[1], ["x", "y"]) + S, (x, y) = polynomial_ring(residue_ring(ZZ, 23)[1], ["x", "y"]) @test !occursin(r"{", string(S)) @@ -109,7 +109,7 @@ end end @testset "zzModMPolyRingElem.hash" begin - S, (x, y) = polynomial_ring(residue_ring(FlintZZ, 23)[1], ["x", "y"]) + S, (x, y) = polynomial_ring(residue_ring(ZZ, 23)[1], ["x", "y"]) p = y^ZZRingElem(2)^100 @@ -118,7 +118,7 @@ end end @testset "zzModMPolyRingElem.manipulation" begin - R, = residue_ring(FlintZZ, 23) + R, = residue_ring(ZZ, 23) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -256,7 +256,7 @@ end end @testset "zzModMPolyRingElem.multivariate_coeff" begin - R, = residue_ring(FlintZZ, 23) + R, = residue_ring(ZZ, 23) for ord in Nemo.flint_orderings S, (x, y, z) = polynomial_ring(R, ["x", "y", "z"]; internal_ordering=ord) @@ -274,7 +274,7 @@ end end @testset "zzModMPolyRingElem.unary_ops" begin - R, = residue_ring(FlintZZ, 23) + R, = residue_ring(ZZ, 23) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -291,7 +291,7 @@ end end @testset "zzModMPolyRingElem.binary_ops" begin - R, = residue_ring(FlintZZ, 23) + R, = residue_ring(ZZ, 23) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -314,7 +314,7 @@ end end @testset "zzModMPolyRingElem.adhoc_binary" begin - R, = residue_ring(FlintZZ, 23) + R, = residue_ring(ZZ, 23) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -350,7 +350,7 @@ end end @testset "zzModMPolyRingElem.adhoc_comparison" begin - R, = residue_ring(FlintZZ, 23) + R, = residue_ring(ZZ, 23) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -372,7 +372,7 @@ end end @testset "zzModMPolyRingElem.powering" begin - R, = residue_ring(FlintZZ, 23) + R, = residue_ring(ZZ, 23) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -399,7 +399,7 @@ end end @testset "zzModMPolyRingElem.divides" begin - R, = residue_ring(FlintZZ, 23) + R, = residue_ring(ZZ, 23) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -433,7 +433,7 @@ end end @testset "zzModMPolyRingElem.euclidean_division" begin - R, = residue_ring(FlintZZ, 23) + R, = residue_ring(ZZ, 23) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -469,7 +469,7 @@ end end @testset "zzModMPolyRingElem.ideal_reduction" begin - R, = residue_ring(FlintZZ, 23) + R, = residue_ring(ZZ, 23) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -518,7 +518,7 @@ end end @testset "zzModMPolyRingElem.gcd" begin - R, = residue_ring(FlintZZ, 23) + R, = residue_ring(ZZ, 23) for num_vars = 1:4 var_names = ["x$j" for j in 1:num_vars] @@ -544,7 +544,7 @@ end end @testset "zzModMPolyRingElem.factor" begin - R, = residue_ring(FlintZZ, 23) + R, = residue_ring(ZZ, 23) R, (x, y, z) = polynomial_ring(R, ["x", "y", "z"]) @test_throws ArgumentError factor(R(0)) @@ -564,7 +564,7 @@ end end @testset "zzModMPolyRingElem.sqrt" begin - R, = residue_ring(FlintZZ, 23) + R, = residue_ring(ZZ, 23) for num_vars = 1:4 var_names = ["x$j" for j in 1:num_vars] @@ -590,7 +590,7 @@ end end @testset "zzModMPolyRingElem.evaluation" begin - R, = residue_ring(FlintZZ, 23) + R, = residue_ring(ZZ, 23) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -678,7 +678,7 @@ end end @testset "zzModMPolyRingElem.valuation" begin - R, = residue_ring(FlintZZ, 23) + R, = residue_ring(ZZ, 23) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -716,7 +716,7 @@ end end @testset "zzModMPolyRingElem.derivative" begin - R, = residue_ring(FlintZZ, 23) + R, = residue_ring(ZZ, 23) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -736,7 +736,7 @@ end end @testset "zzModMPolyRingElem.unsafe" begin - R23, = residue_ring(FlintZZ, 23) + R23, = residue_ring(ZZ, 23) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] @@ -794,7 +794,7 @@ end end @testset "zzModMPolyRingElem.exponents" begin - R23, = residue_ring(FlintZZ, 23) + R23, = residue_ring(ZZ, 23) for num_vars = 1:10 var_names = ["x$j" for j in 1:num_vars] diff --git a/test/flint/padic-test.jl b/test/flint/padic-test.jl index 2c3645290..b3baa6764 100644 --- a/test/flint/padic-test.jl +++ b/test/flint/padic-test.jl @@ -93,9 +93,9 @@ end @test valuation(b) == 2 - @test lift(FlintZZ, a) == 211 + @test lift(ZZ, a) == 211 - @test lift(FlintQQ, divexact(a, b)) == QQFieldElem(337, 49) + @test lift(QQ, divexact(a, b)) == QQFieldElem(337, 49) @test characteristic(R) == 0 end diff --git a/test/flint/qadic-test.jl b/test/flint/qadic-test.jl index e3b1fee54..dac4ddae8 100644 --- a/test/flint/qadic-test.jl +++ b/test/flint/qadic-test.jl @@ -1,7 +1,7 @@ @testset "QadicFieldElem.constructors" begin R, _ = @inferred QadicField(7, 1, 30) K, _ = @inferred QadicField(7, 3, 30) - QX, x = polynomial_ring(FlintQQ, "x") + QX, x = polynomial_ring(QQ, "x") @test elem_type(R) == QadicFieldElem @test elem_type(QadicField) == QadicFieldElem @@ -40,7 +40,7 @@ @test parent(t) === R Q, _ = QadicField(13, 3, 10) - _, t = polynomial_ring(FlintZZ, "t") + _, t = polynomial_ring(ZZ, "t") @test Q(t^4) == Q(t)^4 R, _ = QadicField(13, 1, 10) From 841eac4285364251c81f9fac572a627ffa38aa3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Wed, 24 Apr 2024 16:17:07 +0200 Subject: [PATCH 04/14] chore: Bump to 0.43.3 (#1726) --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 2ac7fb03d..c99e5c09b 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "Nemo" uuid = "2edaba10-b0f1-5616-af89-8c11ac63239a" -version = "0.43.2" +version = "0.43.3" [deps] AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d" From ccf389e0781cc5b2ab05ee9e1b8194ee4cf79572 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Thu, 25 Apr 2024 15:07:53 +0200 Subject: [PATCH 05/14] Make dim check in matrix space creation consistent (#1729) --- src/arb/ArbTypes.jl | 4 ++++ src/arb/ComplexMat.jl | 1 - src/arb/RealMat.jl | 1 - src/arb/acb_mat.jl | 1 - src/arb/arb_mat.jl | 1 - src/flint/FlintTypes.jl | 4 +++- src/flint/gfp_mat.jl | 2 +- 7 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/arb/ArbTypes.jl b/src/arb/ArbTypes.jl index 84fb74ef3..3e5695150 100644 --- a/src/arb/ArbTypes.jl +++ b/src/arb/ArbTypes.jl @@ -872,6 +872,7 @@ struct RealMatSpace <: MatSpace{RealFieldElem} ncols::Int function RealMatSpace(R::RealField, r::Int, c::Int) + (r < 0 || c < 0) && throw(_err_dim_negative) return new(r, c) end end @@ -995,6 +996,7 @@ struct ArbMatSpace <: MatSpace{ArbFieldElem} base_ring::ArbField function ArbMatSpace(R::ArbField, r::Int, c::Int) + (r < 0 || c < 0) && throw(_err_dim_negative) return new(r, c, R) end end @@ -1122,6 +1124,7 @@ struct ComplexMatSpace <: MatSpace{ComplexFieldElem} #base_ring::AcbField function ComplexMatSpace(R::ComplexField, r::Int, c::Int) + (r < 0 || c < 0) && throw(_err_dim_negative) return new(r, c) end end @@ -1389,6 +1392,7 @@ struct AcbMatSpace <: MatSpace{AcbFieldElem} base_ring::AcbField function AcbMatSpace(R::AcbField, r::Int, c::Int) + (r < 0 || c < 0) && throw(_err_dim_negative) return new(r, c, R) end end diff --git a/src/arb/ComplexMat.jl b/src/arb/ComplexMat.jl index dc7024537..289bd8cb7 100644 --- a/src/arb/ComplexMat.jl +++ b/src/arb/ComplexMat.jl @@ -1093,6 +1093,5 @@ end function matrix_space(R::ComplexField, r::Int, c::Int; cached = true) # TODO/FIXME: `cached` is ignored and only exists for backwards compatibility - (r <= 0 || c <= 0) && error("Dimensions must be positive") return ComplexMatSpace(R, r, c) end diff --git a/src/arb/RealMat.jl b/src/arb/RealMat.jl index c90deef2a..f08a54788 100644 --- a/src/arb/RealMat.jl +++ b/src/arb/RealMat.jl @@ -844,6 +844,5 @@ promote_rule(::Type{RealMat}, ::Type{QQMatrix}) = RealMat function matrix_space(R::RealField, r::Int, c::Int; cached = true) # TODO/FIXME: `cached` is ignored and only exists for backwards compatibility - (r <= 0 || c <= 0) && error("Dimensions must be positive") return RealMatSpace(R, r, c) end diff --git a/src/arb/acb_mat.jl b/src/arb/acb_mat.jl index cc3d49e18..4fe9181d7 100644 --- a/src/arb/acb_mat.jl +++ b/src/arb/acb_mat.jl @@ -1107,6 +1107,5 @@ end function matrix_space(R::AcbField, r::Int, c::Int; cached = true) # TODO/FIXME: `cached` is ignored and only exists for backwards compatibility - (r <= 0 || c <= 0) && error("Dimensions must be positive") return AcbMatSpace(R, r, c) end diff --git a/src/arb/arb_mat.jl b/src/arb/arb_mat.jl index 8ae338f96..28ff4dbd4 100644 --- a/src/arb/arb_mat.jl +++ b/src/arb/arb_mat.jl @@ -879,6 +879,5 @@ promote_rule(::Type{ArbMatrix}, ::Type{QQMatrix}) = ArbMatrix function matrix_space(R::ArbField, r::Int, c::Int; cached = true) # TODO/FIXME: `cached` is ignored and only exists for backwards compatibility - (r <= 0 || c <= 0) && error("Dimensions must be positive") return ArbMatSpace(R, r, c) end diff --git a/src/flint/FlintTypes.jl b/src/flint/FlintTypes.jl index fae885e47..9c31114d0 100644 --- a/src/flint/FlintTypes.jl +++ b/src/flint/FlintTypes.jl @@ -4829,6 +4829,7 @@ struct QQMatrixSpace <: MatSpace{QQFieldElem} ncols::Int function QQMatrixSpace(r::Int, c::Int) + (r < 0 || c < 0) && throw(_err_dim_negative) return new(r, c) end end @@ -4992,7 +4993,8 @@ struct ZZMatrixSpace <: MatSpace{ZZRingElem} ncols::Int function ZZMatrixSpace(r::Int, c::Int) - return new(r, c) + (r < 0 || c < 0) && throw(_err_dim_negative) + return new(r, c) end end diff --git a/src/flint/gfp_mat.jl b/src/flint/gfp_mat.jl index 00cf4b050..b42c91bb9 100644 --- a/src/flint/gfp_mat.jl +++ b/src/flint/gfp_mat.jl @@ -537,7 +537,7 @@ end function matrix_space(R::fpField, r::Int, c::Int; cached::Bool = true) # TODO/FIXME: `cached` is ignored and only exists for backwards compatibility - fpMatrixSpace(R, r, c) + fpMatrixSpace(R, r, c) end ################################################################################ From 8a25beafc3f5e7d588788860a4f9058cabe79b90 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 26 Apr 2024 15:00:27 +0200 Subject: [PATCH 06/14] Add base_ring_type methods, remove redundant base_ring methods (#1735) --- src/HeckeMoreStuff.jl | 22 ---------------------- src/antic/nf_elem.jl | 12 +----------- src/arb/Complex.jl | 2 ++ src/arb/Real.jl | 2 ++ src/arb/acb.jl | 4 ++-- src/arb/arb.jl | 4 ++-- src/calcium/ca.jl | 4 ++-- src/calcium/qqbar.jl | 4 ++-- src/flint/flint_puiseux_series.jl | 4 ++++ src/flint/fmpq.jl | 2 ++ src/flint/fmpq_rel_series.jl | 2 ++ src/flint/fmpz.jl | 5 +---- src/flint/fmpz_laurent_series.jl | 2 ++ src/flint/fmpz_mod.jl | 2 ++ src/flint/fmpz_rel_series.jl | 2 ++ src/flint/fq.jl | 2 ++ src/flint/fq_default.jl | 2 ++ src/flint/fq_nmod.jl | 2 ++ src/flint/gfp_elem.jl | 2 ++ src/flint/gfp_fmpz_elem.jl | 2 ++ src/flint/nmod.jl | 2 ++ src/flint/nmod_mpoly.jl | 2 -- src/flint/padic.jl | 4 ++-- src/flint/qadic.jl | 12 +----------- src/gaussiannumbers/QQi.jl | 4 ++-- src/gaussiannumbers/ZZi.jl | 4 ++-- test/calcium/qqbar-test.jl | 4 ++-- 27 files changed, 49 insertions(+), 66 deletions(-) diff --git a/src/HeckeMoreStuff.jl b/src/HeckeMoreStuff.jl index e1561718b..c26c1a36d 100644 --- a/src/HeckeMoreStuff.jl +++ b/src/HeckeMoreStuff.jl @@ -1718,25 +1718,3 @@ end function setprecision!(a::PadicFieldElem, n::Int) return setprecision(a, n) end - -base_ring_type(::Type{AcbPolyRing}) = AcbField - -base_ring_type(::Type{ArbPolyRing}) = ArbField - -base_ring_type(::Type{QQPolyRing}) = QQField - -base_ring_type(::Type{ZZModPolyRing}) = Nemo.ZZModRing - -base_ring_type(::Type{ZZPolyRing}) = ZZRing - -base_ring_type(::Type{FqPolyRing}) = FqField - -base_ring_type(::Type{fqPolyRepPolyRing}) = fqPolyRepField - -base_ring_type(::Type{FqPolyRepPolyRing}) = FqPolyRepField - -base_ring_type(::Type{FpPolyRing}) = Nemo.FpField - -base_ring_type(::Type{fpPolyRing}) = Nemo.fpField - -base_ring_type(::Type{zzModPolyRing}) = Nemo.zzModRing diff --git a/src/antic/nf_elem.jl b/src/antic/nf_elem.jl index 8ad68a30c..926f66cbe 100644 --- a/src/antic/nf_elem.jl +++ b/src/antic/nf_elem.jl @@ -21,20 +21,10 @@ parent(a::AbsSimpleNumFieldElem) = a.parent elem_type(::Type{AbsSimpleNumField}) = AbsSimpleNumFieldElem -@doc raw""" - base_ring(a::AbsSimpleNumField) +base_ring_type(::Type{AbsSimpleNumField}) = typeof(Union{}) -Returns `Union{}` since a number field doesn't depend on any ring. -""" base_ring(a::AbsSimpleNumField) = Union{} -@doc raw""" - base_ring(a::AbsSimpleNumFieldElem) - -Returns `Union{}` since a number field doesn't depend on any ring. -""" -base_ring(a::AbsSimpleNumFieldElem) = Union{} - is_domain_type(::Type{AbsSimpleNumFieldElem}) = true @doc raw""" diff --git a/src/arb/Complex.jl b/src/arb/Complex.jl index 4bdb02dbe..a145f77d9 100644 --- a/src/arb/Complex.jl +++ b/src/arb/Complex.jl @@ -17,6 +17,8 @@ elem_type(::Type{ComplexField}) = ComplexFieldElem parent_type(::Type{ComplexFieldElem}) = ComplexField +base_ring_type(::Type{ComplexField}) = typeof(Union{}) + base_ring(R::ComplexField) = Union{} parent(x::ComplexFieldElem) = ComplexField() diff --git a/src/arb/Real.jl b/src/arb/Real.jl index 80294757b..2c34967df 100644 --- a/src/arb/Real.jl +++ b/src/arb/Real.jl @@ -17,6 +17,8 @@ elem_type(::Type{RealField}) = RealFieldElem parent_type(::Type{RealFieldElem}) = RealField +base_ring_type(::Type{RealField}) = typeof(Union{}) + base_ring(R::RealField) = Union{} parent(x::RealFieldElem) = RealField() diff --git a/src/arb/acb.jl b/src/arb/acb.jl index 00ed6e163..ca9508b50 100644 --- a/src/arb/acb.jl +++ b/src/arb/acb.jl @@ -17,9 +17,9 @@ elem_type(::Type{AcbField}) = AcbFieldElem parent_type(::Type{AcbFieldElem}) = AcbField -base_ring(R::AcbField) = Union{} +base_ring_type(::Type{AcbField}) = typeof(Union{}) -base_ring(a::AcbFieldElem) = Union{} +base_ring(R::AcbField) = Union{} parent(x::AcbFieldElem) = x.parent diff --git a/src/arb/arb.jl b/src/arb/arb.jl index a47c23687..8a0ab01b0 100644 --- a/src/arb/arb.jl +++ b/src/arb/arb.jl @@ -17,9 +17,9 @@ elem_type(::Type{ArbField}) = ArbFieldElem parent_type(::Type{ArbFieldElem}) = ArbField -base_ring(R::ArbField) = Union{} +base_ring_type(::Type{ArbField}) = typeof(Union{}) -base_ring(x::ArbFieldElem) = Union{} +base_ring(R::ArbField) = Union{} parent(x::ArbFieldElem) = x.parent diff --git a/src/calcium/ca.jl b/src/calcium/ca.jl index e36cceb0f..2a4cca8ec 100644 --- a/src/calcium/ca.jl +++ b/src/calcium/ca.jl @@ -16,9 +16,9 @@ parent_type(::Type{CalciumFieldElem}) = CalciumField elem_type(::Type{CalciumField}) = CalciumFieldElem -base_ring(a::CalciumField) = Union{} +base_ring_type(::Type{CalciumField}) = typeof(Union{}) -base_ring(a::CalciumFieldElem) = Union{} +base_ring(a::CalciumField) = Union{} is_domain_type(::Type{CalciumFieldElem}) = true diff --git a/src/calcium/qqbar.jl b/src/calcium/qqbar.jl index c7aad9b57..421665d2a 100644 --- a/src/calcium/qqbar.jl +++ b/src/calcium/qqbar.jl @@ -16,9 +16,9 @@ parent_type(::Type{QQBarFieldElem}) = QQBarField elem_type(::Type{QQBarField}) = QQBarFieldElem -base_ring(a::QQBarField) = CalciumQQBar +base_ring_type(::Type{QQBarField}) = typeof(Union{}) -base_ring(a::QQBarFieldElem) = CalciumQQBar +base_ring(::QQBarField) = Union{} is_domain_type(::Type{QQBarFieldElem}) = true diff --git a/src/flint/flint_puiseux_series.jl b/src/flint/flint_puiseux_series.jl index 7727619b1..e1f1927ee 100644 --- a/src/flint/flint_puiseux_series.jl +++ b/src/flint/flint_puiseux_series.jl @@ -40,6 +40,10 @@ elem_type(::Type{FlintPuiseuxSeriesRing{T}}) where T <: RingElem = FlintPuiseuxS elem_type(::Type{FlintPuiseuxSeriesField{T}}) where T <: FieldElem = FlintPuiseuxSeriesFieldElem{T} +base_ring_type(R::Type{FlintPuiseuxSeriesRing{T}}) where T <: RingElem = base_ring_type(parent_type(T)) + +base_ring_type(R::Type{FlintPuiseuxSeriesField{T}}) where T <: FieldElem = base_ring_type(parent_type(T)) + base_ring(R::FlintPuiseuxSeriesRing{T}) where T <: RingElem = base_ring(laurent_ring(R)) base_ring(R::FlintPuiseuxSeriesField{T}) where T <: FieldElem = base_ring(laurent_ring(R)) diff --git a/src/flint/fmpq.jl b/src/flint/fmpq.jl index deb90a1a7..adcec7af3 100644 --- a/src/flint/fmpq.jl +++ b/src/flint/fmpq.jl @@ -34,6 +34,8 @@ parent_type(::Type{QQFieldElem}) = QQField elem_type(::Type{QQField}) = QQFieldElem +base_ring_type(::Type{QQField}) = ZZRing + base_ring(a::QQField) = ZZ is_domain_type(::Type{QQFieldElem}) = true diff --git a/src/flint/fmpq_rel_series.jl b/src/flint/fmpq_rel_series.jl index 0ef5b5a7a..22035b7dd 100644 --- a/src/flint/fmpq_rel_series.jl +++ b/src/flint/fmpq_rel_series.jl @@ -22,6 +22,8 @@ elem_type(::Type{QQRelPowerSeriesRing}) = QQRelPowerSeriesRingElem parent_type(::Type{QQRelPowerSeriesRingElem}) = QQRelPowerSeriesRing +base_ring_type(::Type{QQRelPowerSeriesRing}) = QQField + base_ring(R::QQRelPowerSeriesRing) = QQ rel_series_type(::Type{QQFieldElem}) = QQRelPowerSeriesRingElem diff --git a/src/flint/fmpz.jl b/src/flint/fmpz.jl index 1451c7b0b..9449ed0d4 100644 --- a/src/flint/fmpz.jl +++ b/src/flint/fmpz.jl @@ -49,11 +49,8 @@ parent(a::ZZRingElem) = ZZ elem_type(::Type{ZZRing}) = ZZRingElem -@doc raw""" - base_ring(a::ZZRing) +base_ring_type(::Type{ZZRing}) = typeof(Union{}) -Returns `Union{}` as this ring is not dependent on another ring. -""" base_ring(a::ZZRing) = Union{} is_domain_type(::Type{ZZRingElem}) = true diff --git a/src/flint/fmpz_laurent_series.jl b/src/flint/fmpz_laurent_series.jl index 32f366127..d2b63c218 100644 --- a/src/flint/fmpz_laurent_series.jl +++ b/src/flint/fmpz_laurent_series.jl @@ -28,6 +28,8 @@ parent(a::ZZLaurentSeriesRingElem) = a.parent elem_type(::Type{ZZLaurentSeriesRing}) = ZZLaurentSeriesRingElem +base_ring_type(::Type{ZZLaurentSeriesRing}) = ZZRing + base_ring(R::ZZLaurentSeriesRing) = ZZ is_domain_type(::Type{ZZLaurentSeriesRingElem}) = true diff --git a/src/flint/fmpz_mod.jl b/src/flint/fmpz_mod.jl index 8d759b524..c70a5414d 100644 --- a/src/flint/fmpz_mod.jl +++ b/src/flint/fmpz_mod.jl @@ -14,6 +14,8 @@ parent_type(::Type{ZZModRingElem}) = ZZModRing elem_type(::Type{ZZModRing}) = ZZModRingElem +base_ring_type(::Type{ZZModRing}) = ZZRing + base_ring(a::ZZModRing) = ZZ parent(a::ZZModRingElem) = a.parent diff --git a/src/flint/fmpz_rel_series.jl b/src/flint/fmpz_rel_series.jl index 98e7bf518..7705da149 100644 --- a/src/flint/fmpz_rel_series.jl +++ b/src/flint/fmpz_rel_series.jl @@ -22,6 +22,8 @@ elem_type(::Type{ZZRelPowerSeriesRing}) = ZZRelPowerSeriesRingElem parent_type(::Type{ZZRelPowerSeriesRingElem}) = ZZRelPowerSeriesRing +base_ring_type(::Type{ZZRelPowerSeriesRing}) = ZZRing + base_ring(R::ZZRelPowerSeriesRing) = ZZ rel_series_type(::Type{ZZRingElem}) = ZZRelPowerSeriesRingElem diff --git a/src/flint/fq.jl b/src/flint/fq.jl index 566f7698a..aeb83a957 100644 --- a/src/flint/fq.jl +++ b/src/flint/fq.jl @@ -14,6 +14,8 @@ parent_type(::Type{FqPolyRepFieldElem}) = FqPolyRepField elem_type(::Type{FqPolyRepField}) = FqPolyRepFieldElem +base_ring_type(::Type{FqPolyRepField}) = typeof(Union{}) + base_ring(a::FqPolyRepField) = Union{} parent(a::FqPolyRepFieldElem) = a.parent diff --git a/src/flint/fq_default.jl b/src/flint/fq_default.jl index 0beb99ee0..7f81bd4e2 100644 --- a/src/flint/fq_default.jl +++ b/src/flint/fq_default.jl @@ -14,6 +14,8 @@ parent_type(::Type{FqFieldElem}) = FqField elem_type(::Type{FqField}) = FqFieldElem +base_ring_type(::Type{FqField}) = typeof(Union{}) + base_ring(a::FqField) = Union{} parent(a::FqFieldElem) = a.parent diff --git a/src/flint/fq_nmod.jl b/src/flint/fq_nmod.jl index 18aa08238..132c18b83 100644 --- a/src/flint/fq_nmod.jl +++ b/src/flint/fq_nmod.jl @@ -14,6 +14,8 @@ parent_type(::Type{fqPolyRepFieldElem}) = fqPolyRepField elem_type(::Type{fqPolyRepField}) = fqPolyRepFieldElem +base_ring_type(::Type{fqPolyRepField}) = typeof(Union{}) + base_ring(a::fqPolyRepField) = Union{} parent(a::fqPolyRepFieldElem) = a.parent diff --git a/src/flint/gfp_elem.jl b/src/flint/gfp_elem.jl index d991dee68..5e8c4796c 100644 --- a/src/flint/gfp_elem.jl +++ b/src/flint/gfp_elem.jl @@ -14,6 +14,8 @@ parent_type(::Type{fpFieldElem}) = fpField elem_type(::Type{fpField}) = fpFieldElem +base_ring_type(::Type{fpField}) = typeof(Union{}) + base_ring(a::fpField) = Union{} parent(a::fpFieldElem) = a.parent diff --git a/src/flint/gfp_fmpz_elem.jl b/src/flint/gfp_fmpz_elem.jl index 93a6aefae..a7667a5cb 100644 --- a/src/flint/gfp_fmpz_elem.jl +++ b/src/flint/gfp_fmpz_elem.jl @@ -14,6 +14,8 @@ parent_type(::Type{FpFieldElem}) = FpField elem_type(::Type{FpField}) = FpFieldElem +base_ring_type(::Type{FpField}) = typeof(Union{}) + base_ring(a::FpField) = Union{} parent(a::FpFieldElem) = a.parent diff --git a/src/flint/nmod.jl b/src/flint/nmod.jl index fda2fae86..1fb5549c6 100644 --- a/src/flint/nmod.jl +++ b/src/flint/nmod.jl @@ -14,6 +14,8 @@ parent_type(::Type{zzModRingElem}) = zzModRing elem_type(::Type{zzModRing}) = zzModRingElem +base_ring_type(::Type{zzModRing}) = ZZRing + base_ring(a::zzModRing) = ZZ parent(a::zzModRingElem) = a.parent diff --git a/src/flint/nmod_mpoly.jl b/src/flint/nmod_mpoly.jl index 812697b37..a34496b07 100644 --- a/src/flint/nmod_mpoly.jl +++ b/src/flint/nmod_mpoly.jl @@ -34,8 +34,6 @@ number_of_variables(a::($rtype)) = a.nvars base_ring(a::($rtype)) = a.base_ring -base_ring(f::($etype)) = base_ring(parent(f)) - characteristic(R::($rtype)) = characteristic(base_ring(R)) # characteristic of Z/4Z? modulus(R::($rtype)) = modulus(base_ring(R)) diff --git a/src/flint/padic.jl b/src/flint/padic.jl index d30b73621..bd8b24a9b 100644 --- a/src/flint/padic.jl +++ b/src/flint/padic.jl @@ -67,9 +67,9 @@ O(R::PadicField, m::Integer) = O(R, ZZRingElem(m)) elem_type(::Type{PadicField}) = PadicFieldElem -base_ring(a::PadicField) = Union{} +base_ring_type(::Type{PadicField}) = typeof(Union{}) -base_ring(a::PadicFieldElem) = Union{} +base_ring(a::PadicField) = Union{} parent(a::PadicFieldElem) = a.parent diff --git a/src/flint/qadic.jl b/src/flint/qadic.jl index ab6845e82..c7ef4450e 100644 --- a/src/flint/qadic.jl +++ b/src/flint/qadic.jl @@ -67,20 +67,10 @@ O(R::QadicField, m::Integer) = O(R, ZZRingElem(m)) elem_type(::Type{QadicField}) = QadicFieldElem -@doc raw""" - base_ring(a::QadicField) +base_ring_type(::Type{QadicField}) = typeof(Union{}) -Returns `Union{}` as this field is not dependent on another field. -""" base_ring(a::QadicField) = Union{} -@doc raw""" - base_ring(a::QadicFieldElem) - -Returns `Union{}` as this field is not dependent on another field. -""" -base_ring(a::QadicFieldElem) = Union{} - parent(a::QadicFieldElem) = a.parent is_domain_type(::Type{QadicFieldElem}) = true diff --git a/src/gaussiannumbers/QQi.jl b/src/gaussiannumbers/QQi.jl index d2164f754..39f41171d 100644 --- a/src/gaussiannumbers/QQi.jl +++ b/src/gaussiannumbers/QQi.jl @@ -10,9 +10,9 @@ parent_type(::Type{QQiFieldElem}) = QQiField parent(a::QQiFieldElem) = FlintQQi -base_ring(a::QQiField) = FlintZZi +base_ring_type(::Type{QQiField}) = ZZiRing -base_ring(a::QQiFieldElem) = FlintZZi +base_ring(a::QQiField) = FlintZZi is_domain_type(::Type{QQiFieldElem}) = true diff --git a/src/gaussiannumbers/ZZi.jl b/src/gaussiannumbers/ZZi.jl index 33ee95125..b0f341afb 100644 --- a/src/gaussiannumbers/ZZi.jl +++ b/src/gaussiannumbers/ZZi.jl @@ -10,9 +10,9 @@ parent_type(::Type{ZZiRingElem}) = ZZiRing parent(a::ZZiRingElem) = FlintZZi -base_ring(a::ZZiRing) = ZZ +base_ring_type(::Type{ZZiRing}) = ZZRing -base_ring(a::ZZiRingElem) = ZZ +base_ring(a::ZZiRing) = ZZ is_domain_type(::Type{ZZiRingElem}) = true diff --git a/test/calcium/qqbar-test.jl b/test/calcium/qqbar-test.jl index 67ff2d042..f03775bd0 100644 --- a/test/calcium/qqbar-test.jl +++ b/test/calcium/qqbar-test.jl @@ -7,8 +7,8 @@ @test elem_type(QQBarField) == QQBarFieldElem @test parent_type(QQBarFieldElem) == QQBarField @test is_domain_type(QQBarFieldElem) == true - @test base_ring(CalciumQQBar) == CalciumQQBar - @test base_ring(QQBarFieldElem(3)) == CalciumQQBar + @test base_ring(CalciumQQBar) == Union{} + @test base_ring(QQBarFieldElem(3)) == Union{} @test isa(R, QQBarField) From 09c3bef6f6367de209c49025b61dcad9dfe7a856 Mon Sep 17 00:00:00 2001 From: JohnAAbbott <124266874+JohnAAbbott@users.noreply.github.com> Date: Fri, 26 Apr 2024 21:42:13 +0200 Subject: [PATCH 07/14] Added arg-too-big checks for primorial & fibonacci (#1732) --- src/flint/fmpz.jl | 8 ++++++++ test/flint/fmpz-test.jl | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/src/flint/fmpz.jl b/src/flint/fmpz.jl index 9449ed0d4..02ea39fd7 100644 --- a/src/flint/fmpz.jl +++ b/src/flint/fmpz.jl @@ -1831,6 +1831,10 @@ equal to $x$. If $x < 0$ we throw a `DomainError()`. """ function primorial(x::Int) x < 0 && throw(DomainError(x, "Argument must be non-negative")) + # Up to 28 is OK for Int32, up to 52 is OK for Int64, up to 100 is OK for Int128; beyond is too large + if (Int == Int32 && x > 28) || (Int == Int64 && x > 52) || (Int == Int128 && x > 100) + throw(OverflowError("primorial(::Int)")) + end z = ZZRingElem() ccall((:fmpz_primorial, libflint), Nothing, (Ref{ZZRingElem}, UInt), z, UInt(x)) @@ -1858,6 +1862,10 @@ Return the $x$-th Fibonacci number $F_x$. We define $F_1 = 1$, $F_2 = 1$ and $F_{i + 1} = F_i + F_{i - 1}$ for all integers $i$. """ function fibonacci(x::Int) + # Up to 46 is OK for Int32; up to 92 is OK for Int64; up to 184 is OK for Int128; beyond is too large + if (Int == Int32 && abs(x) > 46) || (Int == Int64 && abs(x) > 92) || (Int == Int128 && abs(x) > 184) + throw(OverflowError("fibonacci(::Int)")) + end z = ZZRingElem() ccall((:fmpz_fib_ui, libflint), Nothing, (Ref{ZZRingElem}, UInt), z, UInt(abs(x))) diff --git a/test/flint/fmpz-test.jl b/test/flint/fmpz-test.jl index 81720b13c..20407dc98 100644 --- a/test/flint/fmpz-test.jl +++ b/test/flint/fmpz-test.jl @@ -1070,6 +1070,8 @@ end @test fibonacci(ZZRingElem(-2)) == -1 + @test_throws OverflowError fibonacci(999) + @test_throws DomainError euler_phi(-ZZRingElem(12480)) @test remove(ZZRingElem(12), ZZRingElem(2)) == (2, 3) @@ -1118,6 +1120,8 @@ end @test primorial(7) == 210 + @test_throws OverflowError primorial(999) + @test_throws DomainError primorial(-7) for a in [-ZZ(3)^100, ZZ(3)^100] From 253a1c60a381f4d44c3b685e74f2b2c547d553e9 Mon Sep 17 00:00:00 2001 From: Johannes Schmitt Date: Fri, 26 Apr 2024 22:27:08 +0200 Subject: [PATCH 08/14] Adjust to expected AbstractAlgebra changes (#1730) --- Project.toml | 4 ++-- src/Exports.jl | 1 - src/arb/ComplexMat.jl | 2 +- src/arb/RealMat.jl | 2 +- src/arb/acb_mat.jl | 2 +- src/arb/arb_mat.jl | 2 +- src/flint/fmpz_mat.jl | 2 +- src/matrix.jl | 30 ++++++++++-------------------- 8 files changed, 17 insertions(+), 28 deletions(-) diff --git a/Project.toml b/Project.toml index c99e5c09b..bbcfc7509 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "Nemo" uuid = "2edaba10-b0f1-5616-af89-8c11ac63239a" -version = "0.43.3" +version = "0.44.0-DEV" [deps] AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d" @@ -16,7 +16,7 @@ RandomExtensions = "fb686558-2515-59ef-acaa-46db3789a887" SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce" [compat] -AbstractAlgebra = "0.40.8" +AbstractAlgebra = "0.41.0" Antic_jll = "~0.201.500" Arb_jll = "~200.2300.000" Calcium_jll = "~0.401.100" diff --git a/src/Exports.jl b/src/Exports.jl index 3b8757412..76b0a745d 100644 --- a/src/Exports.jl +++ b/src/Exports.jl @@ -586,7 +586,6 @@ export snf export snf_diagonal export solve export sort_terms! -export SparsePolynomialRing export sqr_classical export sqrt export sqrt1pm1 diff --git a/src/arb/ComplexMat.jl b/src/arb/ComplexMat.jl index 289bd8cb7..8359b973f 100644 --- a/src/arb/ComplexMat.jl +++ b/src/arb/ComplexMat.jl @@ -615,7 +615,7 @@ end ################################################################################ function solve_init(A::ComplexMat) - return Solve.SolveCtx{ComplexFieldElem, ComplexMat, ComplexMat}(A) + return Solve.SolveCtx{ComplexFieldElem, ComplexMat, ComplexMat, ComplexMat}(A) end function Solve._init_reduce(C::Solve.SolveCtx{ComplexFieldElem}) diff --git a/src/arb/RealMat.jl b/src/arb/RealMat.jl index f08a54788..b162bf416 100644 --- a/src/arb/RealMat.jl +++ b/src/arb/RealMat.jl @@ -557,7 +557,7 @@ end ################################################################################ function solve_init(A::RealMat) - return Solve.SolveCtx{RealFieldElem, RealMat, RealMat}(A) + return Solve.SolveCtx{RealFieldElem, RealMat, RealMat, RealMat}(A) end function Solve._init_reduce(C::Solve.SolveCtx{RealFieldElem}) diff --git a/src/arb/acb_mat.jl b/src/arb/acb_mat.jl index 4fe9181d7..5f343c5c9 100644 --- a/src/arb/acb_mat.jl +++ b/src/arb/acb_mat.jl @@ -618,7 +618,7 @@ end ################################################################################ function solve_init(A::AcbMatrix) - return Solve.SolveCtx{AcbFieldElem, AcbMatrix, AcbMatrix}(A) + return Solve.SolveCtx{AcbFieldElem, AcbMatrix, AcbMatrix, AcbMatrix}(A) end function Solve._init_reduce(C::Solve.SolveCtx{AcbFieldElem}) diff --git a/src/arb/arb_mat.jl b/src/arb/arb_mat.jl index 28ff4dbd4..50062c286 100644 --- a/src/arb/arb_mat.jl +++ b/src/arb/arb_mat.jl @@ -584,7 +584,7 @@ end ################################################################################ function solve_init(A::ArbMatrix) - return Solve.SolveCtx{ArbFieldElem, ArbMatrix, ArbMatrix}(A) + return Solve.SolveCtx{ArbFieldElem, ArbMatrix, ArbMatrix, ArbMatrix}(A) end function Solve._init_reduce(C::Solve.SolveCtx{ArbFieldElem}) diff --git a/src/flint/fmpz_mat.jl b/src/flint/fmpz_mat.jl index e1b1cb9bb..5c5e05496 100644 --- a/src/flint/fmpz_mat.jl +++ b/src/flint/fmpz_mat.jl @@ -1331,7 +1331,7 @@ function Solve._can_solve_internal_no_check(A::ZZMatrix, b::ZZMatrix, task::Symb # `lazy_transpose` function solve_init(A::ZZMatrix) - return Solve.SolveCtx{ZZRingElem, ZZMatrix, ZZMatrix}(A) + return Solve.SolveCtx{ZZRingElem, ZZMatrix, ZZMatrix, ZZMatrix}(A) end function Solve._init_reduce_transpose(C::Solve.SolveCtx{ZZRingElem}) diff --git a/src/matrix.jl b/src/matrix.jl index 60cc63932..7db1808bf 100644 --- a/src/matrix.jl +++ b/src/matrix.jl @@ -57,7 +57,7 @@ end ################################################################################ function solve_init(A::_FieldMatTypes) - return Solve.SolveCtx{elem_type(base_ring(A)), typeof(A), typeof(A)}(A) + return Solve.SolveCtx{elem_type(base_ring(A)), typeof(A), typeof(A), typeof(A)}(A) end ################################################################################ @@ -80,18 +80,13 @@ function Solve._init_reduce(C::Solve.SolveCtx{T}) where {T <: Union{fpFieldElem, C.lu_perm = p if r < nrows(C) pA = p*matrix(C) - set_attribute!(C, :permuted_matrix_lu => view(pA, r + 1:nrows(C), :)) + C.permuted_matrix = view(pA, r + 1:nrows(C), :) else - set_attribute!(C, :permuted_matrix_lu => zero(matrix(C), 0, ncols(C))) + C.permuted_matrix = zero(matrix(C), 0, ncols(C)) end return nothing end -function permuted_matrix_lu(C::Solve.SolveCtx{T, MatT}) where {T <: Union{fpFieldElem, FpFieldElem, FqFieldElem, fqPolyRepFieldElem, FqPolyRepFieldElem}, MatT} - Solve._init_reduce(C) - return get_attribute(C, :permuted_matrix_lu)::MatT -end - function Solve._init_reduce_transpose(C::Solve.SolveCtx{T}) where {T <: Union{fpFieldElem, FpFieldElem, FqFieldElem, fqPolyRepFieldElem, FqPolyRepFieldElem}} if isdefined(C, :red_transp) && isdefined(C, :lu_perm_transp) return nothing @@ -106,19 +101,14 @@ function Solve._init_reduce_transpose(C::Solve.SolveCtx{T}) where {T <: Union{fp C.lu_perm_transp = p if r < ncols(C) Ap = matrix(C)*p - set_attribute!(C, :permuted_matrix_of_transpose_lu => view(Ap, :, r + 1:ncols(C))) + C.permuted_matrix_transp = view(Ap, :, r + 1:ncols(C)) else - set_attribute!(C, :permuted_matrix_of_transpose_lu => zero(matrix(C), nrows(C), 0)) + C.permuted_matrix_transp = zero(matrix(C), nrows(C), 0) end return nothing end -function permuted_matrix_of_transpose_lu(C::Solve.SolveCtx{T, MatT}) where {T <: Union{fpFieldElem, FpFieldElem, FqFieldElem, fqPolyRepFieldElem, FqPolyRepFieldElem}, MatT} - Solve._init_reduce_transpose(C) - return get_attribute(C, :permuted_matrix_of_transpose_lu)::MatT -end - -function Solve._can_solve_internal_no_check(C::Solve.SolveCtx{T, MatT}, b::MatT, task::Symbol; side::Symbol = :left) where {T <: Union{fpFieldElem, FpFieldElem, FqFieldElem, fqPolyRepFieldElem, FqPolyRepFieldElem}, MatT} +function Solve._can_solve_internal_no_check(C::Solve.SolveCtx{T}, b::MatElem{T}, task::Symbol; side::Symbol = :left) where {T <: Union{fpFieldElem, FpFieldElem, FqFieldElem, fqPolyRepFieldElem, FqPolyRepFieldElem}} # Split up in separate functions to make the compiler happy if side === :right return Solve._can_solve_internal_no_check_right(C, b, task) @@ -127,7 +117,7 @@ function Solve._can_solve_internal_no_check(C::Solve.SolveCtx{T, MatT}, b::MatT, end end -function Solve._can_solve_internal_no_check_right(C::Solve.SolveCtx{T, MatT}, b::MatT, task::Symbol) where {T <: Union{fpFieldElem, FpFieldElem, FqFieldElem, fqPolyRepFieldElem, FqPolyRepFieldElem}, MatT} +function Solve._can_solve_internal_no_check_right(C::Solve.SolveCtx{T}, b::MatElem{T}, task::Symbol) where {T <: Union{fpFieldElem, FpFieldElem, FqFieldElem, fqPolyRepFieldElem, FqPolyRepFieldElem}} LU = Solve.reduced_matrix(C) p = Solve.lu_permutation(C) pb = p*b @@ -173,7 +163,7 @@ function Solve._can_solve_internal_no_check_right(C::Solve.SolveCtx{T, MatT}, b: fl = true if r < nrows(C) - fl = permuted_matrix_lu(C)*y == view(pb, r + 1:nrows(C), :) + fl = Solve.permuted_matrix(C)*y == view(pb, r + 1:nrows(C), :) end if task !== :with_kernel @@ -183,7 +173,7 @@ function Solve._can_solve_internal_no_check_right(C::Solve.SolveCtx{T, MatT}, b: end end -function Solve._can_solve_internal_no_check_left(C::Solve.SolveCtx{T, MatT}, b::MatT, task::Symbol) where {T <: Union{fpFieldElem, FpFieldElem, FqFieldElem, fqPolyRepFieldElem, FqPolyRepFieldElem}, MatT} +function Solve._can_solve_internal_no_check_left(C::Solve.SolveCtx{T}, b::MatElem{T}, task::Symbol) where {T <: Union{fpFieldElem, FpFieldElem, FqFieldElem, fqPolyRepFieldElem, FqPolyRepFieldElem}} LU = Solve.reduced_matrix_of_transpose(C) p = Solve.lu_permutation_of_transpose(C) pbt = p*transpose(b) @@ -204,7 +194,7 @@ function Solve._can_solve_internal_no_check_left(C::Solve.SolveCtx{T, MatT}, b:: fl = true if r < ncols(C) bp = b*p - fl = y*permuted_matrix_of_transpose_lu(C) == view(bp, :, r + 1:ncols(C)) + fl = y*Solve.permuted_matrix_of_transpose(C) == view(bp, :, r + 1:ncols(C)) end if task !== :with_kernel From 2d195bb930fa0cc7b2ba6d89e3d49e019783cf25 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 26 Apr 2024 22:31:35 +0200 Subject: [PATCH 09/14] Add & fix some conversions from Irrational to our types (#1727) In some cases the wrong precision was used, or a call gave an outright error. --- src/arb/Real.jl | 10 +++++++--- src/arb/arb.jl | 8 ++++++-- src/calcium/ca.jl | 2 ++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/arb/Real.jl b/src/arb/Real.jl index 2c34967df..3751ed783 100644 --- a/src/arb/Real.jl +++ b/src/arb/Real.jl @@ -2057,9 +2057,13 @@ end function (r::RealField)(x::Irrational, prec::Int = precision(Balls)) if x == pi - return const_pi(r) - elseif x == e - return const_e(precision(Balls)) + return const_pi(r, prec) + elseif x == MathConstants.e + return const_e(r, prec) + elseif x == MathConstants.catalan + return const_catalan(r, prec) + elseif x == MathConstants.eulergamma + return const_euler(r, prec) else error("constant not supported") end diff --git a/src/arb/arb.jl b/src/arb/arb.jl index 8a0ab01b0..a8feb33d9 100644 --- a/src/arb/arb.jl +++ b/src/arb/arb.jl @@ -2074,8 +2074,12 @@ end function (r::ArbField)(x::Irrational) if x == pi return const_pi(r) - elseif x == e - return const_e(r.prec) + elseif x == MathConstants.e + return const_e(r) + elseif x == MathConstants.catalan + return const_catalan(r) + elseif x == MathConstants.eulergamma + return const_euler(r) else error("constant not supported") end diff --git a/src/calcium/ca.jl b/src/calcium/ca.jl index 2a4cca8ec..eb5e5c51c 100644 --- a/src/calcium/ca.jl +++ b/src/calcium/ca.jl @@ -1486,6 +1486,8 @@ end function (C::CalciumField)(x::Irrational) if x == pi return const_pi(C) + elseif x == MathConstants.eulergamma + return const_euler(C) else error("constant not supported") end From e273779a681a9c92c42ee4546a04b9eeefe6f13b Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 26 Apr 2024 22:33:03 +0200 Subject: [PATCH 10/14] Add docstrings for ZZ, QQ, QQBar, algebraic_closure (#1708) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Lars Göttgens --- src/Nemo.jl | 4 ++++ src/calcium/CalciumTypes.jl | 25 +++++++++++++++++++++++++ src/calcium/qqbar.jl | 16 ++++++++++++++++ 3 files changed, 45 insertions(+) diff --git a/src/Nemo.jl b/src/Nemo.jl index 2edc43331..bddaebb85 100644 --- a/src/Nemo.jl +++ b/src/Nemo.jl @@ -570,7 +570,10 @@ const _ecm_nCs = Vector{Int}[_ecm_nC] # ############################################################################### +@doc zz_ring_doc const FlintZZ = ZZ + +@doc qq_field_doc const FlintQQ = QQ ############################################################################### @@ -588,6 +591,7 @@ GaussianRationals() = FlintQQi # ############################################################################### +@doc qqbar_field_doc const QQBar = CalciumQQBar diff --git a/src/calcium/CalciumTypes.jl b/src/calcium/CalciumTypes.jl index 6a469dac4..0a337c885 100644 --- a/src/calcium/CalciumTypes.jl +++ b/src/calcium/CalciumTypes.jl @@ -59,11 +59,36 @@ end # ################################################################################ +qqbar_field_doc = raw""" + QQBarField <: Field + QQBarFieldElem <: FieldElem + +The algebraic closure $\overline{\mathbb Q}$ of the rationals $\mathbb Q$ and +its elements. This is a singleton type, meaning that there is a unique global +instance of this field, which can be obtained via `algebraic_closure(QQ)`. + +```jldoctest +julia> K = algebraic_closure(QQ) +Field of algebraic numbers + +julia> sqrt(K(2)) +Root 1.41421 of x^2 - 2 + +julia> QQBar(2//3) +Root 0.666667 of 3x - 2 + +julia> sinpi(QQBar(2//3)) +Root 0.866025 of 4x^2 - 3 +``` +""" + +@doc qq_field_doc struct QQBarField <: Field end const CalciumQQBar = QQBarField() +@doc qq_field_doc mutable struct QQBarFieldElem <: FieldElem coeffs::Ptr{Nothing} alloc::Int diff --git a/src/calcium/qqbar.jl b/src/calcium/qqbar.jl index 421665d2a..d156819c0 100644 --- a/src/calcium/qqbar.jl +++ b/src/calcium/qqbar.jl @@ -1538,4 +1538,20 @@ end # ############################################################################### +""" + algebraic_closure(::QQField) + +Return a field representing the algebraic closure of the field of +rational numbers. + +# Examples + +```jldoctest +julia> K = algebraic_closure(QQ) +Field of algebraic numbers + +julia> sqrt(K(2)) +Root 1.41421 of x^2 - 2 +``` +""" algebraic_closure(::QQField) = QQBar From e2cb1d4978392082ef1c80eb49b4214da9d9247c Mon Sep 17 00:00:00 2001 From: Thomas Breuer Date: Fri, 26 Apr 2024 22:38:24 +0200 Subject: [PATCH 11/14] move code from `Oscar.jl/experimental/GModule/Misc.jl` here (#1720) The idea is to add this code to Nemo.jl, and then to remove it from Oscar.jl. Concerning the usefulness of this code (and tests to be added), I am not sure which vectors shall be supported by the new methods; vectors of integers are already addressed by other methods. --- src/HeckeMiscFiniteField.jl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/HeckeMiscFiniteField.jl b/src/HeckeMiscFiniteField.jl index 32d71a9f9..18096e10c 100644 --- a/src/HeckeMiscFiniteField.jl +++ b/src/HeckeMiscFiniteField.jl @@ -222,6 +222,15 @@ function (k::FqPolyRepField)(a::QQFieldElem) return k(numerator(a)) // k(denominator(a)) end +function (k::Nemo.fpField)(a::Vector) + @assert length(a) == 1 + return k(a[1]) +end + +function (k::fqPolyRepField)(a::Vector) + return k(polynomial(Native.GF(Int(characteristic(k))), a)) +end + (F::fqPolyRepField)(a::zzModRingElem) = F(a.data) From b21eaf3c21e586c9ec868105de43303d07f181b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Fri, 26 Apr 2024 23:50:30 +0200 Subject: [PATCH 12/14] Make dim check in matrix space creation consistent (part 2) (#1733) --- test/arb/ComplexMat-test.jl | 7 +++++++ test/arb/RealMat-test.jl | 7 +++++++ test/arb/acb_mat-test.jl | 7 +++++++ test/arb/arb_mat-test.jl | 7 +++++++ test/flint/fmpq_mat-test.jl | 7 +++++++ test/flint/fmpz_mat-test.jl | 7 +++++++ test/flint/fmpz_mod_mat-test.jl | 11 +++++++---- test/flint/fq_default_mat-test.jl | 11 +++++++---- test/flint/fq_mat-test.jl | 11 +++++++---- test/flint/fq_nmod_mat-test.jl | 11 +++++++---- test/flint/gfp_fmpz_mat-test.jl | 11 +++++++---- test/flint/gfp_mat-test.jl | 11 +++++++---- test/flint/nmod_mat-test.jl | 11 +++++++---- 13 files changed, 91 insertions(+), 28 deletions(-) diff --git a/test/arb/ComplexMat-test.jl b/test/arb/ComplexMat-test.jl index dd70d1265..242ed56e9 100644 --- a/test/arb/ComplexMat-test.jl +++ b/test/arb/ComplexMat-test.jl @@ -2,6 +2,13 @@ CC = ComplexField() RR = RealField() @testset "ComplexMat.constructors" begin + @test_throws ErrorException matrix_space(CC, -1, 5) + @test_throws ErrorException matrix_space(CC, 0, -2) + @test_throws ErrorException matrix_space(CC, -3, -4) + @test_throws ErrorException ComplexMatSpace(CC, 2, -1) + @test_throws ErrorException ComplexMatSpace(CC, -1, 2) + @test_throws ErrorException ComplexMatSpace(CC, -1, -1) + S = matrix_space(CC, 3, 3) R = matrix_space(ZZ, 3, 3) diff --git a/test/arb/RealMat-test.jl b/test/arb/RealMat-test.jl index 56e6051e6..e6275886e 100644 --- a/test/arb/RealMat-test.jl +++ b/test/arb/RealMat-test.jl @@ -1,6 +1,13 @@ RR = RealField() @testset "RealMat.constructors" begin + @test_throws ErrorException matrix_space(RR, -1, 5) + @test_throws ErrorException matrix_space(RR, 0, -2) + @test_throws ErrorException matrix_space(RR, -3, -4) + @test_throws ErrorException RealMatSpace(RR, 2, -1) + @test_throws ErrorException RealMatSpace(RR, -1, 2) + @test_throws ErrorException RealMatSpace(RR, -1, -1) + S = matrix_space(RR, 3, 3) R = matrix_space(ZZ, 3, 3) diff --git a/test/arb/acb_mat-test.jl b/test/arb/acb_mat-test.jl index 25a1e9202..685196adb 100644 --- a/test/arb/acb_mat-test.jl +++ b/test/arb/acb_mat-test.jl @@ -2,6 +2,13 @@ CC = AcbField(64) RR = ArbField(64) @testset "AcbMatrix.constructors" begin + @test_throws ErrorException matrix_space(CC, -1, 5) + @test_throws ErrorException matrix_space(CC, 0, -2) + @test_throws ErrorException matrix_space(CC, -3, -4) + @test_throws ErrorException AcbMatSpace(CC, 2, -1) + @test_throws ErrorException AcbMatSpace(CC, -1, 2) + @test_throws ErrorException AcbMatSpace(CC, -1, -1) + S = matrix_space(CC, 3, 3) R = matrix_space(ZZ, 3, 3) diff --git a/test/arb/arb_mat-test.jl b/test/arb/arb_mat-test.jl index 1c295c9cc..435184078 100644 --- a/test/arb/arb_mat-test.jl +++ b/test/arb/arb_mat-test.jl @@ -1,6 +1,13 @@ RR = ArbField(64) @testset "ArbMatrix.constructors" begin + @test_throws ErrorException matrix_space(RR, -1, 5) + @test_throws ErrorException matrix_space(RR, 0, -2) + @test_throws ErrorException matrix_space(RR, -3, -4) + @test_throws ErrorException ArbMatSpace(RR, 2, -1) + @test_throws ErrorException ArbMatSpace(RR, -1, 2) + @test_throws ErrorException ArbMatSpace(RR, -1, -1) + S = matrix_space(RR, 3, 3) R = matrix_space(ZZ, 3, 3) diff --git a/test/flint/fmpq_mat-test.jl b/test/flint/fmpq_mat-test.jl index 7937779c1..85ebfd7b4 100644 --- a/test/flint/fmpq_mat-test.jl +++ b/test/flint/fmpq_mat-test.jl @@ -1,4 +1,11 @@ @testset "QQMatrix.constructors" begin + @test_throws ErrorException matrix_space(QQ, -1, 5) + @test_throws ErrorException matrix_space(QQ, 0, -2) + @test_throws ErrorException matrix_space(QQ, -3, -4) + @test_throws ErrorException QQMatrixSpace(2, -1) + @test_throws ErrorException QQMatrixSpace(-1, 2) + @test_throws ErrorException QQMatrixSpace(-1, -1) + S = matrix_space(QQ, 3, 3) @test elem_type(S) == QQMatrix diff --git a/test/flint/fmpz_mat-test.jl b/test/flint/fmpz_mat-test.jl index f2c29f5de..d57171c7b 100644 --- a/test/flint/fmpz_mat-test.jl +++ b/test/flint/fmpz_mat-test.jl @@ -1,4 +1,11 @@ @testset "ZZMatrix.constructors" begin + @test_throws ErrorException matrix_space(ZZ, -1, 5) + @test_throws ErrorException matrix_space(ZZ, 0, -2) + @test_throws ErrorException matrix_space(ZZ, -3, -4) + @test_throws ErrorException ZZMatrixSpace(2, -1) + @test_throws ErrorException ZZMatrixSpace(-1, 2) + @test_throws ErrorException ZZMatrixSpace(-1, -1) + S = matrix_space(ZZ, 3, 3) @test elem_type(S) == ZZMatrix diff --git a/test/flint/fmpz_mod_mat-test.jl b/test/flint/fmpz_mod_mat-test.jl index 1511e7c25..7acaff173 100644 --- a/test/flint/fmpz_mod_mat-test.jl +++ b/test/flint/fmpz_mod_mat-test.jl @@ -2,6 +2,13 @@ Z2, = residue_ring(ZZ, ZZ(2)) Z3, = residue_ring(ZZ, ZZ(3)) + @test_throws ErrorException matrix_space(Z2, -1, 5) + @test_throws ErrorException matrix_space(Z2, 0, -2) + @test_throws ErrorException matrix_space(Z2, -3, -4) + @test_throws ErrorException ZZModMatrixSpace(Z2, 2, -1) + @test_throws ErrorException ZZModMatrixSpace(Z2, -1, 2) + @test_throws ErrorException ZZModMatrixSpace(Z2, -1, -1) + R = ZZModMatrixSpace(Z2, 2, 2) @test elem_type(R) == ZZModMatrix @@ -24,10 +31,6 @@ @test R == RR - @test_throws ErrorException ZZModMatrixSpace(Z2, 2, -1) - @test_throws ErrorException ZZModMatrixSpace(Z2, -1, 2) - @test_throws ErrorException ZZModMatrixSpace(Z2, -1, -1) - a = R() @test isa(a, ZZModMatrix) diff --git a/test/flint/fq_default_mat-test.jl b/test/flint/fq_default_mat-test.jl index 638fa4877..7c71947f0 100644 --- a/test/flint/fq_default_mat-test.jl +++ b/test/flint/fq_default_mat-test.jl @@ -2,6 +2,13 @@ F4, a = finite_field(ZZRingElem(2), 2, "a") F9, b = finite_field(ZZRingElem(3), 2, "b") + @test_throws ErrorException matrix_space(F4, -1, 5) + @test_throws ErrorException matrix_space(F4, 0, -2) + @test_throws ErrorException matrix_space(F4, -3, -4) + @test_throws ErrorException FqMatrixSpace(F4, 2, -1) + @test_throws ErrorException FqMatrixSpace(F4, -1, 2) + @test_throws ErrorException FqMatrixSpace(F4, -1, -1) + R = FqMatrixSpace(F4, 2, 2) @test elem_type(R) == FqMatrix @@ -24,10 +31,6 @@ @test R == RR - @test_throws ErrorException FqMatrixSpace(F4, 2, -1) - @test_throws ErrorException FqMatrixSpace(F4, -1, 2) - @test_throws ErrorException FqMatrixSpace(F4, -1, -1) - a = R() @test isa(a, FqMatrix) diff --git a/test/flint/fq_mat-test.jl b/test/flint/fq_mat-test.jl index 214801839..6314f929d 100644 --- a/test/flint/fq_mat-test.jl +++ b/test/flint/fq_mat-test.jl @@ -2,6 +2,13 @@ F4, a = Native.finite_field(ZZRingElem(2), 2, "a") F9, b = Native.finite_field(ZZRingElem(3), 2, "b") + @test_throws ErrorException matrix_space(F4, -1, 5) + @test_throws ErrorException matrix_space(F4, 0, -2) + @test_throws ErrorException matrix_space(F4, -3, -4) + @test_throws ErrorException FqPolyRepMatrixSpace(F4, 2, -1) + @test_throws ErrorException FqPolyRepMatrixSpace(F4, -1, 2) + @test_throws ErrorException FqPolyRepMatrixSpace(F4, -1, -1) + R = FqPolyRepMatrixSpace(F4, 2, 2) @test elem_type(R) == FqPolyRepMatrix @@ -24,10 +31,6 @@ @test R == RR - @test_throws ErrorException FqPolyRepMatrixSpace(F4, 2, -1) - @test_throws ErrorException FqPolyRepMatrixSpace(F4, -1, 2) - @test_throws ErrorException FqPolyRepMatrixSpace(F4, -1, -1) - a = R() @test isa(a, FqPolyRepMatrix) diff --git a/test/flint/fq_nmod_mat-test.jl b/test/flint/fq_nmod_mat-test.jl index 7f37f0c7c..1a785c43e 100644 --- a/test/flint/fq_nmod_mat-test.jl +++ b/test/flint/fq_nmod_mat-test.jl @@ -2,6 +2,13 @@ F4, a = Native.finite_field(2, 2, "a") F9, b = Native.finite_field(3, 2, "b") + @test_throws ErrorException matrix_space(F4, -1, 5) + @test_throws ErrorException matrix_space(F4, 0, -2) + @test_throws ErrorException matrix_space(F4, -3, -4) + @test_throws ErrorException fqPolyRepMatrixSpace(F4, 2, -1) + @test_throws ErrorException fqPolyRepMatrixSpace(F4, -1, 2) + @test_throws ErrorException fqPolyRepMatrixSpace(F4, -1, -1) + R = fqPolyRepMatrixSpace(F4, 2, 2) @test elem_type(R) == fqPolyRepMatrix @@ -24,10 +31,6 @@ @test R == RR - @test_throws ErrorException fqPolyRepMatrixSpace(F4, 2, -1) - @test_throws ErrorException fqPolyRepMatrixSpace(F4, -1, 2) - @test_throws ErrorException fqPolyRepMatrixSpace(F4, -1, -1) - a = R() @test isa(a, fqPolyRepMatrix) diff --git a/test/flint/gfp_fmpz_mat-test.jl b/test/flint/gfp_fmpz_mat-test.jl index f1f6a90af..d36be648b 100644 --- a/test/flint/gfp_fmpz_mat-test.jl +++ b/test/flint/gfp_fmpz_mat-test.jl @@ -2,6 +2,13 @@ Z2 = Native.GF(ZZ(2)) Z3 = Native.GF(ZZ(3)) + @test_throws ErrorException matrix_space(Z2, -1, 5) + @test_throws ErrorException matrix_space(Z2, 0, -2) + @test_throws ErrorException matrix_space(Z2, -3, -4) + @test_throws ErrorException FpMatrixSpace(Z2, 2, -1) + @test_throws ErrorException FpMatrixSpace(Z2, -1, 2) + @test_throws ErrorException FpMatrixSpace(Z2, -1, -1) + R = FpMatrixSpace(Z2, 2, 2) @test elem_type(R) == FpMatrix @@ -25,10 +32,6 @@ @test R == RR - @test_throws ErrorException FpMatrixSpace(Z2, 2, -1) - @test_throws ErrorException FpMatrixSpace(Z2, -1, 2) - @test_throws ErrorException FpMatrixSpace(Z2, -1, -1) - a = R() @test isa(a, FpMatrix) diff --git a/test/flint/gfp_mat-test.jl b/test/flint/gfp_mat-test.jl index d21dea46e..02e3091f9 100644 --- a/test/flint/gfp_mat-test.jl +++ b/test/flint/gfp_mat-test.jl @@ -2,6 +2,13 @@ Z2 = Native.GF(2) Z3 = Native.GF(3) + @test_throws ErrorException matrix_space(Z2, -1, 5) + @test_throws ErrorException matrix_space(Z2, 0, -2) + @test_throws ErrorException matrix_space(Z2, -3, -4) + @test_throws ErrorException fpMatrixSpace(Z2, 2, -1) + @test_throws ErrorException fpMatrixSpace(Z2, -1, 2) + @test_throws ErrorException fpMatrixSpace(Z2, -1, -1) + R = fpMatrixSpace(Z2, 2, 2) @test elem_type(R) == fpMatrix @@ -24,10 +31,6 @@ @test R == RR - @test_throws ErrorException fpMatrixSpace(Z2, 2, -1) - @test_throws ErrorException fpMatrixSpace(Z2, -1, 2) - @test_throws ErrorException fpMatrixSpace(Z2, -1, -1) - a = R() @test isa(a, fpMatrix) diff --git a/test/flint/nmod_mat-test.jl b/test/flint/nmod_mat-test.jl index 0ecd3ff84..75951e8ca 100644 --- a/test/flint/nmod_mat-test.jl +++ b/test/flint/nmod_mat-test.jl @@ -2,6 +2,13 @@ Z2, = residue_ring(ZZ, 2) Z3, = residue_ring(ZZ, 3) + @test_throws ErrorException matrix_space(Z2, -1, 5) + @test_throws ErrorException matrix_space(Z2, 0, -2) + @test_throws ErrorException matrix_space(Z2, -3, -4) + @test_throws ErrorException zzModMatrixSpace(Z2, 2, -1) + @test_throws ErrorException zzModMatrixSpace(Z2, -1, 2) + @test_throws ErrorException zzModMatrixSpace(Z2, -1, -1) + R = zzModMatrixSpace(Z2, 2, 2) @test elem_type(R) == zzModMatrix @@ -24,10 +31,6 @@ @test R == RR - @test_throws ErrorException zzModMatrixSpace(Z2, 2, -1) - @test_throws ErrorException zzModMatrixSpace(Z2, -1, 2) - @test_throws ErrorException zzModMatrixSpace(Z2, -1, -1) - a = R() @test isa(a, zzModMatrix) From aab1726432d8a6c53f4dec17210c1b14e530e6b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 28 Apr 2024 23:21:12 +0200 Subject: [PATCH 13/14] Conform with Julia v1.12.X's definition of gcdx (#1739) --- src/flint/fmpz.jl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/flint/fmpz.jl b/src/flint/fmpz.jl index 02ea39fd7..a3491d4e5 100644 --- a/src/flint/fmpz.jl +++ b/src/flint/fmpz.jl @@ -1275,8 +1275,10 @@ Return a tuple $g, s, t$ such that $g$ is the greatest common divisor of $a$ and $b$ and integers $s$ and $t$ such that $g = as + bt$. """ function gcdx(a::ZZRingElem, b::ZZRingElem) - # Just to conform with Julia's definition - a == b == 0 && return zero(ZZ), one(ZZ), zero(ZZ) + @static if VERSION < v"1.12.0-DEV.410" + # Just to conform with Julia's definition + a == b == 0 && return zero(ZZ), one(ZZ), zero(ZZ) + end d = ZZ() x = ZZ() From f102e7476eed8b19b4838c1b98f46135e289d09d Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sun, 28 Apr 2024 23:21:31 +0200 Subject: [PATCH 14/14] Remove windows_build.txt (#1740) --- windows_build.txt | 50 ----------------------------------------------- 1 file changed, 50 deletions(-) delete mode 100644 windows_build.txt diff --git a/windows_build.txt b/windows_build.txt deleted file mode 100644 index ef5cbb978..000000000 --- a/windows_build.txt +++ /dev/null @@ -1,50 +0,0 @@ -# For Windows 32 - -wget http://mpir.org/mpir-2.7.2.tar.bz2 -tar -xvf mpir-2.7.2.tar.bz2 -cd mpir-2.7.2 -./configure --enable-shared --disable-static --enable-gmpcompat --build=core2-w64-mingw64 LDFLAGS=-static-libgcc ABI=32 -make -j -cd .. -wget http://www.mpfr.org/mpfr-current/mpfr-3.1.4.tar.bz2 -tar -xvf mpfr-3.1.4.tar.bz2 -cd mpfr-3.1.4 -./configure --with-gmp-build=/home/User/mpir-2.7.2 --enable-shared --disable-static -make -j -cd .. -git clone https://github.com/wbhart/flint2 -https://github.com/wbhart/antic -cd flint2 -./configure --enable-shared --disable-static --with-mpir=/home/user/mpir-2.7.2 --with-mpfr=/home/user/mpfr-3.1.4 --extensions=/home/user/antic -# edit Makefile -# in CLFAGS replace -ansi -pedantic with -std=c99 -# add -mtune=core2 -march=core2 to CFLAGS -# ensure EXTRA_SHARED_FLAGS contains -static-libgcc -shared -Wl,--export-all-symbols -make -j -mkdir flint -cp *.h flint -cd .. -git clone https://github.com/fredrik-johansson/arb -cd arb -./configure --enable-shared --disable-static --with-mpir=/home/user/mpir-2.7.2 --with-mpfr=/home/user/mpfr-3.1.4 --with-flint=/home/user/flint2 -# edit Makefile -# in CLFAGS replace -ansi -pedantic with -std=c99 -# add -mtune=core2 -march=core2 to CFLAGS -# add -I/home/User/flint2 to INCS -# ensure EXTRA_SHARED_FLAGS contains -static-libgcc -shared -Wl,--export-all-symbols -make -j -cd .. -wget http://pari.math.u-bordeaux.fr/pub/pari/unix/pari-2.7.6.tar.gz -tar -xvf pari-2.7.6.tar.gz -cd pari-2.7.6 -export PATH=/home/user/mpir-2.7.2/.libs:$PATH -LDFLAGS=-static-libgcc CFLAGS="-mtune=core2 -march=core2" ./Configure --with-gmp-include=/home/user/mpir-2.7.2 --with-gmp-lib=/home/user/mpir-2.7.2/.libs --host=i686-pc-mingw -cd Omingw-i686-pc -make gp -cd ../.. - -# For Windows 64: - -# replace i686 with x86_64 through -# replace ABI=32 with ABI=64 -