Skip to content

Commit

Permalink
accommodate the breaking change in AA.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
sumiya11 committed Feb 22, 2024
1 parent 60ee4b4 commit 99e3451
Show file tree
Hide file tree
Showing 106 changed files with 1,051 additions and 691 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"

[compat]
AbstractAlgebra = "0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.40"
AbstractAlgebra = "0.40"
Atomix = "0.1"
BenchmarkTools = "1"
Combinatorics = "1"
ExprTools = "0.1"
HostCPUFeatures = "0.1"
MultivariatePolynomials = "0.5"
Nemo = "0.38.3, 0.39, 0.40, 0.41, 0.42, 0.43"
Nemo = "0.43"
PrecompileTools = "1"
PrettyTables = "2"
Primes = "0.5"
Expand Down
97 changes: 67 additions & 30 deletions benchmark/CI-scripts/run_benchmarks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,63 +29,84 @@ end
# Compute Groebner bases over integers modulo a large prime
problem = (
problem_name="groebner, AA, GF(2^31-1), katsura 5",
result=compute_gb(Groebner.katsuran(5, ordering=:degrevlex, k=GF(2^31 - 1)))
result=compute_gb(Groebner.katsuran(5, internal_ordering=:degrevlex, k=GF(2^31 - 1)))
)
push!(suite, problem)
push!(
suite,
(
problem_name="groebner, AA, GF(2^31-1), katsura 5",
result=compute_gb(Groebner.katsuran(5, ordering=:degrevlex, k=GF(2^31 - 1)))
result=compute_gb(
Groebner.katsuran(5, internal_ordering=:degrevlex, k=GF(2^31 - 1))
)
)
)
push!(
suite,
(
problem_name="groebner, AA, GF(2^31-1), katsura 6",
result=compute_gb(Groebner.katsuran(6, ordering=:degrevlex, k=GF(2^31 - 1)))
result=compute_gb(
Groebner.katsuran(6, internal_ordering=:degrevlex, k=GF(2^31 - 1))
)
)
)
push!(
suite,
(
problem_name="groebner, AA, GF(2^31-1), katsura 8",
result=compute_gb(Groebner.katsuran(8, ordering=:degrevlex, k=GF(2^31 - 1)))
result=compute_gb(
Groebner.katsuran(8, internal_ordering=:degrevlex, k=GF(2^31 - 1))
)
)
)
push!(
suite,
(
problem_name="groebner, AA, GF(2^31-1), katsura 10",
result=compute_gb(Groebner.katsuran(10, ordering=:degrevlex, k=GF(2^31 - 1)), 5)
result=compute_gb(
Groebner.katsuran(10, internal_ordering=:degrevlex, k=GF(2^31 - 1)),
5
)
)
)
push!(
suite,
(
problem_name="groebner, AA, GF(2^27+29), katsura 10",
result=compute_gb(Groebner.katsuran(10, ordering=:degrevlex, k=GF(2^27 + 29)), 5)
result=compute_gb(
Groebner.katsuran(10, internal_ordering=:degrevlex, k=GF(2^27 + 29)),
5
)
)
)
push!(
suite,
(
problem_name="groebner, AA, GF(2^30+3), katsura 11",
result=compute_gb(Groebner.katsuran(11, ordering=:degrevlex, k=GF(2^30 + 3)), 3)
result=compute_gb(
Groebner.katsuran(11, internal_ordering=:degrevlex, k=GF(2^30 + 3)),
3
)
)
)
push!(
suite,
(
problem_name="groebner, AA, GF(2^27+29), cyclic 8",
result=compute_gb(Groebner.cyclicn(8, ordering=:degrevlex, k=GF(2^27 + 29)), 5)
result=compute_gb(
Groebner.cyclicn(8, internal_ordering=:degrevlex, k=GF(2^27 + 29)),
5
)
)
)
push!(
suite,
(
problem_name="groebner, AA, GF(2^31-1), cyclic 8",
result=compute_gb(Groebner.cyclicn(8, ordering=:degrevlex, k=GF(2^31 - 1)), 5)
result=compute_gb(
Groebner.cyclicn(8, internal_ordering=:degrevlex, k=GF(2^31 - 1)),
5
)
)
)
push!(
Expand All @@ -95,15 +116,15 @@ push!(
result=compute_gb(
Groebner.cyclicn(
8,
ordering=:degrevlex,
internal_ordering=:degrevlex,
k=nemo_make_prime_finite_field(2^31 - 1)
)
)
)
)

function n_variable_set(n; ordering=:degrevlex, k=GF(2^31 - 1))
R, x = polynomial_ring(k, ["x$i" for i in 1:n], ordering=ordering)
function n_variable_set(n; internal_ordering=:degrevlex, k=GF(2^31 - 1))
R, x = polynomial_ring(k, ["x$i" for i in 1:n], internal_ordering=internal_ordering)
f = [sum(prod(x[i:(n - kk)], init=1) for i in 1:(kk + 1)) for kk in 0:(n - 1)]
f
end
Expand All @@ -112,7 +133,9 @@ push!(
suite,
(
problem_name="groebner, AA, GF(2^31-1), 100 vars",
result=compute_gb(n_variable_set(100, ordering=:degrevlex, k=GF(2^31 - 1)))
result=compute_gb(
n_variable_set(100, internal_ordering=:degrevlex, k=GF(2^31 - 1))
)
)
)

Expand All @@ -121,7 +144,7 @@ push!(
(
problem_name="groebner, threaded, AA, GF(2^31-1), cyclic 8",
result=compute_gb(
Groebner.cyclicn(8, ordering=:degrevlex, k=GF(2^31 - 1)),
Groebner.cyclicn(8, internal_ordering=:degrevlex, k=GF(2^31 - 1)),
5,
threaded=:yes
)
Expand All @@ -145,7 +168,9 @@ push!(
suite,
(
problem_name="groebner_apply!, AA, GF(2^31-1), cyclic 7",
result=learn_and_apply(Groebner.cyclicn(7, ordering=:degrevlex, k=GF(2^31 - 1)))
result=learn_and_apply(
Groebner.cyclicn(7, internal_ordering=:degrevlex, k=GF(2^31 - 1))
)
)
)
push!(
Expand All @@ -155,7 +180,7 @@ push!(
result=learn_and_apply(
Groebner.cyclicn(
7,
ordering=:degrevlex,
internal_ordering=:degrevlex,
k=nemo_make_prime_finite_field(2^31 - 1)
)
)
Expand All @@ -165,14 +190,18 @@ push!(
suite,
(
problem_name="groebner_apply!, AA, GF(2^31-1), katsura 10",
result=learn_and_apply(Groebner.katsuran(10, ordering=:degrevlex, k=GF(2^31 - 1)))
result=learn_and_apply(
Groebner.katsuran(10, internal_ordering=:degrevlex, k=GF(2^31 - 1))
)
)
)
push!(
suite,
(
problem_name="groebner_apply!, AA, GF(2^27+29), katsura 10",
result=learn_and_apply(Groebner.katsuran(10, ordering=:degrevlex, k=GF(2^27 + 29)))
result=learn_and_apply(
Groebner.katsuran(10, internal_ordering=:degrevlex, k=GF(2^27 + 29))
)
)
)
push!(
Expand All @@ -182,7 +211,7 @@ push!(
result=learn_and_apply(
Groebner.katsuran(
10,
ordering=:degrevlex,
internal_ordering=:degrevlex,
k=nemo_make_prime_finite_field(2^31 - 1)
)
)
Expand All @@ -194,47 +223,47 @@ push!(
suite,
(
problem_name="groebner, AA, QQ, katsura 8",
result=compute_gb(Groebner.katsuran(8, ordering=:degrevlex, k=QQ))
result=compute_gb(Groebner.katsuran(8, internal_ordering=:degrevlex, k=QQ))
)
)
push!(
suite,
(
problem_name="groebner, Nemo, QQ, katsura 8",
result=compute_gb(Groebner.katsuran(8, ordering=:degrevlex, k=Nemo.QQ))
result=compute_gb(Groebner.katsuran(8, internal_ordering=:degrevlex, k=Nemo.QQ))
)
)
push!(
suite,
(
problem_name="groebner, AA, QQ, eco 10",
result=compute_gb(Groebner.eco10(ordering=:degrevlex, k=QQ))
result=compute_gb(Groebner.eco10(internal_ordering=:degrevlex, k=QQ))
)
)
push!(
suite,
(
problem_name="groebner, AA, QQ, cyclic 7",
result=compute_gb(Groebner.cyclicn(7, ordering=:degrevlex, k=QQ))
result=compute_gb(Groebner.cyclicn(7, internal_ordering=:degrevlex, k=QQ))
)
)
push!(
suite,
(
problem_name="groebner, AA, QQ, noon 8",
result=compute_gb(Groebner.noonn(8, ordering=:degrevlex, k=QQ), 3)
result=compute_gb(Groebner.noonn(8, internal_ordering=:degrevlex, k=QQ), 3)
)
)

#! format: off
R,(t1,t2,t3,a,b,c) = polynomial_ring(QQ, ["t1","t2","t3","a", "b", "c"], ordering=:degrevlex)
R,(t1,t2,t3,a,b,c) = polynomial_ring(QQ, ["t1","t2","t3","a", "b", "c"], internal_ordering=:degrevlex)
hexapod = [1000000*a^2*t1^2+1000000*a^2*t2^2+1000000*a^2*t3^2+1000000*b^2*t1^2+1000000*b^2*t2^2+1000000*b^2*t3^2+1000000*c^2*t1^2+1000000*c^2*t2^2+1000000*c^2*t3^2-1065102000*a^2*t1-1566200000*a^2*t2+359610000*a^2*t3-4000000*a*b*t2-1574352000*a*b*t3+4000000*a*c*t1+273640000*a*c*t3-1065102000*b^2*t1+8152000*b^2*t2+355610000*b^2*t3-1574352000*b*c*t1-273640000*b*c*t2-791462000*c^2*t1-1566200000*c^2*t2+355610000*c^2*t3+740236705137*a^2-279943961360*a*b+47071636200*a*c+1574352000*a*t1-273640000*a*t2+126292488913*b^2+837307375312*b*c+4000000*b*t1-273640000*b*t3+612513941897*c^2+4000000*c*t2-1574352000*c*t3+1000000*t1^2+1000000*t2^2+1000000*t3^2-624135247952*a-50784764200*b-283060057360*c-791462000*t1+8152000*t2+359610000*t3+165673, 1000000*a^2*t1^2+1000000*a^2*t2^2+1000000*a^2*t3^2+1000000*b^2*t1^2+1000000*b^2*t2^2+1000000*b^2*t3^2+1000000*c^2*t1^2+1000000*c^2*t2^2+1000000*c^2*t3^2-1889130000*a^2*t1-139016000*a^2*t2+357608000*a^2*t3+550492000*a*b*t3+1500376000*a*c*t3-1889130000*b^2*t1-689508000*b^2*t2+357608000*b^2*t3+550492000*b*c*t1-1500376000*b*c*t2-388754000*c^2*t1-139016000*c^2*t2+357608000*c^2*t3+740396599024*a^2+98430171568*a*b+268273230304*a*c-550492000*a*t1-1500376000*a*t2+854420557476*b^2-2714848476*b*c-1500376000*b*t3-114024022072*c^2+550492000*c*t3+1000000*t1^2+1000000*t2^2+1000000*t3^2+624263610988*a-268273230304*b+98430171568*c-388754000*t1-689508000*t2+357608000*t3-63620, 4000000*a^2*t1^2+4000000*a^2*t2^2+4000000*a^2*t3^2+4000000*b^2*t1^2+4000000*b^2*t2^2+4000000*b^2*t3^2+4000000*c^2*t1^2+4000000*c^2*t2^2+4000000*c^2*t3^2-3295636000*a^2*t1+6825304000*a^2*t2+1438448000*a^2*t3-16000000*a*b*t2+4096192000*a*b*t3+16000000*a*c*t1+4906624000*a*c*t3-3295636000*b^2*t1+2729112000*b^2*t2+1422448000*b^2*t3+4096192000*b*c*t1-4906624000*b*c*t2+1610988000*c^2*t1+6825304000*c^2*t2+1422448000*c^2*t3+2962666483625*a^2+722869290752*a*b+875649162944*a*c-4096192000*a*t1-4906624000*a*t2+513760438633*b^2-3361285532000*b*c+16000000*b*t1-4906624000*b*t3+2443184693353*c^2+16000000*c*t2+4096192000*c*t3+4000000*t1^2+4000000*t2^2+4000000*t3^2-2498705324448*a-879018458944*b+741978122752*c+1610988000*t1+2729112000*t2+1438448000*t3+440361,4000000*a^2*t1^2+4000000*a^2*t2^2+4000000*a^2*t3^2+4000000*b^2*t1^2+4000000*b^2*t2^2+4000000*b^2*t3^2+4000000*c^2*t1^2+4000000*c^2*t2^2+4000000*c^2*t3^2+3295636000*a^2*t1+6824896000*a^2*t2+1430432000*a^2*t3+4094592000*a*b*t3-4906624000*a*c*t3+3295636000*b^2*t1+2730304000*b^2*t2+1430432000*b^2*t3+4094592000*b*c*t1+4906624000*b*c*t2-1610988000*c^2*t1+6824896000*c^2*t2+1430432000*c^2*t3+2961910911797*a^2+732129427968*a*b-877323997696*a*c-4094592000*a*t1+4906624000*a*t2+516620569397*b^2+3361357491776*b*c+4906624000*b*t3+2445290017525*c^2+4094592000*c*t3+4000000*t1^2+4000000*t2^2+4000000*t3^2+2499114213824*a+877323997696*b+732129427968*c-1610988000*t1+2730304000*t2+1430432000*t3-324875, 1000000*a^2*t1^2+1000000*a^2*t2^2+1000000*a^2*t3^2+1000000*b^2*t1^2+1000000*b^2*t2^2+1000000*b^2*t3^2+1000000*c^2*t1^2+1000000*c^2*t2^2+1000000*c^2*t3^2+1889602000*a^2*t1-138926000*a^2*t2+359604000*a^2*t3-4000000*a*b*t2+550036000*a*b*t3+4000000*a*c*t1-1500228000*a*c*t3+1889602000*b^2*t1-688962000*b^2*t2+355604000*b^2*t3+550036000*b*c*t1+1500228000*b*c*t2+389374000*c^2*t1-138926000*c^2*t2+355604000*c^2*t3+740903906549*a^2+99175424872*a*b-265964790856*a*c-550036000*a*t1+1500228000*a*t2+854030749541*b^2+2874521168*b*c+4000000*b*t1+1500228000*b*t3-114557203083*c^2+4000000*c*t2+550036000*c*t3+1000000*t1^2+1000000*t2^2+1000000*t3^2-623884900400*a+270522742856*b+97519648872*c+389374000*t1-688962000*t2+359604000*t3+55909, 250000*a^2*t1^2+250000*a^2*t2^2+250000*a^2*t3^2+250000*b^2*t1^2+250000*b^2*t2^2+250000*b^2*t3^2+250000*c^2*t1^2+250000*c^2*t2^2+250000*c^2*t3^2+266341000*a^2*t1-391502000*a^2*t2+89402000*a^2*t3-393620000*a*b*t3-68228000*a*c*t3+266341000*b^2*t1+2118000*b^2*t2+89402000*b^2*t3-393620000*b*c*t1+68228000*b*c*t2+198113000*c^2*t1-391502000*c^2*t2+89402000*c^2*t3+184958257568*a^2-70380830480*a*b-12199439312*a*c+393620000*a*t1+68228000*a*t2+31688927488*b^2-209385275032*b*c+68228000*b*t3+153269490056*c^2-393620000*c*t3+250000*t1^2+250000*t2^2+250000*t3^2+156251491928*a+12199439312*b-70380830480*c+198113000*t1+2118000*t2+89402000*t3+159976]
#! format: on
push!(suite, (problem_name="groebner, AA, QQ, hexapod", result=compute_gb(hexapod, 2)))

function multimodular_gb_problem(nbits; np=AbstractAlgebra)
R, (x1, x2, x3, x4) =
polynomial_ring(np.QQ, ["x1", "x2", "x3", "x4"], ordering=:degrevlex)
polynomial_ring(np.QQ, ["x1", "x2", "x3", "x4"], internal_ordering=:degrevlex)
nbits_per_prime = 31
nprimes = max(div(nbits, nbits_per_prime), 1)
N = prod(map(BigInt, Primes.nextprimes(2^31 - 100, nprimes)))
Expand Down Expand Up @@ -299,31 +328,39 @@ push!(
(
problem_name="normalform, AA, GF(2^31-1), cyclic 7",
result=compute_normalforms(
Groebner.cyclicn(7, ordering=:degrevlex, k=GF(2^31 - 1))
Groebner.cyclicn(7, internal_ordering=:degrevlex, k=GF(2^31 - 1))
)
)
)
push!(
suite,
(
problem_name="normalform, AA, GF(103), cyclic 8",
result=compute_normalforms(Groebner.cyclicn(8, ordering=:degrevlex, k=GF(103)))
result=compute_normalforms(
Groebner.cyclicn(8, internal_ordering=:degrevlex, k=GF(103))
)
)
)
push!(
suite,
(
problem_name="normalform, Nemo, GF(103), cyclic 8",
result=compute_normalforms(
Groebner.cyclicn(8, ordering=:degrevlex, k=nemo_make_prime_finite_field(103))
Groebner.cyclicn(
8,
internal_ordering=:degrevlex,
k=nemo_make_prime_finite_field(103)
)
)
)
)
push!(
suite,
(
problem_name="normalform, AA, QQ, katsura 9",
result=compute_normalforms(Groebner.katsuran(9, ordering=:degrevlex, k=QQ))
result=compute_normalforms(
Groebner.katsuran(9, internal_ordering=:degrevlex, k=QQ)
)
)
)

Expand Down
Loading

0 comments on commit 99e3451

Please sign in to comment.