On the computation of the GCD (LCM) of 2-d polynomials N. P. Karampetakis Department of Mathematics...

33
On the computation of the GCD (LCM) of 2-d polynomials N. P. Karampetakis Department of Mathematics Aristotle University of Thessaloniki Thessaloniki 54006, Greece Email : [email protected] P. Tzekis and H. K. Terzidis Technological Educational Institution of Thessaloniki School of Sciences Department of Mathematics P.O. Box 14561 Thessaloniki 54101, Greece
  • date post

    22-Dec-2015
  • Category

    Documents

  • view

    216
  • download

    0

Transcript of On the computation of the GCD (LCM) of 2-d polynomials N. P. Karampetakis Department of Mathematics...

On the computation of the GCD (LCM) of 2-d

polynomials

N. P. KarampetakisDepartment of MathematicsAristotle University of ThessalonikiThessaloniki 54006, GreeceEmail : [email protected]

P. Tzekis and H. K. TerzidisTechnological Educational Institution of ThessalonikiSchool of SciencesDepartment of MathematicsP.O. Box 14561Thessaloniki 54101, Greece

Contents

• Goals• Computation of GCD-LCM of 1-d

polynomials.• Interpolation methods.• 2-D DFT• Computation of GCD-LCM of 2-d

polynomials by using 2-D DFT techniques.• Some special cases.• Conclusions and further work.

Goals

• Computation of the Greatest Common Divisor (GCD) of 2-d polynomials.– It is linked with the computation of zeros of

system representations,– Solution of polynomial (matrix) diophantine

equations and applications to control design problems i.e. computation of stabilizing controllers.

– Network theory, Communications, Computer Aided Design, Image restoration.

• Computation of the Least Common Multiple (LCM) of 2-d polynomials.– Integral part of algebraic synthesis

methods in control theory (connected with the derivation of minimal fractional representations of rational models, which are essential for the study of a variety of algebraic design problems (Kucera)).

How to compute the GCD of 1-d polynomials;

• Euclidean algorithm.• Numerical methods based on

– Euclidean Algorithm (Fryer, Weinstock),– Generalized resultant test (Barnett, Vardulakis &

Stoyle)– Matrix based methods (Blankinship, Barnett,

Karcanias and Mitrouli) (see Pace and Barnett)). The computation of the GCD is a numerical ill-possed problem(If GCD(u(x),v(x))=v(x), where v(x) a divisor of u(x) , then GCD(u(x)+d,v(x))=1).

• Approximate GCD (Karmarkar & Lakshman, Corless, Emiris, Karcanias, Mitrouli e.t.c.).

What about the GCD of 2-d polynomials;

• Needs modification of the Euclidean algorithm, as the ring R[z,w] is not Euclidean (Sebek 1994).

• Symbolic methods (Johnson, Pugh and Hayton 1995)• Other methods

– Euclidean Algorithm (problem of coefficient growth),– Polynomial remainder sequence (Sasaki et. al.1997)– Generalized subresultant method (Ochi et.al.1991)– Hensel lifting strategy (Zhi Li and Noda 2000 & 2001)– Sylvester-like resultant method (Phillai and Liang

1999). – Blackbox type algorithm (Zeng, Dayton 2004)– Modular algorithm (Corless et.al.1995) (the problem is

reduced to univariate problem by using evaluation homomorphisms to eliminate variables, and reconstruct to GCD of the original inputs from these “images” using interpolations (dense and sparse method).

• Approximate GCD of multivariate polynomials (Zhi and Noda 2000, Zhi, Li and Noda 2001 e.t.c).

How to compute the LCM of 1-d polynomials;

Existing procedures for LCM rely on:• the standard factorisation of

polynomials, • computation of a minimal basis of a

special polynomial matrix (Beelen & Van Dooren) and use of algebraic identities,

• GCD algorithms and numerical factorisation of polynomials (Karcanias and Mitrouli),

• Standard system theoretic concepts (Karcanias and Mitrouli)

Why we use interpolation methods ;

• Kurth (1967), Computation of the determinant of a polynomial matrix.

• Paccagnella & Pierobon (1976), use specific points for the interpolation (FFT technique).

• Schuster & Hippe (1992), Computation of the ordinary inverse of a polynomial matrix (Newton’s interpolation method).

• Karampetakis & Vologiannidis (2002), DFT calculation of the generalized and drazin inverse of a polynomial matrix (DFT technique).

• Petkovic & Stanimirovic (2006, 2007), Computation of the Drazin and generalized inverse of a polynomial matrix (Newton’s interpolation method).

• Direct approach using Vandermonde’s matrix,• Newton’s interpolation method,• Lagrange’s interpolation,• DFT techniques (multipoint evaluation-interpolation

method).

FFT algorithms make the difference in speed

Very fast algorithms for computing the DFT (use properties of specific interpolation points)

Advantages• The speed of interpolation algorithms

can be increased.• Greatly benefited by the existence of a

parallel environment (through symmetric multiprocessing or other techniques).

• Efficient algorithms available both in software and hardware.

What we call Discrete Fourier Transform;

Definition. Consider the finite sequence 1 2( , )X k k and 1 2( , )X r r ,

, 0,1,..,i i ik r M . In order for the sequence 1 2( , )X k k and 1 2( , )X r r to constitute a Discrete Fourier Transform (DFT) pair the following relations should hold :

1 2

1 1 2 2

1 2

1 2 1 2 1 20 0

( , ) ( , )M M

k r k r

k k

X r r X k k W W

(forward DFT) (1)

1 2

1 1 2 2

1 2

1 2 1 2 1 20 0

1( , ) ( , )

M Mk r k r

r r

X k k X r r W WR

(inverse DFT) (2)

where 2

1 , 1,2j

MiiW e i

and 1 21 1R M M .

Evaluation-Interpolation method 21 2

11 2

1 2

1 2 1 2 1 20 0

( , ) ( , ) , , 1,2, 1,2,...,jri

Mi i

M Mrk k

i i i ik k

X r r X k k s s s W e i r M

Which is the complexity of the 2-D DFT/FFT ;

Computational Complexity of 2-D DFT : 1 2 1 21 1 2M M M M

Comput. Compl. of 2-D FFT : 1 2

2 1 2

1 1log 1 1

2

M MM M

Computation of the GCD of 2-d polynomials

Consider n polynomials of the form 1 2

, ,0 0

( , ) [ , ], 1,2,..., 1M M

m jk k m j

m j

A x y A x y R x y k n

where 1M (resp. 2M is the greatest power of x (resp. y ) in ,kA x y .

Let the CGD ( , )p x y of ,kA x y be

where the greatest powers of the variables ,x y in ( , )p x y are

Problem. Determine the coefficients 0 1, , 0,1,...,k k i ip k b .

0 1

0 1

0

1

1

0

,0 0

( , ) k kk k

k k

b b

p x y p x y

0, 1,..., 1

0, 11

,... 1

0

,

deg ( , ) : min deg ( , )

deg ( , ) : min deg ( , )

x x kk n

y y kk n

p x y A x y

p x y A x y

b

b

Computation of the GCD of 2-d polynomials

0 1

0 1

0 1

0 1

,0 0

( , )b b

k kk k

k k

p x y p x y

Consider the following 1R interpolation points

21( ) ; 0,1 and 0,1,...,j j

bj i

rr

i j i j iu r W e i r b

where 1 0 1( 1)( 1)R b b .

Evaluate the coefficients 0 1,k kp in three steps :

1. Find the GCD 1, 1 1, ( )x rp p x u r of 1 1,kA x u r .

2. By applying 0 0( )x u r in the above polynomial, we get

0 1, 0 0 1 1( ), ( )r rp p u r u r .

3. Since 0 1

0 0 1 1

0 1 0 1

0 1

, , 0 10 0

b br k r k

r r k kk k

p p W W

, 0 1,[ ]k kp and

0 1,[ ]r rp form a

DFT pair and thus using the inverse DFT we derive the coefficients

0 1,[ ]k kp i.e. 0 1

0 0 1 1

0 1 0 1

0 1

, , 0 10 01

1 b br k r k

k k r rr r

p p W WR

, 0,1, ,i ik b

Example 1.Consider two polynomials

2, 3 3A x y x y xy x and 2, 3 3B x y xy xy y

Step 1. Calculate the number of interpolation points ib .

0

1

min deg ( , ), deg ( , ) min 2,1 1

min deg ( , ), deg ( , ) min 1,2 1

x x

y y

b A x y B x y

b A x y B x y

Step 2. Compute the 1

10

( 1) 4ii

R b

interpolation points :

21( ) , , 0,1j

bj ir

i j i iu r W W e i and 0,1,...,j ir b

21 1

21 1

10 1

0 0 0 0

10 1

1 0 1 1

0 1, 1 1

0 1, 1 1

j

j

j

j

u W u W e e

u W u W e e

Example 1.Step 3. Determine the GCD of 1 1, ( )A x u r , 1 1, ( )B x u r .

21

21

, 0 ,1 gcd 3 4,4 4 1

, 1 , 1 gcd 2 2, 2 2 1

p x u p x x x x x

p x u p x x x x x

Step 4. Apply 0 0( )x u r in the above polynomials, in order to take

0 1, 0 0 1 1( ), ( )r rp p u r u r .

0,0 0 1 1

1,0 0 1 1

0 , 0 1 2

1 , 0 1 0

x

x

p p u u x

p p u u x

0,1 0 1 1

1,1 0 1 1

0 , 1 1 0

1 , 1 1 2

x

x

p p u u x

p p u u x

Example 1.Step 5. Using the inverse DFT for the points

0 1,r rp we construct the

values 0 0 1 1

0 10 1 0 1

1 110 0, , 0 14

r k r kr rk k r rp p W W .

0,0 0,1 1,0 1,11, 0, 0, 1p p p p

Thus the GCD is , 1p x y xy

, 3 1A x y x xy and , 3 1B x y y xy

Computation of the LCM of 2-d polynomials

Consider n polynomials of the form 1 2

, ,0 0

( , ) [ , ], 1,2,..., 1M M

m jk k m j

m j

A x y A x y R x y k n

where 1M (resp. 2M is the greatest power of x (resp. y ) in ,kA x y .

0 1

0 1

0 1

0 1

,0 0

( , )b b

k kk k

k k

p x y p x y

where the greatest powers of the variables ,x y in ( , )p x y are

Problem. Determine the coefficients 0 1, , 0,1,...,k k i ip k b .

Let the LCM ( , )p x y of ,kA x y be

100

101

deg ( , ) : deg ( , )

deg ( , ) : deg ( , )

nkx x k

nky y k

p x y b A x y

p x y b A x y

Computation of the LCM of 2-d polynomials

0 1

0 1

0 1

0 1

,0 0

( , )b b

k kk k

k k

p x y p x y

Consider the following 1R interpolation points

21( ) ; 0,1 and 0,1,...,j j

bj i

rr

i j i j iu r W e i r b

where 1 0 1( 1)( 1)R b b .

Evaluate the coefficients 0 1,k kp in three steps :

2. By applying 0 0( )x u r in the above polynomial, we get

0 1, 0 0 1 1( ), ( )r rp p u r u r .

3. Since 0 1

0 0 1 1

0 1 0 1

0 1

, , 0 10 0

b br k r k

r r k kk k

p p W W

, 0 1,[ ]k kp and

0 1,[ ]r rp form a

DFT pair and thus using the inverse DFT we derive the coefficients

0 1,[ ]k kp i.e. 0 1

0 0 1 1

0 1 0 1

0 1

, , 0 10 01

1 b br k r k

k k r rr r

p p W WR

, 0,1, ,i ik b

1. Find the LCM 1, 1 1, ( )x rp p x u r of 1 1,kA x u r .

What happens when the interpolation points add extra divisors ;

Step 1. Calculate the number of interpolation points , 0,1ib i .

2

0

21

min deg 1 , deg 1 1 2

min deg 1 , deg 1 1 1

x x

y y

b y xy x xy x

b y xy x xy x

Step 2. Compute the 1

10

( 1) 6ii

R b

interpolation points

00 0

221 32 1

0 0

4222 32 1

0 0

0 1

1

2

jj

jj

u W

u W e e

u W e e

01 1

2 21 1 1 2

1 1

0 1

1 1j j

u W

u W e e

Consider two polynomials , 1A x y x yy x and 1, 1xyB x y x

where gcd 1 , 1 1 1y x x y xy x x

Step 3. Determine the GCD of 1 1, ( )A x u r and 1 1, ( )B x u r

2 2 2

1

1

, 0 ,1 gcd 1 , 1 1

, 1 , 1 1 1

p x u p x x x x

p x u p x x x

Step 4. Apply 0 0 00 , 1 , 2x u x u x u in the above polynomials,

in order to take 0 1, 0 0 1 1( ), ( )r rp p u r u r .

Step 5. Using the inverse DFT for the points 0 1,r rp we construct the

values 0 0 1 1

0 10 1 0 1

2 110 0, , 0 16

r k r kr rk k r rp p W W .

0,0 1,0 2,0 0,1 1,1 2,11, 1, 0, 0, 1, 1p p p p p p

Thus the GCD is 2, 1 1 1p x y x y xy x xy x instead of 1x

Solution of this problem – Expand the circle where the interpolation points stands

-2 -1 1 2

-2

-1

1

2

1 , 0,1,...,5iW i

-1 -0.5 0.5 1

-1

-0.5

0.5

1

12 , 0,1,...,5iW i

To solve this problem, we can just determine two random real numbers 1 2,c c

and multiply the points 2

1 , 0,1j

biiW e i

and 0,1,..., ij b with 1c and 2c

respectively and thus we have

1 , 0,1 0,1,....,j ji i iW cW i j b

Consider two polynomials , 1A x y y x x y and , 1 1B x y xy x

where gcd 1 , 1 1 1y x x y xy x x

Step 3. Determine the GCD of 1 1, ( )A x u r , 1 1, ( )B x u r

Let 1 2 1.55c c . Then the interpolation points will be

00 0

21 3

0 0

42 3

0 0

1.55 1.55

1.55 1.55

1.5

0

1

5 1.552

j

j

u W

u W e

u W e

01 1

21 2

1 1

1.55 1.55

1.55 1.55 1.55

0

1j

u W

u W e

1

1

1.55

1.55

, 0 , 1

, 1 , 1

p x u p x x

p x u p x x

Step 4. Determine the values at 0 0( )u r of each polynomial

0, 0 1, 0 2, 0

0, 1 1, 1 2, 1

2.55, 0.225 1.34234 , 0.225 1.34234

2.55, 0.225 1.34234 , 0.225 1.34234

p p j p j

p p j p j

Step 5. Use the inverse DFT for the points 0 1,r rp in order to construct the

values 0 0 1 1

0 10 1 0 1

2 110 10 0, ,6

r l r l

r rl l r rp p W W .

0,0 0,1

1,0 1,1

2,0 2,1

1, 0

1, 0

0, 0

p p

p p

p p

and thus the GCD is , 1p x y x

What happens when we have univariate factors in the GCD ;

Step 1. Calculate the number of interpolation points , 0,1ib i .

Step 2. Compute the 1

10

( 1) 6ii

R b

interpolation points

Consider two polynomials , 1A x y x y y and , 1 1B x y xy y

where gcd 1 , 1 1 1x y y xy y y

0

1

min deg 1 , deg 1 1 1

min deg 1 , deg 1 1 2

x x

y y

b x y y xy y

b x y y xy y

00 1

2 21 1 1 2

0 1

0 1

1 1j j

u W

u W e e

01 0

221 32 1

1 0

4222 32 1

1 0

0 1

1

2

jj

jj

u W

u W e e

u W e e

Step 3. Determine the GCD of 1 1, ( )A x u r and 1 1, ( )B x u r

Step 5. Using the inverse DFT for the points 0 1,r rp we construct the

values 0 0 1 1

0 10 1 0 1

2 110 0, , 0 16

r k r kr rk k r rp p W W .

Step 4. Apply 0 0 1x u and 0 1 1x u in the above polynomials

0,0 1,0 0,1 1,1 0,2 1,22, 0, 1p p p p p p

0,0 0,1 0,2

1,0 1,1 1,2

1, 0, 0

1 1 1, ,

3 3 3

p p p

p p p

1

1 1

, 0 ,1 gcd 2 1 ,2 1 1

, 1 , ,1 12

p x u p x x x x

p x u p x u

and thus the GCD is 21 1 1, 1

3 3 3p x y xy xy x .

Solution of this problemLet now say that we have n polynomials ( , ) [ , ]ip x y R x y

0,1,..., 1i n . These polynomials can be rewritten as

, , , ,( ) ( , ) ( )

, , , , ,, ( ) ( ) ( , ) ( , ) ( ) ( ), 0, 1,..., 1

i x i x y i yp x p x y p y

i i x x i x y x y i y yp x y p x g x p x y g x y p y g y i n

where , ( ) [ ]i xp x R x are prime each other, , ( ) [ ]i yp y R y are prime each

other, , , ( , ) [ , ]i x yp x y R x y are prime each other with no factors only of x

or y , ( )xg x is the gcd of , ( ),i xp x ( )yg y is the gcd of , ( )i yp y and

, ( , )x yg x y is the gcd of , , ( , ).i x yp x y

Solution of this problem

1

1 , ,0

( , ) ( ) ( , ) ( )n

x x y i yi

Q x y g x g x y p y

If we do the same for the variable y , we will take the polynomial 1

2 , ,0

( , ) ( ) ( , ) ( )n

y x y i xi

Q x y g y g x y p x

The gcd will be

We use the previous algorithm with one difference: “when we calculate the GCD in variable x (in 1-d case) we take also the product of highest order coefficients of x in 1 1,ip x u r ”

So, when we are using the inverse DFT, we take as result the polynomial

1 2

2 12 1

( , ) ( , )( , ) ( , ) ( , )

( , ) ( , )

Q x c Q c yG x y Q x y Q x y

Q x c Q c y

Algorithm (GCD of 2-d polynomials)

Algorithm. (DFT computation of the gcd of 2-d polynomials)

Consider two polynomials

, 1 1 ( )A x y x x x y y and , 1 ( 2)B x y x x x y y

, 1 1 ( )A x y x x x y y and , 1 ( 2)B x y x x x y y

21( , ) 1Q x y x x y y

GCD GCD *

Step 1. Compute the 1

1 , ,0

( , ) ( ) ( , ) ( )n

x x y i yi

Q x y g x g x y p y

by (DFT algorithm)

with the interpolation points multiplied by arbitrary real numbers 1c and 2c , first by the variable y .

Computation of Q1(x,y)

Let 1 2 5c c . Then we will have

Step 1. Calculate the interpolation points.

1

0

2

2min deg ( 1) ( ) ,deg ( 1)( 2)( ) min 3,3

deg ( 1) ( ) deg ( 1)( 2)( ) 2 2 4

3

y

x x

yb x x y y x x x y y

b x x y y x x x y y

1

10

( 1) (3 1)(4 1) 20ii

R b

00 0

21 4

0 0

42 4

0 0

63 4

0 0

(0) 5 5

(1) 5 5

(2) 5 5

(3) 5 5

j

j

j

u W

u W e

u W e

u W e

1

21 5

1 1

42 5

1 1

63 5

1 1

84 5

1 1

(0) 5

(1) 5 5

(2) 5 5

(3) 5 5

(4) 5 5

j

j

j

j

u

u W e

u W e

u W e

u W e

Computation of Q1(x,y)Step 2. Determine the GCD of the polynomials 0 0( ),A u r y , 0 0( ),B u r y

multiplied by the highest order coefficients of 0 0( ),A u r y , 0 0( ),B u r y .

2,5 1 ( 5), ,5 1 ( 2) 5

,5 1 )5 (

5

55

5A x x x B x x x x

p x x x

, 1 1 ( )A x y x x x y y and , 1 ( 2)B x y x x x y y

* GCD3

2 ( , ) ( 1) ( 2)( )Q x y x x x y y GCD

Step 2. Compute the 1

2 , ,0

( , ) ( ) ( , ) ( )n

y x y i xi

Q x y g y g x y p x

by (DFT algorithm)

with the interpolation points multiplied by arbitrary real numbers 1c and 2c , first by the variable x .

Algorithm (GCD of 2-d polynomials)

Step 4. The CGD is 1 2

2 1

( , ) ( , )2 1( , ) ( , ), ( , ) ( , )Q x c Q c y

Q x c Q c yG x y Q x y Q x y

Step 3. Compute the 1-d polynomials 1( , )Q x c and 2 ( , )Q x c

1

32

( ,1.27) 1.6129( 1)( 1.27)

( ,1.27) 1.27( 1) ( 2)( 1.27)

Q x x x

Q x x x x

12

2

33

( ,1.27)( , ) ( , )

( ,1.27)

1.6129( 1)( 1.27)( 1) ( 2)( )

1.27( 1) ( 2)( 1.27)

1.27( 1)( )

Q xG x y Q x y

Q x

x xx x x y y

x x x

x x y y

Conclusions• An algorithm for the computation of the GCD and

LCM of two-variable polynomials has been developed, based on DFT techniques.

• Main advantages : a) speed and b) robustness, that all DFT techniques have.

• The proposed algorithm has been implemented in the Mathematica computer programming language.

Further work• Approximate GCD-LCM of 2-d polynomials.• Use of other interpolation techniques and packages

for the solution of the same problem and compare the computation complexity.

• Computational complexity and numerical accuracy.• GCD-LCM of 2-d polynomial matrices by using either

GCD Euclidean division algorithms of 1-D polynomial matrices (McDuffee, Wolovich), or algorithms based on real matrix operations (Emre and Silverman, Kung et. Al., Anderson et. Al.), or system theoretic approach (Silverman and Van Dooren)