Examples

Framework

<<"/home/ritsches/Wolfram Research/Hemmecke.m"

algHemmecke=1;
algToricGB=2;
algSingular=4;

RunExample[A_List,order_List,mask_Integer:1,singularAlgorithm_:""]:=Module[{in,out,list,variables,idealHemm,idealMath,idealSing,path,timeHemm,timeMath,timeSing,times={},n=Length[A[[1]]]},Clear[x,t];
variables=Array[x,n];
If[BitAnd[mask,algHemmecke]≠0,
{timeHemm,idealHemm}=AbsoluteTiming[HemmeckeToricGroebnerBasis[A,variables,order]];idealHemm=dbgGroebnerBasisUnique[idealHemm,variables];
times=Append[times,timeHemm];
];
If[BitAnd[mask,algToricGB]≠0,
{timeMath,idealMath}=AbsoluteTiming[GroebnerBasis`ToricGroebnerBasis[Append[VectorToBinomial[LatticeReduce[LatticeByNullSpace[A]],variables],t Times@@variables-1],variables,t,MonomialOrder->Prepend[(Prepend[#1,0]&)/@order,UnitVector[n+1,1]]]];
idealMath=dbgGroebnerBasisUnique[idealMath,variables];
If[BitAnd[mask,algHemmecke]≠0&&!idealHemm===idealMath,
Print["A=",A];
Print["idealHemm=",idealHemm];
Print["idealMath=",idealMath];
Abort[]
];
times=Append[times,timeMath];
];
If[BitAnd[mask,algSingular]≠0&&singularAlgorithm=!="",
path=NotebookInformation[][[1]][[2]][[1]];
in=OpenWrite[FileNameJoin[Append[path,"example.in"]]];
WriteString[in,"string alg = \""<>singularAlgorithm<>"\";\n"];
WriteString[in,"int k = ",Length[A],";\n"];
WriteString[in,"int n = ",Length[A[[1]]],";\n"];WriteString[in,"intmat A[k][n] = "<>StringReplace[ToString[Flatten[A]],{"{"->"","}"->""}]<>";\n"];
Close[in];
timeSing=AbsoluteTiming[If[Run["cd \""<>FileNameJoin[path]<>"\" && Singular example.lib"]≠0,Abort]][[1]];
out=OpenRead[FileNameJoin[Append[path,"example.out"]]];list=Read[out,String];
list="{"<>StringReplace[list,{"("->"[",")"->"]"}]<>"}";
idealSing=dbgGroebnerBasisUnique[ToExpression[list],variables];
Close[out];
If[BitAnd[mask,algHemmecke]≠0&&!idealHemm===idealSing,
Print["A=",A];
Print["idealHemm=",idealHemm];
Print["idealSing=",idealSing];
Abort[]
];
times=Append[times,timeSing];
];
If[Max[times]>5,Print["A=",A,times]];
times
];

RunRandomLex[k_Integer,n_Integer,count_Integer,mask_Integer:1,singularAlgorithm_:""]:=Module[{timing=Null,t,A,i,order},
order=Array[UnitVector[n,#1]&,n];
For[i=1,i≤count,i++,
A=RandomInteger[{-10,10},{k,n}];
t=RunExample[A,order,mask,singularAlgorithm];
If[timing===Null,timing=t,timing+=t];
];
Round[(timing/count),0.001]
];

RunFrobenius[n_Integer,max_Integer,count_Integer,mask_Integer:1,singularAlgorithm_:""]:=Module[{timing=Null,t,p,i,order},
For[i=1,i≤count,i++,
p=Sort[RandomPrime[max,n]];
order=Prepend[Table[-UnitVector[n,i],{i,1,n-1}],p];
t=RunExample[{p},order,mask,singularAlgorithm];
If[timing===Null,timing=t,timing+=t];
];
Round[(timing/count),0.001]
];

RunAllExamples[count_Integer,mask_Integer:3,singularAlgorithm_:""]:=Module[{timing},
timing=Array[If[#1<#2,RunRandomLex[#1,#2,count,mask,singularAlgorithm],Null]&,{5,5},{1,2}];
Print[MatrixForm[timing]];
];

Runs

Frobenius

SeedRandom[38934];
profile[RunFrobenius[6,10^10,5,1]]

ML, bitmasks, ToricGB, cascade intermediateReduce, alwaysCriterionMinimalSet

ML, bitmasks, geometricBuchberger, no intermediateReduce, heuristic criterionMinimalSet

ML, bitmasks, geometricBuchberger, cascade intermediateReduce, heuristic criterionMinimalSet

ML, bitmasks, geometricBuchberger, no intermediateReduce, alwaysCriterionMinimalSet

ML, bitmasks, geometricBuchberger, simple intermediateReduce, alwaysCriterionMinimalSet

ML, no bitmasks, geometricBuchberger, cascade intermediateReduce, alwaysCriterionMinimalSet

ML, bitmasks, geometricBuchberger, cascade intermediateReduce, alwaysCriterionMinimalSet

KDL, bitmasks, geometricBuchberger, cascade intermediateReduce, alwaysCriterionMinimalSet

KDT, bitmasks, geometricBuchberger, cascade intermediateReduce, alwaysCriterionMinimalSet

KDT, bitmasks, geometricBuchberger, profiling, LatticeReduce, intermediateReduce, FindInstance

KDL semibin, bitmasks, geometricBuchberger, profiling, LatticeReduce, intermediateReduce, FindInstance

VEC, bitmasks, geometricBuchberger, profiling, LatticeReduce, intermediateReduce, FindInstance

VEC, bitmasks, geometricBuchberger, profiling, LatticeReduce, part intermediateReduce, FindInstance

VEC, bitmasks, geometricBuchberger, profiling, LatticeReduce, intermediateReduce

VEC, bitmasks, geometricBuchberger, profiling

KDL semibin, bitmasks, geometricBuchberger, profiling

ToricGB, LatticeReduce

ToricGB

SeedRandom[874592];
profile[RunFrobenius[7,10^5,5,1]]

ML, bitmasks, ToricGB, cascade intermediateReduce, alwaysCriterionMinimalSet

ML, bitmasks, geometricBuchberger, no intermediateReduce, heuristic criterionMinimalSet

ML, bitmasks, geometricBuchberger, cascade intermediateReduce, heuristic criterionMinimalSet

ML, bitmasks, geometricBuchberger, no intermediateReduce, alwaysCriterionMinimalSet

ML, bitmasks, geometricBuchberger, simple intermediateReduce, alwaysCriterionMinimalSet

ML, no bitmasks, geometricBuchberger, cascade intermediateReduce, alwaysCriterionMinimalSet

ML, bitmasks, geometricBuchberger, cascade intermediateReduce, alwaysCriterionMinimalSet

KDL, bitmasks, geometricBuchberger, cascade intermediateReduce, alwaysCriterionMinimalSet

KDT, bitmasks, geometricBuchberger, cascade intermediateReduce, alwaysCriterionMinimalSet

KDT, bitmasks, geometricBuchberger, profiling, LatticeReduce, intermediateReduce, FindInstance

KDL semibin, bitmasks, geometricBuchberger, profiling, LatticeReduce, intermediateReduce, FindInstance

VEC, bitmasks, geometricBuchberger, profiling, LatticeReduce, intermediateReduce, FindInstance

VEC, bitmasks, geometricBuchberger, profiling, LatticeReduce, part intermediateReduce, FindInstance

VEC, bitmasks, geometricBuchberger, profiling, LatticeReduce, intermediateReduce

VEC, bitmasks, geometricBuchberger, profiling

KDL semibin, bitmasks, geometricBuchberger, profiling

ToricGB, LatticeReduce

ToricGB

SeedRandom[23894289];
profile[RunFrobenius[7,10^10,5,1]]

ML, bitmasks, ToricGB, cascade intermediateReduce, alwaysCriterionMinimalSet

ML, bitmasks, geometricBuchberger, no intermediateReduce, heuristic criterionMinimalSet

ML, bitmasks, geometricBuchberger, cascade intermediateReduce, heuristic criterionMinimalSet

ML, bitmasks, geometricBuchberger, no intermediateReduce, alwaysCriterionMinimalSet

ML, bitmasks, geometricBuchberger, simple intermediateReduce, alwaysCriterionMinimalSet

ML, no bitmasks, geometricBuchberger, cascade intermediateReduce, alwaysCriterionMinimalSet

ML, bitmasks, geometricBuchberger, cascade intermediateReduce, alwaysCriterionMinimalSet

KDL, bitmasks, geometricBuchberger, cascade intermediateReduce, alwaysCriterionMinimalSet

KDT, bitmasks, geometricBuchberger, cascade intermediateReduce, alwaysCriterionMinimalSet

KDT, bitmasks, geometricBuchberger, profiling, LatticeReduce, intermediateReduce, FindInstance

KDL semibin, bitmasks, geometricBuchberger, profiling, LatticeReduce, intermediateReduce, FindInstance

VEC, bitmasks, geometricBuchberger, profiling, LatticeReduce, intermediateReduce, FindInstance

VEC, bitmasks, geometricBuchberger, profiling, LatticeReduce, part intermediateReduce, FindInstance

VEC, bitmasks, geometricBuchberger, profiling, LatticeReduce, intermediateReduce

ToricGB, LatticeReduce

ToricGB

SeedRandom[4636332];
profile[RunFrobenius[8,10^5,5,1]]

ML, bitmasks, ToricGB, cascade intermediateReduce, alwaysCriterionMinimalSet

ML, bitmasks, geometricBuchberger, no intermediateReduce, heuristic criterionMinimalSet

ML, bitmasks, geometricBuchberger, cascade intermediateReduce, heuristic criterionMinimalSet

ML, bitmasks, geometricBuchberger, no intermediateReduce, alwaysCriterionMinimalSet

ML, bitmasks, geometricBuchberger, simple intermediateReduce, alwaysCriterionMinimalSet

ML, no bitmasks, geometricBuchberger, cascade intermediateReduce, alwaysCriterionMinimalSet

ML, bitmasks, geometricBuchberger, cascade intermediateReduce, alwaysCriterionMinimalSet

KDL, bitmasks, geometricBuchberger, cascade intermediateReduce, alwaysCriterionMinimalSet

KDT, bitmasks, geometricBuchberger, cascade intermediateReduce, alwaysCriterionMinimalSet

KDT, bitmasks, geometricBuchberger, profiling, LatticeReduce, intermediateReduce, FindInstance

KDL semibin, bitmasks, geometricBuchberger, profiling, LatticeReduce, intermediateReduce, FindInstance

VEC, bitmasks, geometricBuchberger, profiling, LatticeReduce, intermediateReduce, FindInstance

VEC, bitmasks, geometricBuchberger, profiling, LatticeReduce, part intermediateReduce, FindInstance

KDL semibin, bitmasks, geometricBuchberger, profiling, LatticeReduce, intermediateReduce

VEC, bitmasks, geometricBuchberger, profiling, LatticeReduce, intermediateReduce

VEC, bitmasks, geometricBuchberger, profiling

KDL semibin, bitmasks, geometricBuchberger, profiling

ToricGB, LatticeReduce

ToricGB

SeedRandom[353474];
profile[RunFrobenius[9,10^4,5,1]]

ML, bitmasks, geometricBuchberger, no intermediateReduce, heuristic criterionMinimalSet

ML, bitmasks, geometricBuchberger, cascade intermediateReduce, heuristic criterionMinimalSet

ML, bitmasks, geometricBuchberger, no intermediateReduce, alwaysCriterionMinimalSet

ML, bitmasks, geometricBuchberger, simple intermediateReduce, alwaysCriterionMinimalSet

ML, no bitmasks, geometricBuchberger, cascade intermediateReduce, alwaysCriterionMinimalSet

ML, bitmasks, geometricBuchberger, cascade intermediateReduce, alwaysCriterionMinimalSet

KDL, bitmasks, geometricBuchberger, cascade intermediateReduce, alwaysCriterionMinimalSet

KDT, bitmasks, geometricBuchberger, cascade intermediateReduce, alwaysCriterionMinimalSet

KDT, bitmasks, geometricBuchberger, profiling, LatticeReduce, intermediateReduce, FindInstance

KDL semibin, bitmasks, geometricBuchberger, profiling, LatticeReduce, intermediateReduce, FindInstance

VEC, bitmasks, geometricBuchberger, profiling, LatticeReduce, intermediateReduce, FindInstance

VEC, bitmasks, geometricBuchberger, profiling, LatticeReduce, part intermediateReduce, FindInstance

KDL semibin, bitmasks, geometricBuchberger, profiling, LatticeReduce, intermediateReduce

VEC, bitmasks, geometricBuchberger, profiling, LatticeReduce, intermediateReduce

VEC, bitmasks, geometricBuchberger, profiling

KDL semibin, bitmasks, geometricBuchberger, profiling

ToricGB, LatticeReduce

ToricGB

SeedRandom[66332];
profile[RunFrobenius[10,10^4,5,1]]

ML, bitmasks, geometricBuchberger, no intermediateReduce, heuristic criterionMinimalSet

ML, bitmasks, geometricBuchberger, cascade intermediateReduce, heuristic criterionMinimalSet

ML, bitmasks, geometricBuchberger, no intermediateReduce, alwaysCriterionMinimalSet

ML, bitmasks, geometricBuchberger, simple intermediateReduce, alwaysCriterionMinimalSet

ML, no bitmasks, geometricBuchberger, cascade intermediateReduce, alwaysCriterionMinimalSet

ML, bitmasks, geometricBuchberger, cascade intermediateReduce, alwaysCriterionMinimalSet

KDL, bitmasks, geometricBuchberger, cascade intermediateReduce, alwaysCriterionMinimalSet

KDT, bitmasks, geometricBuchberger, cascade intermediateReduce, alwaysCriterionMinimalSet

KDT, bitmasks, geometricBuchberger, profiling, LatticeReduce, intermediateReduce, FindInstance

KDL semibin, bitmasks, geometricBuchberger, profiling, LatticeReduce, intermediateReduce, FindInstance

VEC, bitmasks, geometricBuchberger, profiling, LatticeReduce, intermediateReduce, FindInstance

VEC, bitmasks, geometricBuchberger, profiling, LatticeReduce, part intermediateReduce, FindInstance

KDL semibin, bitmasks, geometricBuchberger, profiling, LatticeReduce, intermediateReduce

VEC, bitmasks, geometricBuchberger, profiling, LatticeReduce, intermediateReduce

VEC, bitmasks, geometricBuchberger, profiling

KDL semibin, bitmasks, geometricBuchberger, profiling

ToricGB, LatticeReduce

ToricGB

Random

SeedRandom[2784];
profile[RunAllExamples[100]]

ML, bitmasks, geometricBuchberger, cascade intermediateReduce, heuristic criterionMinimalSet

ML, bitmasks, geometricBuchberger, no intermediateReduce, alwaysCriterionMinimalSet

ML, bitmasks, geometricBuchberger, simple intermediateReduce, alwaysCriterionMinimalSet

ML, no bitmasks, geometricBuchberger, cascade intermediateReduce, alwaysCriterionMinimalSet

ML, bitmasks, geometricBuchberger, cascade intermediateReduce, alwaysCriterionMinimalSet

KDL, bitmasks, geometricBuchberger, cascade intermediateReduce, alwaysCriterionMinimalSet

KDT, bitmasks, geometricBuchberger, cascade intermediateReduce, alwaysCriterionMinimalSet

KDT, bitmasks, geometricBuchberger, profiling, LatticeReduce, intermediateReduce, FindInstance

KDL semibin, bitmasks, geometricBuchberger, profiling, LatticeReduce, intermediateReduce, FindInstance

VEC, bitmasks, geometricBuchberger, profiling, LatticeReduce, intermediateReduce, FindInstance + ToricGB, LatticeReduce

VEC, bitmasks, geometricBuchberger, profiling, LatticeReduce, part intermediateReduce

KDL semibin, bitmasks, geometricBuchberger, profiling, LatticeReduce, intermediateReduce

VEC, bitmasks, geometricBuchberger, profiling, LatticeReduce, intermediateReduce

VEC, bitmasks, geometricBuchberger, profiling, LatticeReduce

KDL semibin, bitmasks, geometricBuchberger, profiling

VEC, bitmasks, geometricBuchberger

VEC, bitmasks, ToricGroebnerBasis

VEC, bitmasks, ToricGroebnerBasis (same as above)

contigency333={{1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0},{0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0},{0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0},{0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0},{0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0},{0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0},{0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0},{0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0},{0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0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bitmasks, geometricBuchberger, cascade intermediateReduce, alwaysCriterionMinimalSet

KDL, bitmasks, geometricBuchberger, cascade intermediateReduce, alwaysCriterionMinimalSet