From 7b565eb966b36539b325b039fda419f7d56f40c8 Mon Sep 17 00:00:00 2001 From: Alexander Demin Date: Tue, 11 Jul 2023 22:59:35 +0300 Subject: [PATCH] format ome files --- src/input-output/AbstractAlgebra.jl | 12 +- test/groebner/groebner.jl | 41 +-- test/groebner/mod_reconstruction.jl | 1 - test/input-output/AbstractAlgebra.jl | 8 +- test/learn_and_apply/learn_and_apply.jl | 24 +- test/monoms/monom_orders.jl | 358 ++++++++++++------------ test/monoms/packedtuples.jl | 15 +- test/normalform/normalform_stress.jl | 2 +- test/output_inferred.jl | 4 +- test/regressions.jl | 7 +- test/runtests.jl | 5 +- 11 files changed, 245 insertions(+), 232 deletions(-) diff --git a/src/input-output/AbstractAlgebra.jl b/src/input-output/AbstractAlgebra.jl index c58cdc76..db88a21c 100644 --- a/src/input-output/AbstractAlgebra.jl +++ b/src/input-output/AbstractAlgebra.jl @@ -48,9 +48,7 @@ function extract_ring(polynomials) @assert hasmethod(AbstractAlgebra.characteristic, Tuple{T}) nv = AbstractAlgebra.nvars(R) # lex is the default ordering on univariate polynomials - ord = - hasmethod(AbstractAlgebra.ordering, Tuple{T}) ? AbstractAlgebra.ordering(R) : - :lex + ord = hasmethod(AbstractAlgebra.ordering, Tuple{T}) ? AbstractAlgebra.ordering(R) : :lex # type unstable: ordT = ordering_sym2typed(ord) ch = AbstractAlgebra.characteristic(R) @@ -125,7 +123,7 @@ function extract_coeffs_raw!(graph, representation, polys::Vector{T}, kws) where perm = graph.input_permutation Ch = representation.coefftype _extract_coeffs_raw!(basis, perm, polys, Ch) - @log level=-5 "Extracted coefficients from $(length(polys)) polynomials." basis perm + @log level = -5 "Extracted coefficients from $(length(polys)) polynomials." basis perm ring end @@ -150,11 +148,7 @@ function extract_coeffs_qq(representation, ring::PolyRing, poly) map(Rational, AbstractAlgebra.coefficients(poly)) end -function extract_monoms( - representation::PolynomialRepresentation, - ring::PolyRing, - poly -) +function extract_monoms(representation::PolynomialRepresentation, ring::PolyRing, poly) exps = Vector{representation.monomtype}(undef, length(poly)) @inbounds for j in 1:length(poly) exps[j] = construct_monom( diff --git a/test/groebner/groebner.jl b/test/groebner/groebner.jl index 5893cea8..6cd23346 100644 --- a/test/groebner/groebner.jl +++ b/test/groebner/groebner.jl @@ -256,9 +256,11 @@ end x10^2 - 71551 // 26396 * x10 + 45155 // 26396 ] - system = [x1 + BigInt(10)^100 // BigInt(7)^50 * x2, - BigInt(90) * x1*x2 + BigInt(19)^50 + x10^3, - BigInt(2^31-1)*x1^2 + BigInt(2^30 + 2)^10 * x2^2] + system = [ + x1 + BigInt(10)^100 // BigInt(7)^50 * x2, + BigInt(90) * x1 * x2 + BigInt(19)^50 + x10^3, + BigInt(2^31 - 1) * x1^2 + BigInt(2^30 + 2)^10 * x2^2 + ] @test Groebner.groebner(system) == Groebner.groebner(system, certify=true) end @@ -463,7 +465,8 @@ end R, (x, y, z) = PolynomialRing(field, ["x", "y", "z"], ordering=:lex) @test Groebner.normalform([R(0)], [R(0)]) == [R(0)] - @test Groebner.normalform([R(0), R(0), R(0)], [x + 2, x, x + 1]) == [x + 2, x, x + 1] + @test Groebner.normalform([R(0), R(0), R(0)], [x + 2, x, x + 1]) == + [x + 2, x, x + 1] @test Groebner.normalform([R(0), R(0), R(0)], R(0)) == R(0) @test_throws AssertionError Groebner.normalform([], x) @@ -497,7 +500,9 @@ end [y, x] fs = [x^2 + y, x * y] - @test Groebner.groebner(fs, linalg=linalg) == Groebner.groebner(fs) == [y^2, x * y, x^2 + y] + @test Groebner.groebner(fs, linalg=linalg) == + Groebner.groebner(fs) == + [y^2, x * y, x^2 + y] root = Groebner.rootn(3, ground=GF(2^31 - 1), ordering=:degrevlex) x1, x2, x3 = gens(parent(first(root))) @@ -516,17 +521,19 @@ end gb1 = Groebner.groebner(ku) gb2 = Groebner.groebner(ku, linalg=linalg) - @test gb1 == gb2 == [ - x9 + 1272065637 * x10 + 875418006, - x8 + 1529540685 * x10 + 617942964, - x7 + 1539832471 * x10 + 607651173, - x6 + 1314302432 * x10 + 833181218, - x5 + 1453635454 * x10 + 693848197, - x4 + 673118236 * x10 + 1474365406, - x3 + 269783061 * x10 + 1877700587, - x2 + 1042807874 * x10 + 1104675778, - x1 + 389079675 * x10 + 1758403970, - x10^2 + 1222705397 * x10 + 924778249 - ] + @test gb1 == + gb2 == + [ + x9 + 1272065637 * x10 + 875418006, + x8 + 1529540685 * x10 + 617942964, + x7 + 1539832471 * x10 + 607651173, + x6 + 1314302432 * x10 + 833181218, + x5 + 1453635454 * x10 + 693848197, + x4 + 673118236 * x10 + 1474365406, + x3 + 269783061 * x10 + 1877700587, + x2 + 1042807874 * x10 + 1104675778, + x1 + 389079675 * x10 + 1758403970, + x10^2 + 1222705397 * x10 + 924778249 + ] end end diff --git a/test/groebner/mod_reconstruction.jl b/test/groebner/mod_reconstruction.jl index a2e1f03d..d20a1d9f 100644 --- a/test/groebner/mod_reconstruction.jl +++ b/test/groebner/mod_reconstruction.jl @@ -30,5 +30,4 @@ using Primes @test Base.unsafe_rational(num, den) == a end end - end diff --git a/test/input-output/AbstractAlgebra.jl b/test/input-output/AbstractAlgebra.jl index 173e694c..34da2a56 100644 --- a/test/input-output/AbstractAlgebra.jl +++ b/test/input-output/AbstractAlgebra.jl @@ -17,8 +17,12 @@ end # R, (x, y) = AbstractAlgebra.GF(nextprime(BigInt(2)^100))["x","y"] aa_orderings_to_test = [:lex, :degrevlex, :deglex] - aa_grounds_to_test = - [AbstractAlgebra.GF(2^62 + 135), AbstractAlgebra.GF(2^31 - 1), AbstractAlgebra.GF(17), AbstractAlgebra.QQ] + aa_grounds_to_test = [ + AbstractAlgebra.GF(2^62 + 135), + AbstractAlgebra.GF(2^31 - 1), + AbstractAlgebra.GF(17), + AbstractAlgebra.QQ + ] for ord in aa_orderings_to_test for ground in aa_grounds_to_test diff --git a/test/learn_and_apply/learn_and_apply.jl b/test/learn_and_apply/learn_and_apply.jl index 541d28d1..48336894 100644 --- a/test/learn_and_apply/learn_and_apply.jl +++ b/test/learn_and_apply/learn_and_apply.jl @@ -2,7 +2,7 @@ const loglevel = 0 @testset "Learn & apply" begin - K = AbstractAlgebra.GF(2^31-1) + K = AbstractAlgebra.GF(2^31 - 1) R, (x, y) = PolynomialRing(K, ["x", "y"], ordering=:degrevlex) R2, xs = PolynomialRing(K, ["x$i" for i in 1:30], ordering=:degrevlex) @@ -31,7 +31,7 @@ const loglevel = 0 (system=Groebner.kinema(ordering=:degrevlex, ground=K),), (system=Groebner.sparse5(ordering=:degrevlex, ground=K),), (system=Groebner.s9_1(ordering=:degrevlex, ground=K),), - (system=[sum(xs) + prod(xs), sum(xs)^2, prod(xs) - 1],), + (system=[sum(xs) + prod(xs), sum(xs)^2, prod(xs) - 1],) ] for case in cases # Learn and apply on the same system @@ -46,7 +46,7 @@ const loglevel = 0 X = gens(parent(first(system))) for _ in 1:N point = map(t -> iszero(t) ? t + 1 : t, rand(K, length(X))) .* X - system_ = map(f -> evaluate(f, point), system) + system_ = map(f -> evaluate(f, point), system) true_gb = Groebner.groebner(system_, loglevel=loglevel) flag, gb_2 = Groebner.groebner_apply!(graph, system_, loglevel=loglevel) @test flag && gb_2 == true_gb @@ -55,11 +55,11 @@ const loglevel = 0 end @testset "Learn & apply tricky" begin - K = AbstractAlgebra.GF(2^31-1) + K = AbstractAlgebra.GF(2^31 - 1) R, (x, y) = PolynomialRing(K, ["x", "y"], ordering=:degrevlex) - + # s-poly of x + 1 and x*y + 7y is y - 7y. - system_1 = [x + 1, x*y + 7y] + system_1 = [x + 1, x * y + 7y] graph, gb_1 = Groebner.groebner_learn(system_1, loglevel=loglevel) flag, gb_2 = Groebner.groebner_apply!(graph, system_1, loglevel=loglevel) @test flag && gb_2 == gb_1 @@ -69,12 +69,12 @@ end # Cancellation of a leading term: # s-poly of x + 1 and x*y + y is 0 = y - y. - system_2 = [x + 1, x*y + y] + system_2 = [x + 1, x * y + y] flag, gb_2 = Groebner.groebner_apply!(graph, system_2, loglevel=loglevel) @test !flag # s-poly of x + y + 1 and x*y + 7y is y^2 - 7y - system_1 = [x + y + 1, x*y + 7y] + system_1 = [x + y + 1, x * y + 7y] graph, gb_1 = Groebner.groebner_learn(system_1, loglevel=loglevel) flag, gb_2 = Groebner.groebner_apply!(graph, system_1, loglevel=loglevel) @test flag && gb_2 == gb_1 @@ -82,16 +82,16 @@ end # Cancellation of a trailing term: # s-poly of x + y + 1 and x*y + y is y^2 # TODO: produce a warning here - system_2 = [x + y + 1, x*y + y] + system_2 = [x + y + 1, x * y + y] flag, gb_2 = Groebner.groebner_apply!(graph, system_2, loglevel=loglevel) @test !flag # Input is a Groebner basis already: N = 3 for system in [ - Groebner.noonn(4, ordering=:degrevlex, ground=K), + Groebner.noonn(4, ordering=:degrevlex, ground=K), Groebner.katsuran(5, ordering=:degrevlex, ground=K), - [x, x^2, y^2, x*y, x^3, y^4, x^10, y^10, x*y^10] + [x, x^2, y^2, x * y, x^3, y^4, x^10, y^10, x * y^10] ] gb = Groebner.groebner(system, loglevel=loglevel) for i in 1:N @@ -99,5 +99,5 @@ end flag, gb_2 = Groebner.groebner_apply!(graph, gb, loglevel=loglevel) @test flag && gb_2 == gb_1 == gb end - end + end end diff --git a/test/monoms/monom_orders.jl b/test/monoms/monom_orders.jl index 6be2844c..7845cd39 100644 --- a/test/monoms/monom_orders.jl +++ b/test/monoms/monom_orders.jl @@ -99,8 +99,10 @@ implementations_to_test = [ for n in 1:2 k = rand(1:100) - implementations_to_test_local = - filter(xxx -> Groebner.max_vars_in_monom(xxx{T}) >= k, implementations_to_test) + implementations_to_test_local = filter( + xxx -> Groebner.max_vars_in_monom(xxx{T}) >= k, + implementations_to_test + ) t = div(typemax(UInt8), k) - 1 x, y = rand(1:t, k), rand(1:t, k) @@ -146,191 +148,189 @@ function test_orderings(v1, v2, ords_to_test) end if false + @testset "monom orders: WeightedOrdering" begin + pv = Groebner.ExponentVector{T} where {T} + + v1 = Groebner.construct_monom(pv{UInt64}, [1, 2, 3]) + v2 = Groebner.construct_monom(pv{UInt64}, [3, 2, 1]) + + @test_throws AssertionError Groebner.WeightedOrdering([-1, 0, 0]) + + ords_to_test = [ + (ord=Groebner.WeightedOrdering([1, 1, 1]), ans=[true, false]), + (ord=Groebner.WeightedOrdering([0, 0, 1]), ans=[false, true]), + (ord=Groebner.WeightedOrdering([0, 1, 0]), ans=[true, false]), + (ord=Groebner.WeightedOrdering([1, 0, 0]), ans=[true, false]), + (ord=Groebner.WeightedOrdering([1, 1, 5]), ans=[false, true]), + (ord=Groebner.WeightedOrdering([1, 0, 0]), ans=[true, false]) + ] + + test_orderings(v1, v2, ords_to_test) + + v1 = Groebner.construct_monom(pv{UInt64}, [1, 2, 3]) + v2 = Groebner.construct_monom(pv{UInt64}, [1, 2, 3]) + + ords_to_test = [ + (ord=Groebner.WeightedOrdering([1, 1, 1]), ans=[false, false]), + (ord=Groebner.WeightedOrdering([0, 0, 1]), ans=[false, false]), + (ord=Groebner.WeightedOrdering([0, 1, 0]), ans=[false, false]), + (ord=Groebner.WeightedOrdering([1, 0, 0]), ans=[false, false]), + (ord=Groebner.WeightedOrdering([1, 1, 5]), ans=[false, false]), + (ord=Groebner.WeightedOrdering([1, 0, 0]), ans=[false, false]) + ] + + test_orderings(v1, v2, ords_to_test) + + v1 = Groebner.construct_monom(pv{UInt64}, [1, 2, 3, 0, 0, 7]) + v2 = Groebner.construct_monom(pv{UInt64}, [4, 5, 0, 0, 1, 4]) + + ords_to_test = [ + (ord=Groebner.WeightedOrdering([1, 1, 1, 1, 1, 1]), ans=[true, false]), + (ord=Groebner.WeightedOrdering([0, 0, 0, 0, 0, 4]), ans=[false, true]), + (ord=Groebner.WeightedOrdering([0, 2, 5, 0, 0, 0]), ans=[false, true]), + (ord=Groebner.WeightedOrdering([0, 2, 2, 0, 0, 0]), ans=[true, false]) + ] + + test_orderings(v1, v2, ords_to_test) + end -@testset "monom orders: WeightedOrdering" begin - pv = Groebner.ExponentVector{T} where {T} - - v1 = Groebner.construct_monom(pv{UInt64}, [1, 2, 3]) - v2 = Groebner.construct_monom(pv{UInt64}, [3, 2, 1]) - - @test_throws AssertionError Groebner.WeightedOrdering([-1, 0, 0]) - - ords_to_test = [ - (ord=Groebner.WeightedOrdering([1, 1, 1]), ans=[true, false]), - (ord=Groebner.WeightedOrdering([0, 0, 1]), ans=[false, true]), - (ord=Groebner.WeightedOrdering([0, 1, 0]), ans=[true, false]), - (ord=Groebner.WeightedOrdering([1, 0, 0]), ans=[true, false]), - (ord=Groebner.WeightedOrdering([1, 1, 5]), ans=[false, true]), - (ord=Groebner.WeightedOrdering([1, 0, 0]), ans=[true, false]) - ] - - test_orderings(v1, v2, ords_to_test) - - v1 = Groebner.construct_monom(pv{UInt64}, [1, 2, 3]) - v2 = Groebner.construct_monom(pv{UInt64}, [1, 2, 3]) - - ords_to_test = [ - (ord=Groebner.WeightedOrdering([1, 1, 1]), ans=[false, false]), - (ord=Groebner.WeightedOrdering([0, 0, 1]), ans=[false, false]), - (ord=Groebner.WeightedOrdering([0, 1, 0]), ans=[false, false]), - (ord=Groebner.WeightedOrdering([1, 0, 0]), ans=[false, false]), - (ord=Groebner.WeightedOrdering([1, 1, 5]), ans=[false, false]), - (ord=Groebner.WeightedOrdering([1, 0, 0]), ans=[false, false]) - ] - - test_orderings(v1, v2, ords_to_test) + @testset "monom orders: BlockOrdering" begin + pv = Groebner.ExponentVector{T} where {T} - v1 = Groebner.construct_monom(pv{UInt64}, [1, 2, 3, 0, 0, 7]) - v2 = Groebner.construct_monom(pv{UInt64}, [4, 5, 0, 0, 1, 4]) + @test_throws AssertionError Groebner.BlockOrdering( + 1:1, + Groebner.Lex(), + 3:5, + Groebner.DegLex() + ) + @test_throws AssertionError Groebner.BlockOrdering( + 1:2, + Groebner.Lex(), + 2:3, + Groebner.DegLex() + ) - ords_to_test = [ - (ord=Groebner.WeightedOrdering([1, 1, 1, 1, 1, 1]), ans=[true, false]), - (ord=Groebner.WeightedOrdering([0, 0, 0, 0, 0, 4]), ans=[false, true]), - (ord=Groebner.WeightedOrdering([0, 2, 5, 0, 0, 0]), ans=[false, true]), - (ord=Groebner.WeightedOrdering([0, 2, 2, 0, 0, 0]), ans=[true, false]) - ] + # should we disallow this ? + Groebner.BlockOrdering( + 1:2, + Groebner.BlockOrdering(0:1, Groebner.Lex(), 2:2, Groebner.Lex()), + 3:3, + Groebner.DegLex() + ) - test_orderings(v1, v2, ords_to_test) -end + v1 = Groebner.construct_monom(pv{UInt64}, [1, 2, 3]) + v2 = Groebner.construct_monom(pv{UInt64}, [3, 2, 1]) -@testset "monom orders: BlockOrdering" begin - pv = Groebner.ExponentVector{T} where {T} - - @test_throws AssertionError Groebner.BlockOrdering( - 1:1, - Groebner.Lex(), - 3:5, - Groebner.DegLex() - ) - @test_throws AssertionError Groebner.BlockOrdering( - 1:2, - Groebner.Lex(), - 2:3, - Groebner.DegLex() - ) - - # should we disallow this ? - Groebner.BlockOrdering( - 1:2, - Groebner.BlockOrdering(0:1, Groebner.Lex(), 2:2, Groebner.Lex()), - 3:3, - Groebner.DegLex() - ) - - v1 = Groebner.construct_monom(pv{UInt64}, [1, 2, 3]) - v2 = Groebner.construct_monom(pv{UInt64}, [3, 2, 1]) - - bo_to_test = [ - ( - ord=Groebner.BlockOrdering(1:1, Groebner.Lex(), 2:3, Groebner.DegLex()), - ans=[true, false] - ), - ( - ord=Groebner.BlockOrdering(1:2, Groebner.DegRevLex(), 3:3, Groebner.Lex()), - ans=[true, false] - ), - ( - ord=Groebner.BlockOrdering( - 1:2, - Groebner.WeightedOrdering([0, 1]), - 3:3, - Groebner.WeightedOrdering([0]) + bo_to_test = [ + ( + ord=Groebner.BlockOrdering(1:1, Groebner.Lex(), 2:3, Groebner.DegLex()), + ans=[true, false] ), - ans=[true, false] - ), - ( - ord=Groebner.BlockOrdering( - 1:2, - Groebner.WeightedOrdering([1, 1]), - 3:3, - Groebner.WeightedOrdering([0]) + ( + ord=Groebner.BlockOrdering(1:2, Groebner.DegRevLex(), 3:3, Groebner.Lex()), + ans=[true, false] ), - ans=[true, false] - ) - ] - - test_orderings(v1, v2, bo_to_test) - - v1 = Groebner.construct_monom(pv{UInt64}, [4, 1, 7, 0, 9, 8]) - v2 = Groebner.construct_monom(pv{UInt64}, [1, 6, 3, 5, 9, 100]) - - bo_to_test = [ - ( - ord=Groebner.BlockOrdering(1:1, Groebner.DegLex(), 2:6, Groebner.DegLex()), - ans=[false, true] - ), - ( - ord=Groebner.BlockOrdering(1:2, Groebner.DegLex(), 3:6, Groebner.DegLex()), - ans=[true, false] - ), - ( - ord=Groebner.BlockOrdering(1:3, Groebner.DegLex(), 4:6, Groebner.DegLex()), - ans=[false, true] - ), - ( - ord=Groebner.BlockOrdering(1:4, Groebner.DegLex(), 5:6, Groebner.DegLex()), - ans=[true, false] - ), - ( - ord=Groebner.BlockOrdering( - 1:4, - Groebner.BlockOrdering(1:2, Groebner.DegLex(), 3:4, Groebner.DegLex()), - 5:6, - Groebner.DegLex() + ( + ord=Groebner.BlockOrdering( + 1:2, + Groebner.WeightedOrdering([0, 1]), + 3:3, + Groebner.WeightedOrdering([0]) + ), + ans=[true, false] ), - ans=[true, false] - ), - ( - ord=Groebner.BlockOrdering( - 1:4, - Groebner.BlockOrdering(1:3, Groebner.DegLex(), 4:4, Groebner.DegLex()), - 5:6, - Groebner.DegLex() + ( + ord=Groebner.BlockOrdering( + 1:2, + Groebner.WeightedOrdering([1, 1]), + 3:3, + Groebner.WeightedOrdering([0]) + ), + ans=[true, false] + ) + ] + + test_orderings(v1, v2, bo_to_test) + + v1 = Groebner.construct_monom(pv{UInt64}, [4, 1, 7, 0, 9, 8]) + v2 = Groebner.construct_monom(pv{UInt64}, [1, 6, 3, 5, 9, 100]) + + bo_to_test = [ + ( + ord=Groebner.BlockOrdering(1:1, Groebner.DegLex(), 2:6, Groebner.DegLex()), + ans=[false, true] ), - ans=[true, false] - ) - ] - - test_orderings(v1, v2, bo_to_test) -end - -@testset "monom orders: MatrixOrdering" begin - pv = Groebner.ExponentVector{T} where {T} - - # @test_throws AssertionError Groebner.MatrixOrdering([-1 0 0; 0 1 0;]) - - v1 = Groebner.construct_monom(pv{UInt64}, [1, 2, 3]) - v2 = Groebner.construct_monom(pv{UInt64}, [3, 2, 1]) - - ord1 = Groebner.MatrixOrdering([ - 1 0 0 - 0 1 0 - 0 0 1 - ]) - ord2 = Groebner.MatrixOrdering([ - 1 0 2; - ]) - ord3 = Groebner.MatrixOrdering([ - 0 0 0 - 0 1 0 - 1 1 1 - ]) - ord4 = Groebner.MatrixOrdering([ - -1 0 0; - ]) - ord5 = Groebner.MatrixOrdering([ - 1 -8 1 - 2 0 3 - ]) - - mo_to_test = [ - (ord=ord1, ans=[true, false]), - (ord=ord2, ans=[false, true]), - (ord=ord3, ans=[false, false]), - (ord=ord4, ans=[false, true]), - (ord=ord5, ans=[false, true]) - ] - test_orderings(v1, v2, mo_to_test) -end + ( + ord=Groebner.BlockOrdering(1:2, Groebner.DegLex(), 3:6, Groebner.DegLex()), + ans=[true, false] + ), + ( + ord=Groebner.BlockOrdering(1:3, Groebner.DegLex(), 4:6, Groebner.DegLex()), + ans=[false, true] + ), + ( + ord=Groebner.BlockOrdering(1:4, Groebner.DegLex(), 5:6, Groebner.DegLex()), + ans=[true, false] + ), + ( + ord=Groebner.BlockOrdering( + 1:4, + Groebner.BlockOrdering(1:2, Groebner.DegLex(), 3:4, Groebner.DegLex()), + 5:6, + Groebner.DegLex() + ), + ans=[true, false] + ), + ( + ord=Groebner.BlockOrdering( + 1:4, + Groebner.BlockOrdering(1:3, Groebner.DegLex(), 4:4, Groebner.DegLex()), + 5:6, + Groebner.DegLex() + ), + ans=[true, false] + ) + ] + + test_orderings(v1, v2, bo_to_test) + end + @testset "monom orders: MatrixOrdering" begin + pv = Groebner.ExponentVector{T} where {T} + + # @test_throws AssertionError Groebner.MatrixOrdering([-1 0 0; 0 1 0;]) + + v1 = Groebner.construct_monom(pv{UInt64}, [1, 2, 3]) + v2 = Groebner.construct_monom(pv{UInt64}, [3, 2, 1]) + + ord1 = Groebner.MatrixOrdering([ + 1 0 0 + 0 1 0 + 0 0 1 + ]) + ord2 = Groebner.MatrixOrdering([ + 1 0 2; + ]) + ord3 = Groebner.MatrixOrdering([ + 0 0 0 + 0 1 0 + 1 1 1 + ]) + ord4 = Groebner.MatrixOrdering([ + -1 0 0; + ]) + ord5 = Groebner.MatrixOrdering([ + 1 -8 1 + 2 0 3 + ]) + + mo_to_test = [ + (ord=ord1, ans=[true, false]), + (ord=ord2, ans=[false, true]), + (ord=ord3, ans=[false, false]), + (ord=ord4, ans=[false, true]), + (ord=ord5, ans=[false, true]) + ] + test_orderings(v1, v2, mo_to_test) + end end diff --git a/test/monoms/packedtuples.jl b/test/monoms/packedtuples.jl index 897efa0d..3ec0fb41 100644 --- a/test/monoms/packedtuples.jl +++ b/test/monoms/packedtuples.jl @@ -16,7 +16,10 @@ @test Groebner.max_vars_in_monom(Groebner.PackedTuple1{UInt64, UInt16}) == 3 y = [10, 20, 30, 40, 50] - @test_throws Groebner.MonomialDegreeOverflow Groebner.construct_monom(EV{UInt64, UInt8}, y) + @test_throws Groebner.MonomialDegreeOverflow Groebner.construct_monom( + EV{UInt64, UInt8}, + y + ) for B in (UInt8, UInt16) for T in (UInt64, UInt32) @@ -64,7 +67,10 @@ end @test Groebner.totaldeg(ev) == UInt16(10) y = [10, 20, 30, 40, 50] - @test_throws Groebner.MonomialDegreeOverflow Groebner.construct_monom(EV{UInt64, UInt8}, y) + @test_throws Groebner.MonomialDegreeOverflow Groebner.construct_monom( + EV{UInt64, UInt8}, + y + ) for B in (UInt8, UInt16) for T in (UInt64, UInt32) @@ -114,7 +120,10 @@ end @test Groebner.totaldeg(ev) == UInt16(10) y = [10, 20, 30, 40, 50] - @test_throws Groebner.MonomialDegreeOverflow Groebner.construct_monom(EV{UInt64, UInt8}, y) + @test_throws Groebner.MonomialDegreeOverflow Groebner.construct_monom( + EV{UInt64, UInt8}, + y + ) y = [1, 2, 3, 4, 5] ev = Groebner.construct_monom(EV{UInt64, UInt32}, y) diff --git a/test/normalform/normalform_stress.jl b/test/normalform/normalform_stress.jl index 1982c073..6e8c77d5 100644 --- a/test/normalform/normalform_stress.jl +++ b/test/normalform/normalform_stress.jl @@ -55,7 +55,7 @@ end exps = [1:2, 2:4, 2:3] nterms = [1:1, 1:2, 2:3] npolys = [1:1, 1:3, 2:3] - grounds = [GF(2^31-1), QQ] + grounds = [GF(2^31 - 1), QQ] coeffssize = [3, 1000, 2^31 - 1] orderings = [:deglex, :lex, :degrevlex] p = prod(map(length, (nvariables, exps, nterms, npolys, grounds, orderings, coeffssize))) diff --git a/test/output_inferred.jl b/test/output_inferred.jl index 6d911f05..c2ebb7e0 100644 --- a/test/output_inferred.jl +++ b/test/output_inferred.jl @@ -1,6 +1,6 @@ @testset "Output type inferred" begin - R, (x, y) = QQ["x","y"] + R, (x, y) = QQ["x", "y"] @inferred groebner([x, y]) @inferred groebner([x, y], ordering=DegRevLex()) @inferred normalform([x, y], x + 1) @@ -9,7 +9,7 @@ @inferred isgroebner([x, y]) @inferred kbase([x^2, y]) - R, (x, y) = GF(2^31-1)["x","y"] + R, (x, y) = GF(2^31 - 1)["x", "y"] @inferred groebner([x, y]) @inferred groebner([x, y], ordering=DegRevLex()) @inferred normalform([x, y], x + 1) diff --git a/test/regressions.jl b/test/regressions.jl index a9fe0646..16337428 100644 --- a/test/regressions.jl +++ b/test/regressions.jl @@ -89,8 +89,11 @@ end 2 ] - exps = - Groebner.ExponentVector{UInt64}[[0x0000, 0x0000], [0x0002, 0x0002], [0x0002, 0x0002]] + exps = Groebner.ExponentVector{UInt64}[ + [0x0000, 0x0000], + [0x0002, 0x0002], + [0x0002, 0x0002] + ] bug(gens, exps) end diff --git a/test/runtests.jl b/test/runtests.jl index b506f800..971b42a8 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -44,10 +44,7 @@ end @includetests ["isgroebner/isgroebner"] - @includetests [ - "normalform/normalform", - "normalform/normalform_stress", - ] + @includetests ["normalform/normalform", "normalform/normalform_stress"] @includetests ["fglm/kbase"] # Groebner.jl is tested for different frontends: