The GPGCD Algorithm with the Bézout Matrix
for Multiple Univariate Polynomials
Abstract
We propose a modification of the GPGCD algorithm, which has been presented in our previous research, for calculating approximate greatest common divisor (GCD) of more than 2 univariate polynomials with real coefficients and a given degree. In transferring the approximate GCD problem to a constrained minimization problem, different from the original GPGCD algorithm for multiple polynomials which uses the Sylvester subresultant matrix, the proposed algorithm uses the Bézout matrix. Experiments show that the proposed algorithm is more efficient than the original GPGCD algorithm for multiple polynomials with maintaining almost the same accuracy for most of the cases.
1 Introduction
With the progress of algebraic computation with polynomials and matrices, we are paying more attention to approximate algebraic algorithms. Algorithms for calculating approximate GCD, which are approximate algebraic algorithms, consider a pair of given polynomials and that are relatively prime in general, and find and which are close to and , respectively, in the sense of polynomial norm, and have the greatest common divisor of a certain degree. These algorithms can be classified into two categories: 1) for a given tolerance (magnitude) of and , maximize the degree of approximate GCD, and 2) for a given degree , minimize the magnitude of and .
In both categories, algorithms based on various methods have been proposed including the Euclidean algorithm ([1], [19], [20]), low-rank approximation of the Sylvester matrix or subresultant matrices ([5], [6], [10], [11], [12], [21], [24], [26], [27], [29]), Padé approximation ([17]), and optimizations ([3], [13], [15], [22], [28]). Among them, the second author of the present paper has proposed the GPGCD algorithm based on low-rank approximation of subresultant matrices by optimization ([24], [25], [26]), which belongs to the second category above. Based on the researches mentioned above, the authors of the present paper have proposed the GPGCD algorithm using the Bézout matrix ([2]), which is the previous research of this paper.
In this paper, we propose the GPGCD algorithm with the Bézout matrix for multiple polynomials, while subresultant matrices have been used in the original GPGCD algorithm for multiple polynomials ([25]). We show that the proposed algorithm is more efficient than the original one with maintaining almost the same accuracy for most of the cases.
The paper is organized as follows. In Section 2, we give a definition of the approximate GCD problem. In Section 3, we give a formulation of the transformation of the approximate GCD problem to the optimization problem using the Bézout matrix. In Section 4, we review the modified Newton method used for optimization. In Section 5, we illustrate the proposed algorithm and give a running time analysis. In Section 6, the results of experiments are shown.
2 Approximate GCD Problem
Let be univariate polynomials with real coefficients of degree at most :
(1) |
In this paper, for a polynomial , the norm denotes the 2-norm defined as . For a vector , the norm denotes the 2-norm defined as .
Here, we give a definition of an approximate GCD.
Definition 1 (Approximate GCD)
For polynomials which are relatively prime in general, a positive integer satisfying that , and a positive real number , if there exist polynomials such that they have a certain GCD as
(2) |
where is a polynomial of degree , satisfying that , we call an approximate GCD of polynomials with tolerance .
Algorithms for calculating approximate GCD can be classified into two categories: 1) for a given tolerance , make the degree of approximate GCD as large as possible, and 2) for a given degree , minimize the magnitude . In this paper, we focus on the second category of the approximate GCD algorithms, solving the following problem.
3 Transformation of the approximate GCD problem
For solving the approximate GCD problem, we transfer the approximate GCD problem to a constrained minimization problem with the Bézout matrix.
Definition 3 (Bézout Matrix [8])
Let and be two real polynomials with the degree at most . Then, the matrix , where
is called the Bézout matrix associated to and . For polynomials , the matrix
is called the Bézout matrix associated to .
For the Bézout matrix, we have a following theorem.
Theorem 4 (Barnett’s theorem [8])
Let be real polynomials with the degree at most . Let and . Then, the vectors are linearly independent, and there exists coefficients such that
(4) |
Furthermore, the monic form of the GCD of is represented as
(5) |
For polynomials in Problem 2, let . In the case that polynomials have an exact GCD of degree , Theorem 4 shows that are linearly independent, and can be represented as a linear combination of . So there exists a vector , such that .
Let be the vector of the coefficients of the input polynomials: . Let the Bézout matrix of the input polynomials represented by be . In the same way, let the Bézout matrix of the polynomials we find () be , where .
From the above, we can transfer Problem 2 to a constrained minimization problem with the objective function:
(6) |
and the constraints:
(7) |
with variables:
(8) |
4 The Modified Newton Method
We consider a constrained minimization problem of minimizing an objective function which is twice continuously differentiable, subject to the constraints , where is a function of and is also twice continuously differentiable. For solving the constrained minimization problem, we use the modified Newton method by Tanabe ([23]), which is a generalization of the Gradient Projection method ([18]), as in the original GPGCD algorithm ([26]). For which satisfies , we calculate the search direction and the Lagrange multipliers by solving the following linear system
(9) |
where is the Jacobian matrix represented as
(10) |
5 The Algorithm for Calculating Approximate GCD
We give an algorithm for calculating approximate GCD of multiple polynomials using the Bézout matrix in this section.
5.1 Representation of the Jacobian matrix
In the modified Newton method, the Jacobian matrix is represented as follows. From the constraints (7) and the objective function (6), let , then the Jacobian matrix is represented as:
(11) |
where
5.2 Setting the Initial Values
We give the initial values for variables in (8) as follows. For the given polynomials (1), we set the initial value for variables as:
(12) |
For the Bézout matrix , we calculate by solving the following least squares problem:
(13) |
Then we set the initial value for variables as:
(14) |
From above, we give the initial value for variables in (8) as
(15) |
5.3 Calculating the Approximate GCD and Finding the Approximate polynomials
Let be the minimizer of the objective function in (6) calculated by the modified Newton method, corresponding to the coefficients of . Then, we calculate the approximate GCD from the Bézout matrix with Theorem 4.
Finally, we find the approximate polynomials , in (LABEL:eq:Apppoly) by solving least squares problems:
(16) |
5.4 The algorithm and running time analysis
Summarizing above, we give the algorithm for calculating approximate GCD for multiple polynomials as Algorithm 1. We give an analysis of the arithmetic running time of Algorithm 1 as follows.
In Step 1, we set the initial values by the construction of the Bézout matrix, calculation of the initial values using the least squares solution, and the construction of the Jacobian matrix. Since the dimension of the Bézout matrix and the Jacobian matrix is and , respectively, we can estimate the running time of the construction of the Bézout matrix, calculation of the initial values using the least squares solution, and the construction of the Jacobian matrix as ([4]), ([16]), , respectively, where the Jacobian matrix is computed by (11).
In Step 3, since the dimension of the Jacobian matrix is , the running time for solving the linear system is ([7]).
In Step 4, the running time of the construction of the Bézout matrix and the Jacobian matrix is and , respectively.
In Step 5, the running time for calculating the approximate GCD and calculation of the approximate polynomials is and .
As a consequence, the running time of Algorithm 1 is the number of iteration times .
Inputs:
-
-
: the given polynomials with ,
-
-
: the given degree of approximate GCD with ,
-
-
: the stop criterion with the modified Newton method,
-
-
: the step width with the modified Newton method.
Outputs:
-
-
: the approximate GCD, with ,
-
-
, …: the polynomials which are close to , respectively, with the GCD .
6 Experiments
We have implemented our GPGCD algorithm on a computer algebra system Maple 2021. For , the test polynomials are generated as
(17) |
Here, and are polynomials of degrees and , respectively. Note that are relatively prime polynomials. They are generated as polynomials that their coefficients are floating-point numbers and their absolute values are not greater than 10.1)1)1)Coefficients are generated with the Mersenne Twister algorithm [14] by built-in function Generate with RandomTools:-MersenneTwister in Maple, which approximates a uniform distribution on . The noise polynomials are polynomials of degree , which are randomly generated with coefficients given as the same as for and .
We have generated 5 test groups of test polynomials, each group comprising 100 tests. We set the degree of the input polynomials for all groups as 10, and the degree of the approximate GCD as , respectively (shown as in Table 1). We set the number of polynomials for each tests as , and set the norm of the noise as in our tests. The stop criterion and the stop width in Algorithm 1 are set as and , respectively.
We have carried out the tests on CPU Intel(R) Xeon(R) Silver 4210 at 2.20GHz with RAM 256GB under Linux 5.4.0 with Maple 2021.
6.1 The experimental results
We have carried out the tests with the GPGCD algorithm with the Bézout matrix for multiple polynomials (abbreviated as GPGCD-Bézout-multiple algorithm). For comparison, we have also carried out the tests with the original GPGCD algorithm with subresultant matrices for multiple polynomials (abbreviated as GPGCD-Sylvester-multiple algorithm) ([25]).
For the results, we have compared the norm of the perturbation of the GPGCD-Bézout-multiple algorithm with that of the GPGCD-Sylvester-multiple algorithm. For , let be the approximate polynomials from the outputs of the GPGCD-Bézout-multiple algorithm, and be the approximate polynomials from the outputs of the GPGCD-Sylvester-multiple algorithm. Then, let be the norm of the perturbation of the GPGCD-Bézout-multiple algorithm:
and let be the norm of the perturbation of the GPGCD-Sylvester-multiple algorithm:
If we have then we say that the minimizers of both algorithms are closed to each other.
The number of tests which the minimizers are closed to each other is shown in the left part of Table LABEL:table:number. In ‘All’, we show the number for all tests which the minimizers are closed to each other. In ‘Bézout’, we show the number for tests which the GPGCD-Bézout-multiple algorithm has a smaller perturbation than that of GPGCD-Sylvester-multiple algorithm. In ‘Sylvester’, we show the number for tests which GPGCD-Sylvester-multiple algorithm has a smaller perturbation than that of the GPGCD-Bézout-multiple algorithm. In the same way, the number of tests which the minimizers are not closed to each other is shown in the right part of Table LABEL:table:number.
For the tests in which the minimizers are closed to each other, the average time and the average number of iterations are shown in Table LABEL:table:time. In the left part, we show the average time for two algorithms. In the middle part, we show the average number of iterations. In the right part, we show the average time per iteration.
For the tests in which the minimizers are closed to each other, we have also calculated the norm of the remainders of the GPGCD-Bézout-multiple algorithm , and the norm of the remainders of the GPGCD-Sylvester-multiple algorithm , where
We show the average norm of the remainders in Table 4.
6.2 Comparison with the GPGCD-Sylvester-multiple algorithm
From Table LABEL:table:number, we see that the number of tests in which the minimizers are closed to each other of each group is larger when the degree of the approximate GCD is higher, where the least of them is over half of the total number of tests. For all results, we see that the number of tests in which the perturbation of the GPGCD-Sylvester-multiple algorithm is smaller than that of the GPGCD-Bézout-multiple algorithm is larger than that of the opposite. That means the GPGCD-Sylvester-multiple algorithm shows higher stability than the GPGCD-Bézout-multiple algorithm.
From Table LABEL:table:time, we see that total computing time, number of iterations, average computing time per iteration of the GPGCD-Bézout-multiple algorithm are smaller than those of the GPGCD-Sylvester-multiple algorithm, respectively. By comparing average computing time per iteration in each group, we see that, except for Group 1 in the GPGCD-Bézout-multiple algorithm, when the degree of approximate GCD is higher, the average time per iteration of both algorithms is smaller.
In the previous research, the GPGCD algorithm with the Bézout matrix with 2 polynomials (abbreviated as GPGCD-Bézout algorithm) ([2]), we have shown that the average of the norm of the remainders of the tests in the GPGCD-Bézout algorithm is larger than that of the original GPGCD algorithm (abbreviated as GPGCD-Sylvester algorithm). From Table 4, we see that there are little difference between the GPGCD-Bézout-multiple algorithm and the GPGCD-Sylvester-multiple algorithm in the sense of the average of the norm of the remainders.
Group | ||
1 | 10 | 3 |
2 | 10 | 4 |
3 | 10 | 5 |
4 | 10 | 6 |
5 | 10 | 7 |
The number of tests | ||||||
Group | Closed to each other | Not closed to each other | ||||
All | Bézout | Sylvester | All | Bézout | Sylvester | |
1 | 55 | 28 | 27 | 45 | 4 | 41 |
2 | 57 | 21 | 36 | 43 | 9 | 34 |
3 | 72 | 29 | 43 | 28 | 2 | 26 |
4 | 72 | 24 | 48 | 28 | 0 | 28 |
5 | 81 | 19 | 62 | 19 | 2 | 17 |
Average time (sec.) | Average number of iterations | Average time per iteration (sec.) | ||||
Group | Bézout | Sylvester | Bézout | Sylvester | Bézout | Sylvester |
1 | 9.804 | 166.266 | 14.47 | 23.47 | 0.677 | 7.083 |
2 | 11.035 | 141.235 | 16.14 | 21.28 | 0.684 | 6.637 |
3 | 9.587 | 112.952 | 14.375 | 18.14 | 0.667 | 6.227 |
4 | 7.296 | 99.230 | 11.33 | 17 | 0.644 | 5.837 |
5 | 6.272 | 89.058 | 9.83 | 16.09 | 0.638 | 5.536 |
Group | Bézout | Sylvester |
---|---|---|
1 | ||
2 | ||
3 | ||
4 | ||
5 |
7 Conclusions
We have proposed an algorithm using the Bézout matrix based on the GPGCD algorithm for multiple polynomials.
The experimental results show that, in most of the cases, the minimizer of the proposed algorithm is closed to the minimizer of the GPGCD-Sylvester-multiple algorithm. For the cases in which the minimizers of both algorithms are closed to each other, total computing time, the number of iterations, average computing time per iteration of the GPGCD-Bézout-multiple algorithm are smaller than those of the GPGCD-Sylvester-multiple algorithm, respectively. Thus, we see that the proposed algorithm is more efficient than the GPGCD-Sylvester-multiple algorithm. By comparing the computing time per iteration, the experimental results show that when the degree of the approximate GCD is higher, the computing time per iteration of the proposed algorithm is smaller. This is consistent with the arithmetic running time analysis shown in Section 5.4.
The previous research has shown that the GPGCD-Bézout algorithm was not so accurate in the sense of the norm of perturbations compared with the GPGCD-Sylvester algorithm. However, new experimental results show that, with the improvement for calculating the approximate polynomials as shown in (16), the GPGCD-Bézout-multiple algorithm calculate approximate GCDs with almost the same accuracy as the GPGCD-Sylvester-multiple algorithm in the sense of the norm of perturbations, for the tests in which the minimizers of both algorithms are closed to each other.
On the other hand, the experimental results show that the number of tests in which the perturbation of the GPGCD-Sylvester-multiple algorithm is smaller than that of the proposed algorithm is larger than that of the opposite. Thus, the GPGCD-Sylvester-multiple algorithm shows higher stability than the proposed algorithm. Improving stability of the proposed algorithm will be one of the topics of further research.
Acknowledgments
This research was partially supported by JSPS KAKENHI Grant Number JP20K11845. The author (Chi) was supported by the research assistant fellowship from Graduate School of Pure and Applied Sciences, University of Tsukuba.
References
- [1] B. Beckermann and G. Labahn. A fast and numerically stable Euclidean-like algorithm for detecting relatively prime numerical polynomials. J. Symbolic Comput., 26(6):691–714, 1998.
- [2] Boming Chi and Akira Terui. The GPGCD algorithm with the Bézout matrix. In Computer Algebra in Scientific Computing, pages 170–187. Springer International Publishing, Cham, 2020.
- [3] P. Chin, R. M. Corless, and G. F. Corliss. Optimization strategies for the approximate GCD problem. In Proceedings of the 1998 International Symposium on Symbolic and Algebraic Computation, pages 228–235. ACM, New York, NY, USA, 1998.
- [4] Eng Wee Chionh, Ming Zhang, and Ronald N. Goldman. Fast computation of the Bezout and Dixon resultant matrices. Journal of Symbolic Computation, 33(1):13–29, 2002.
- [5] R. M. Corless, P. M. Gianni, B. M. Trager, and S. M. Watt. The singular value decomposition for polynomial systems. In Proceedings of the 1995 International Symposium on Symbolic and Algebraic Computation, pages 195–207. ACM, New York, NY, USA, 1995.
- [6] R. M. Corless, S. M. Watt, and L. Zhi. factoring to compute the GCD of univariate approximate polynomials. IEEE Trans. Signal Process., 52(12):3394–3402, 2004.
- [7] J. W. Demmel. Applied Numerical Linear Algebra. SIAM, Philadelphia, USA, 1997.
- [8] Gema M. Diaz-Toca and Laureano Gonzalez-Vega. Barnett’s Theorems About the Greatest Common Divisor of Several Univariate Polynomials Through Bezout-like Matrices. Journal of Symbolic Computation, 34(1):59–81, 2002.
- [9] Gema M. Diaz-Toca and Laureano Gonzalez-Vega. Computing greatest common divisors and squarefree decompositions through matrix methods: The parametric and approximate cases. Linear Algebra Appl., 412(2–3):222–246, 2006.
- [10] I. Z. Emiris, A. Galligo, and H. Lombardi. Certified approximate univariate GCDs. J. Pure Appl. Algebra, 117/118:229–251, 1997.
- [11] E. Kaltofen, Z. Yang, and L. Zhi. Approximate greatest common divisors of several polynomials with linearly constrained coefficients and singular polynomials. In Proceedings of the 2006 International Symposium on Symbolic and Algebraic Computation, pages 169–176. ACM, New York, NY, USA, 2006.
- [12] E. Kaltofen, Z. Yang, and L. Zhi. Structured low rank approximation of a Sylvester matrix. In Symbolic-Numeric Computation, Trends in Mathematics, pages 69–83. Birkhäuser, Basel, Switzerland, 2007.
- [13] N. K. Karmarkar and Y. N. Lakshman. On approximate GCDs of univariate polynomials. J. Symbolic Comput., 26(6):653–666, 1998.
- [14] Makoto Matsumoto and Takuji Nishimura. Mersenne Twister: A 623-dimensionally equidistributed uniform pseudo-random number generator. ACM Transactions on Modeling and Computer Simulation, 8(1):3–30, 1998.
- [15] Kosaku Nagasaka. Relaxed NewtonSLRA for approximate GCD. In Computer Algebra in Scientific Computing, pages 272–292. Springer International Publishing, Cham, 2021.
- [16] Jorge Nocedal and Stephen J. Wright. Numerical Optimization. Springer, New York, NY, USA, second edition, 2006.
- [17] V. Y. Pan. Computation of approximate polynomial GCDs and an extension. Inform. and Comput., 167(2):71–85, 2001.
- [18] J. B. Rosen. The gradient projection method for nonlinear programming. II. Nonlinear constraints. J. Soc. Indust. Appl. Math., 9:514–532, 1961.
- [19] T. Sasaki and M-T. Noda. Approximate square-free decomposition and root-finding of ill-conditioned algebraic equations. J. Inform. Process., 12(2):159–168, 1989.
- [20] A. Schönhage. Quasi-GCD computations. J. Complexity, 1(1):118–137, 1985.
- [21] Éric Schost and Pierre-Jean Spaenlehauer. A quadratically convergent algorithm for structured low-rank approximation. Found. Comput. Math., 16(2):457–492, 2016.
- [22] Dongxia Sun and Lihong Zhi. Structured low rank approximation of a bezout matrix. Mathematics in Computer Science, 1(2):427–437, Dec 2007.
- [23] K. Tanabe. A geometric method in nonlinear programming. Journal of Optimization Theory and Applications, 30(2):181–210, Feb 1980.
- [24] Akira Terui. An iterative method for calculating approximate GCD of univariate polynomials. In Proceedings of the 2009 International Symposium on Symbolic and Algebraic Computation - ISSAC ’09, pages 351–358. ACM Press, New York, New York, USA, 2009.
- [25] Akira Terui. GPGCD, an iterative method for calculating approximate GCD, for multiple univariate polynomials. In Computer Algebra in Scientific Computing, pages 238–249. Springer Berlin Heidelberg, Berlin, Heidelberg, 2010.
- [26] Akira Terui. GPGCD: An iterative method for calculating approximate GCD of univariate polynomials. Theoretical Computer Science, 479:127–149, 2013.
- [27] C. J. Zarowski, X. Ma, and F. W. Fairman. QR-factorization method for computing the greatest common divisor of polynomials with inexact coefficients. IEEE Trans. Signal Process., 48(11):3042–3051, 2000.
- [28] Zhonggang Zeng. The numerical greatest common divisor of univariate polynomials. In Randomization, Relaxation, and Complexity in Polynomial Equation Solving, volume 556 of Contemporary Mathematics, pages 187–217. AMS, Providence, RI, USA, 2011.
- [29] L. Zhi. Displacement structure in computing approximate GCD of univariate polynomials. In Computer mathematics: Proc. Six Asian Symposium on Computer Mathematics (ASCM 2003), volume 10 of Lecture Notes Ser. Comput., pages 288–298. World Sci. Publ., River Edge, NJ, 2003.