On Implementing Signature-Based Gröbner Basis Algorithms Using Linear Algebraic Routines from M4RI

Yao Sun,Dongdai Lin,Dingkang Wang
DOI: https://doi.org/10.1145/2815111.2815161
2015-01-01
ACM Communications in Computer Algebra
Abstract:Grobner bases, proposed by Buchberger in 1965 [5], have been proven to be very useful in many aspects of algebra. Faugere introduced the concept of signatures for polynomials and presented the famous F5 algorithm [9]. Since then, signature-based algorithms have been widely investigated, and several variants of F5 have been presented, including F5C [7], extended F5 [13], F5 with revised criterion [4], and RB [8]. Gao et al. proposed another signature based algorithm G2V [11] in a different way from F5, and GVW[12] is an extended version of G2V. The authors also studied generalized criteria and signature-based algorithms in solvable polynomial algebra in [15, 16]. For implementations of signature-based algorithms, Roune and Stillman efficiently implemented GVW and AP without using linear algebra [14]. Faugere mentioned a matrix F5 in [10]. An F5 algorithm in F4 style was described in more detail by Albrecht and Perry [1]. In signature-based algorithms, each polynomial is assigned a signature, and polynomials can only be reduced by polynomials with smaller signatures. When implementing signaturebased algorithms using linear algebra, such as [1], rows of the constructed matrices are also assigned with signatures. These matrices can only be eliminated from one side due to the constraints of signatures, i.e. rows can only be reduced by rows with smaller signatures. However, most public libraries on linear algebra do not provide routines for such one-side elimination, such that most public libraries cannot be applied to the implementations of signature-based algorithms directly. In this talk, we present a method of rotating rows during the elimination, to ensure rows with larger signatures can always be reduced by rows with smaller signatures. Our method only needs to revise the swapping procedure during the elimination, and can be easily applied to most public libraries on linear algebra. We have applied our method to the M4RI package [3], and implemented the GVW algorithm by using the modified routines over the finite field GF (2). Due to the efficient routines modified from M4RI, our implemented GVW algorithm is more efficient than some of Grobner basis implementations on public softwares. Our method of rotating rows can be illustrated by the following example. Let A be a matrix with entries in F2. Assume A has the following form: S1 S2 S3 S4 S5 S6  0 1 ∗ ∗ ∗ ∗ 0 0 0 1 ∗ ∗ 0 0 1 ∗ ∗ ∗ 0 1 ∗ ∗ ∗ ∗ 1 ∗ ∗ ∗ ∗ ∗ 1 ∗ ∗ ∗ ∗ ∗  , where “∗” may be 1 or 0, Si is the signature of each row, and we assume S1 ≺s S2 ≺s · · · ≺s S6. To reduce A to row-echelon form, we first find the pivot entry in the first column. We must search the pivot entry from top to bottom (i.e. from lower signatures to higher signatures). Then we find the entry at row 5 and col 1 is a pivot. If we use general methods of elimination, we need to swap row 1 and row 5 directly, and clear entries at column 1 by the row with signature S5. Next, when doing elimination in the second column, the row with signature S4 is selected as pivot row, and needs to eliminate other rows. However, this will leads to errors in signature-based algorithms, because the row with signature S1 has a smaller signature than S4 and cannot be eliminated by the row with signature S4. So we cannot swap row 1 and row 5 directly. To make further eliminations correct, we swap row 1 and row 5 in a special manner. First, we pick up the row 5 with signature S5. Second, we move rows 4, 3, 2, and 1 to rows 5, 4, 3, and 2 respectively. At last, we put the row with signature S5 at row 1. After this swap, matrix A becomes the following form. S5 S1 S2 S3 S4 S6  1 ∗ ∗ ∗ ∗ ∗ 0 1 ∗ ∗ ∗ ∗ 0 0 0 1 ∗ ∗ 0 0 1 ∗ ∗ ∗ 0 1 ∗ ∗ ∗ ∗ 1 ∗ ∗ ∗ ∗ ∗  . Next, we use the row with S5 to clear all entries at column 1 below this row, and then column 1 is done. For column 2, we find pivots from rows with S1, ..., S4 and S6, and repeat the above processes. Elimination terminates when the matrix becomes an upper triangular form. This swap makes eliminations correct in signature-based algorithm for the following reasons. On one hand, since pivot rows (e.g. row of S5) are finding from low signatures to high signatures, rows with smaller signature (e.g. rows of S1, . . . , S4) cannot be reduced by pivot rows (e.g. row of S5). On the other hand, after swaps, rows below pivot rows (e.g. rows of S1, . . . , S4 and S6) are still in an increasing order on signatures. Using this special swap, the echelon form of A is in an upper triangular form, such that divide-and-conquer methods of PLE decomposition [2] can be used, and hence, the eliminations can be speeded up significantly. In our implementation, we modify many subroutines of mzd ple() in M4RI library to use this swap. The new function with the special swap is called gvw ple(). We compare the efficiency of mzd ple() and gvw ple() in Table 1. Examples with density ≈ 50% are generated randomly by routines from M4RI. Since the densities of matrices in Grobner basis computations are usually very small, we also generate some randomized matrices with density ≈ 3%. The first column in Table 1 is the size of matrices, and the timings in this table are given by seconds. All matrices are generated over GF (2). Tests density ≈ 50% density ≈ 3% mzd ple() gvw ple() mzd ple() gvw ple() 10, 000× 10, 000 0.378 0.382 0.345 0.354 10, 000× 30, 000 1.342 1.301 1.268 1.262 30, 000× 10, 000 1.432 1.443 1.403 1.418 30, 000× 30, 000 7.661 7.655 7.604 7.577 30, 000× 60, 000 18.684 18.671 18.651 18.634 60, 000× 30, 000 19.396 19.296 19.282 19.298 60, 000× 60, 000 58.373 58.636 54.509 54.263 60, 000× 100, 000 123.321 123.298 119.479 122.523 100, 000× 60, 000 119.991 118.388 108.565 108.501 100, 000× 100, 000 266.817 267.191 237.401 237.560 150, 000× 150, 000 817.682 817.750 700.032 700.781 Table 1: mzd ple() vs gvw ple() From the above table, we can see the function mzd ple() and gvw ple() almost have the same efficiency. In Table 2, we compare our implementation of GVW with some intrinsic implementations on public softwares, including Grobner basis functions on Maple (version 17, setting “method = fgb”), Singular (version 3-1-6), and Magma (version 2.12-16), and the computing times in seconds are listed. In the column of Exam., n×n means that the input polynomial system has n polynomials with n variables. These square polynomial systems were generated by Courtois in [6]. The Computer we used is MacBook Pro with 2.6 GHz Intel Core i7, 16 GB memory. 1Magma 2.12-16 is an old version. Exam. Maple Singular Magma GVW 16× 16 4.088 5.210 0.484 0.560 17× 17 9.891 12.886 0.874 0.893 18× 18 22.340 31.590 1.513 1.556 19× 19 48.314 84.771 2.792 2.742 20× 20 107.064 265.325 5.226 4.676 21× 21 218.479 724.886 10.468 14.991 22× 22 839.067 > 1h 37.144 28.947 Table 2: Maple, Singular and Magma vs M-GVW From the above table, we can see that, due to the efficiency of routines from M4RI, our implementation of M-GVW is more efficient than some of functions from existing public softwares. However, since the matrices in large polynomial systems become quite sparse, our implementation may not perform very good for large systems at present.
What problem does this paper attempt to address?