79
1 . . . 1 -a 0 -a 1 . . . -a n-1 Fast and stable computation of the roots of polynomials Jared L. Aurentz 1 , Thomas Mach 2 , Raf Vandebril 2 , and David S. Watkins 1 1 Dept. of Mathematics, Washington State University 2 Dept. Computer Science, KU Leuven Structured Numerical Linear and Multilinear Algebra: Analysis, Algorithms and Applications 11 September 2014 J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 1/41

Fast and backward stable computation of roots of polynomials

Embed Size (px)

Citation preview

Page 1: Fast and backward stable computation of roots of polynomials

1. . .

1

−a0−a1...

−an−1

Fast and stable computation of theroots of polynomials

Jared L. Aurentz1, Thomas Mach2, Raf Vandebril2, andDavid S. Watkins1

1Dept. of Mathematics, Washington State University2Dept. Computer Science, KU Leuven

Structured Numerical Linear and Multilinear Algebra:Analysis, Algorithms and Applications11 September 2014

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 1/41

Page 2: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

Collaborators

This is joint work with

David S. Watkins (WSU)

Jared L. Aurentz (WSU)

Raf Vandebril (KU Leuven)

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 2/41

Page 3: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

The Problem

p(x) = xn + an−1xn−1 + an−2x

n−2 + · · ·+ a0 = 0

Companion matrix

A =

−a01 −a1

1 −a2. . .

...1 −an−2

1 −an−1

Get the zeros of p by computing the eigenvalues of A.

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 3/41

Page 4: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

The Problem

p(x) = xn + an−1xn−1 + an−2x

n−2 + · · ·+ a0 = 0

Companion matrix

A =

−a01 −a1

1 −a2. . .

...1 −an−2

1 −an−1

Get the zeros of p by computing the eigenvalues of A.

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 3/41

Page 5: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

Cost

If structure not exploited:

O(n2) storageO(n3) flopsFrancis’s implicitly-shifted QR algorithmMatlab’s roots command.

If structure exploited:

O(n) storageO(n2) flopsdata-sparse representation + Francis’s algorithmseveral methods proposedincluding some by my coauthors (fast but potentially unstable)

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 4/41

Page 6: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

Cost

If structure not exploited:

O(n2) storageO(n3) flopsFrancis’s implicitly-shifted QR algorithmMatlab’s roots command.

If structure exploited:

O(n) storageO(n2) flopsdata-sparse representation + Francis’s algorithmseveral methods proposedincluding some by my coauthors (fast but potentially unstable)

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 4/41

Page 7: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

Some of the Competitors

Chandrasekaran, Gu, Xia, Zhu (2007)

Bini, Boito, Eidelman, Gemignani, Gohberg (2010)

Boito, Eidelman, Gemignani, Gohberg (2012)

Fortran codes available

Quasiseparable generator representation

we use essentially 2× 2 unitary matrices

results on backward stability

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 5/41

Page 8: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

Our Contribution

We present

yet another O(n) representation

Francis’s algorithm in O(n) flops/iteration

Fortran codes (we’re faster)

normwise “almost” backward stable (We can prove it.)

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 6/41

Page 9: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

Structure

companion matrix is unitary-plus-rank-one

A =

0 · · · 0 e iθ

1 0. . .

...1 0

+

0 · · · 0 −e iθ − a00 0 −a1...

......

0 · · · 0 −an−1

preserved by unitary similarities

companion matrix is also upper Hessenberg.

preserved by Francis’s algorithm

We exploit this structure.

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 7/41

Page 10: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

Structure

companion matrix is unitary-plus-rank-one

A =

0 · · · 0 e iθ

1 0. . .

...1 0

+

0 · · · 0 −e iθ − a00 0 −a1...

......

0 · · · 0 −an−1

preserved by unitary similarities

companion matrix is also upper Hessenberg.

preserved by Francis’s algorithm

We exploit this structure.

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 7/41

Page 11: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

Structure

companion matrix is unitary-plus-rank-one

A =

0 · · · 0 e iθ

1 0. . .

...1 0

+

0 · · · 0 −e iθ − a00 0 −a1...

......

0 · · · 0 −an−1

preserved by unitary similarities

companion matrix is also upper Hessenberg.

preserved by Francis’s algorithm

We exploit this structure.

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 7/41

Page 12: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

Structure

Chandrasekaran, Gu, Xia, Zhu (2007)

Compute the companion’s QR factorization

A = QR

Q is upper Hessenberg and unitary.

R is upper triangular and unitary-plus-rank-one.

We do this too.

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 8/41

Page 13: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

Structure

Chandrasekaran, Gu, Xia, Zhu (2007)

Compute the companion’s QR factorization

A = QR

Q is upper Hessenberg and unitary.

R is upper triangular and unitary-plus-rank-one.

We do this too.

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 8/41

Page 14: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

The Unitary Part (Matrix Q)

Q factored in core transformations× × × ×× × × ×

× × ×× ×

=

× ×× ×

11

1

× ×× ×

1

1

1× ×× ×

Q =��

����

O(n) storage

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 9/41

Page 15: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

The Upper Triangular Part (Matrix R)

R = U + xyT unitary-plus-rank-one, so

R has quasiseparable rank 2.

R =

× · · · × × · · · ×. . .

......

...× × · · · ×

× · · · ×. . .

...×

quasiseparable generator representation (O(n) storage)

Chandrasekaran, Gu, Xia, and Zhu exploit this structure.

We do it differently.

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 10/41

Page 16: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

Our Representation (Matrix A)

Add a row/column for extra wiggle room

A =

0 −a0 11 −a1 0

. . ....

...1 −an−1 0

0 0

Extra zero root can be deflated immediately.

A = QR, where

Q =

0 ±1 01 0 0

. . ....

...1 0 0

0 1

R =

1 −a1 0

. . ....

...1 −an−1 0

±a0 ∓1

0 0

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 11/41

Page 17: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

Our Representation (Matrix A)

Add a row/column for extra wiggle room

A =

0 −a0 11 −a1 0

. . ....

...1 −an−1 0

0 0

Extra zero root can be deflated immediately.

A = QR, where

Q =

0 ±1 01 0 0

. . ....

...1 0 0

0 1

R =

1 −a1 0

. . ....

...1 −an−1 0

±a0 ∓1

0 0

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 11/41

Page 18: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

Our Representation (Matrix Q)

Q =

0 ±1 01 0 0

. . ....

...1 0 0

0 1

Q is stored in factored form

Q =��

����

Q = Q1Q2 · · ·Qn−1 (mark the n − 1 instead of n)

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 12/41

Page 19: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

Our Representation (Matrix R)

R =

1 −a1 0

. . ....

...1 −an−1 0

±a0 ∓1

0 0

R is unitary-plus-rank-one:

1 0 0. . .

......

1 0 00 ∓1

±1 0

+

0 −a1 0

. . ....

...0 −an−1 0

±a0 0

∓1 0

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 13/41

Page 20: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

Representation of R

R = U + xyT , where

xyT =

−a1...

−an−1

±a0∓1

[0 · · · 0 1 0

]

Next step: Roll up x .

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 14/41

Page 21: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

Representation of R

����

��

××××

=

××××

C1 · · ·Cn−1Cnx = αe1 (w.l.g. α = 1)

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 15/41

Page 22: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

Representation of R

����

��

××××

=

×××0

C1 · · ·Cn−1Cnx = αe1 (w.l.g. α = 1)

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 15/41

Page 23: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

Representation of R

��

����

××××

=

××00

C1 · · ·Cn−1Cnx = αe1 (w.l.g. α = 1)

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 15/41

Page 24: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

Representation of R

����

��

××××

=

×000

C1 · · ·Cn−1Cnx = αe1 (w.l.g. α = 1)

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 15/41

Page 25: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

Representation of R

����

��

××××

=

×000

C1 · · ·Cn−1Cnx = αe1 (w.l.g. α = 1)

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 15/41

Page 26: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

Representation of A

Altogether we have

A = QR = Q C ∗ (B + e1yT )

A = Q1 · · ·Qn−1 C∗n · · ·C ∗

1 (B1 · · ·Bn + e1yT )

����

��

Q1 · · ·Qn−1

����

����

C ∗n · · ·C ∗

1

����

����

B = B1 · · ·Bn

+

1

0

0

0

0

e1

× × × × ×

yT

R

.

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 16/41

Page 27: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

Francis’s Iterations

We have complex single-shift code,

real double-shift code.

We describe single-shift case for simplicity

ignoring rank-one part.

Two basic operations:

Fusion� �� � ⇒ ��

Turnover� ��

��

� ⇔ ��

��� �

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 17/41

Page 28: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

Francis’s Iterations

We have complex single-shift code,

real double-shift code.

We describe single-shift case for simplicity

ignoring rank-one part.

Two basic operations:

Fusion� �� � ⇒ ��

Turnover� ��

��

� ⇔ ��

��� �

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 17/41

Page 29: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

Francis’s Iterations

We have complex single-shift code,

real double-shift code.

We describe single-shift case for simplicity

ignoring rank-one part.

Two basic operations:

Fusion� �� � ⇒ ��

Turnover� ��

��

� ⇔ ��

��� �

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 17/41

Page 30: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

The Bulge Chase

�� ��

����

������ ����

������

�� ������

��

����

��

Q1 · · ·Qn−1

����

����

C ∗n · · ·C ∗

1

����

����

B = B1 · · ·Bn

+

1

0

0

0

0

e1

× × × × ×

yT

R

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 18/41

Page 31: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

The Bulge Chase

��

����

������

�� ������

������ ����

����

����

��

Q1 · · ·Qn−1

����

����

C ∗n · · ·C ∗

1

����

����

B = B1 · · ·Bn

+

1

0

0

0

0

e1

× × × × ×

yT

R

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 18/41

Page 32: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

The Bulge Chase

�� ��

��

������

�� ������

������ ����

����

����

��

Q1 · · ·Qn−1

����

����

C ∗n · · ·C ∗

1

����

����

B = B1 · · ·Bn

+

1

0

0

0

0

e1

× × × × ×

yT

R

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 18/41

Page 33: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

The Bulge Chase

�� ��

����

������ ����

������

�� ������

��

����

��

Q1 · · ·Qn−1

����

����

C ∗n · · ·C ∗

1

����

����

B = B1 · · ·Bn

+

1

0

0

0

0

e1

× × × × ×

yT

R

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 18/41

Page 34: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

The Bulge Chase

�� ����

��

������ ����

������

�� ������

��

����

��

Q1 · · ·Qn−1

����

����

C ∗n · · ·C ∗

1

����

����

B = B1 · · ·Bn

+

1

0

0

0

0

e1

× × × × ×

yT

R

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 18/41

Page 35: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

The Bulge Chase

�� ����

����

���� ����

������

�� ������

��

����

��

Q1 · · ·Qn−1

����

����

C ∗n · · ·C ∗

1

����

����

B = B1 · · ·Bn

+

1

0

0

0

0

e1

× × × × ×

yT

R

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 18/41

Page 36: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

The Bulge Chase

�� ������

��

���� ����

������

�� ������

��

����

��

Q1 · · ·Qn−1

����

����

C ∗n · · ·C ∗

1

����

����

B = B1 · · ·Bn

+

1

0

0

0

0

e1

× × × × ×

yT

R

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 18/41

Page 37: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

The Bulge Chase

�� ������

����

�� ������

������ ����

����

����

��

Q1 · · ·Qn−1

����

����

C ∗n · · ·C ∗

1

����

����

B = B1 · · ·Bn

+

1

0

0

0

0

e1

× × × × ×

yT

R

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 18/41

Page 38: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

The Bulge Chase

�� ������

��

��

�� ������

������ ����

����

����

��

Q1 · · ·Qn−1

����

����

C ∗n · · ·C ∗

1

����

����

B = B1 · · ·Bn

+

1

0

0

0

0

e1

× × × × ×

yT

R

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 18/41

Page 39: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

The Bulge Chase

�� ������

��

����

������

������ ����

����

����

��

Q1 · · ·Qn−1

����

����

C ∗n · · ·C ∗

1

����

����

B = B1 · · ·Bn

+

1

0

0

0

0

e1

× × × × ×

yT

R

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 18/41

Page 40: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

The Bulge Chase

�� ������

����

��

������

������ ����

����

����

��

Q1 · · ·Qn−1

����

����

C ∗n · · ·C ∗

1

����

����

B = B1 · · ·Bn

+

1

0

0

0

0

e1

× × × × ×

yT

R

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 18/41

Page 41: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

The Bulge Chase

�� ������

����

�� ��

����

������ ����

����

����

��

Q1 · · ·Qn−1

����

����

C ∗n · · ·C ∗

1

����

����

B = B1 · · ·Bn

+

1

0

0

0

0

e1

× × × × ×

yT

R

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 18/41

Page 42: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

The Bulge Chase

�� ������

������

����

������

�� ������

��

����

��

Q1 · · ·Qn−1

����

����

C ∗n · · ·C ∗

1

����

����

B = B1 · · ·Bn

+

1

0

0

0

0

e1

× × × × ×

yT

R

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 18/41

Page 43: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

The Bulge Chase

�� ������

������ ��

����

������ ����

����

����

��

Q1 · · ·Qn−1

����

����

C ∗n · · ·C ∗

1

����

����

B = B1 · · ·Bn

+

1

0

0

0

0

e1

× × × × ×

yT

R

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 18/41

Page 44: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

The Bulge Chase

�� ������

������ ����

����

���� ����

����

����

��

Q1 · · ·Qn−1

����

����

C ∗n · · ·C ∗

1

����

����

B = B1 · · ·Bn

+

1

0

0

0

0

e1

× × × × ×

yT

R

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 18/41

Page 45: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

The Bulge Chase

�� ������

������ ����

��

����

�� ������

��

����

��

Q1 · · ·Qn−1

����

����

C ∗n · · ·C ∗

1

����

����

B = B1 · · ·Bn

+

1

0

0

0

0

e1

× × × × ×

yT

R

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 18/41

Page 46: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

The Bulge Chase

�� ������

������ ����

����

����

������

��

����

��

Q1 · · ·Qn−1

����

����

C ∗n · · ·C ∗

1

����

����

B = B1 · · ·Bn

+

1

0

0

0

0

e1

× × × × ×

yT

R

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 18/41

Page 47: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

The Bulge Chase

�� ������

������ ����

������

�� ��

����

��

����

��

Q1 · · ·Qn−1

����

����

C ∗n · · ·C ∗

1

����

����

B = B1 · · ·Bn

+

1

0

0

0

0

e1

× × × × ×

yT

R

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 18/41

Page 48: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

The Bulge Chase

�� ������

������ ����

������

��

������

��

����

��

Q1 · · ·Qn−1

����

����

C ∗n · · ·C ∗

1

����

����

B = B1 · · ·Bn

+

1

0

0

0

0

e1

× × × × ×

yT

R

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 18/41

Page 49: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

The Bulge Chase

�� ������

������ ����

������

�� ������

��

����

��

Q1 · · ·Qn−1

����

����

C ∗n · · ·C ∗

1

����

����

B = B1 · · ·Bn

+

1

0

0

0

0

e1

× × × × ×

yT

R

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 18/41

Page 50: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

Done!

Iteration complete!

Cost: 3n turnovers/iteration, so O(n) flops/iteration

Double-shift iteration is similar:

chase two core transformations instead of one, 7n turnovers/iteration.

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 19/41

Page 51: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

Speed Comparison, Fortran implementation

ContestantsLAPACK code xHSEQR (O(n3))

AMVW (our single-shift code)

BBEGG (Bini, Boito, et al. 2010)

only single-shift code

BEGG (Boito, Eidelman, et al. 2012)

only double-shift code

CGXZ (Chandrasekaran, Gu, et al. 2007)

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 20/41

Page 52: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

complex single-shift—random coefficients

AMVW: 4.269

BBEGG: 23.297BEGG: 15.442

101 102 103 104

10−5

10−2

101

Tim

ein

seconds

AMVWZHSEQRBBEGGBEGG

101 102 103 10410−16

10−12

10−8

Accuracy

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 21/41

Page 53: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

real double-shift—random coefficients

AMVW: 3.817

BBEGG: 7.899CGXZ: 9.023

101 102 103 104

10−5

10−2

101

Tim

ein

seconds

AMVWDHSEQRBBEGGCGXZ

101 102 103 10410−16

10−12

10−8

Accuracy

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 22/41

Page 54: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

single-shift—random aeb, b ∈ [−R ,R], R = 5, . . . , 25

101 102 103 104

10−5

10−2

101

Tim

ein

seconds

AMVWZHSEQRBBEGGBEGG

101 102 103 10410−16

10−12

10−8

Accuracy

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 23/41

Page 55: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

double-shift—random aeb, b ∈ [−R ,R], R = 5, . . . , 25

101 102 103 104

10−5

10−2

101

Tim

ein

seconds

AMVWDHSEQRBBEGGCGXZ

101 102 103 10410−16

10−12

10−8

Accuracy

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 24/41

Page 56: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

single-shift—zn − 1

AMVW: 3.198

BBEGG: 27.847BEGG: 16.933

101 102 103 104

10−5

10−2

101

Tim

ein

seconds

AMVWZHSEQRBBEGGBEGG

101 102 103 10410−16

10−12

10−8

Accuracy

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 25/41

Page 57: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

double-shift—zn − 1

AMVW: 3.554

BBEGG: 6.595CGXZ: 8.883

101 102 103 104

10−5

10−2

101

Tim

ein

seconds

AMVWDHSEQRBBEGGCGXZ

101 102 103 10410−16

10−12

10−8

Accuracy

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 26/41

Page 58: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

Special Polynomials

Roots known!

No. Description Deg.

1 Wilkinson polynomial 102 Wilkinson polynomial 153 Wilkinson polynomial 204 scaled and shifted Wilkinson poly. 205 reverse Wilkinson polynomial 106 reverse Wilkinson polynomial 157 reverse Wilkinson polynomial 208 prescribed roots of varying scale 209 prescribed roots of varying scale −3 2010 Chebyshev polynomial 2011 z20 + z19 + · · ·+ z + 1 20

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 27/41

Page 59: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

Special Polynomials (2)

Roots known!

No. Description Deg.

MPSolve12 trv m, C. Traverso 2413 mand31 Mandelbrot example (k = 5) 3114 mand63 Mandelbrot example (k = 6) 63

Vanni Noferini15 polynomial from V. Noferini 1216 polynomial from V. Noferini 35

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 28/41

Page 60: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

Special Polynomials (3)

Roots known!

No. Description Deg.

Jenkins and Traub17 p1(z) with a =1 e−8 318 p1(z) with a =1 e−15 319 p1(z) with a =1 e+8 320 p1(z) with a =1 e+15 321 p3(z) underflow test 1022 p3(z) underflow test 2023 p10(z) deflation test a = 10 e+3 324 p10(z) deflation test a = 10 e+6 325 p10(z) deflation test a = 10 e+9 326 p11(z) deflation test m = 15 60

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 29/41

Page 61: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

Special Polynomials (4)

Roots unknown!

No. Description Deg.

27 Bernoulli polynomial (k = 20) 2028 truncated exponential (k = 20) 20

used in Bevilacqua, Del Corso, and Gemignani29–33 p1(z) with m = 10, 20, 30, 256, 512 2m34–38 p2(z) with m = 10, 20, 30, 256, 512 l 2m39–43 p3(z) with m + 1 = 20, . . . , 1024, λ = 0.9 m + 144–48 p3(z) with m + 1 = 20, . . . , 1024, λ = 0.999 m + 1

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 30/41

Page 62: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

single-shift, unbalanced, relative backward error

No AMVW ZHSEQR ZGEEV BBEGG BEGG

1 −15 −16 −16 −01 −152 −15 −15 −15 −01 −153 −14 −15 −14 −01 −014 −15 −15 −15 −01 −145 −16 −15 −15 −06 −156 −15 −15 −15 −06 −147 −15 −15 −15 −04 −148 −15 −16 −15 −01 −149 −14 −15 −15 −01 −0110 −15 −15 −15 −01 −1411 −15 −15 −15 −01 −1412 −15 −13 −15 −01 −06

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 31/41

Page 63: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

single-shift, unbalanced, relative backward error (2)

No AMVW ZHSEQR ZGEEV BBEGG BEGG

13 −15 −15 −15 −01 −1414 −15 −15 −15 −01 −1415 −15 −15 −12 −01 −0116 −15 −15 −10 −01 −0117 −17 −16 −22 −01 −1718 −17 −16 −30 −01 −1619 −16 −01 −24 +07 −0120 −17 +13 −17 +14 −0121 −16 −16 −18 −03 −1522 −16 −15 −17 −02 −1323 −16 −16 −15 +03 −1624 −16 −16 −16 +06 −15

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 32/41

Page 64: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

single-shift, unbalanced, relative backward error (3)

No AMVW ZHSEQR ZGEEV BBEGG BEGG

25 −26 −16 −16 +09 −1126 −15 −15 −14 −01 −1327 −15 −15 −15 −01 −1428 −12 −14 −15 −01 −0329 −15 −15 −15 −01 −1430 −15 −15 −14 −01 −1331 −15 −14 −14 −02 −1332 −13 −13 −13 −01 −1133 −13 −13 −13 −01 −1034 −15 −15 −15 −01 −1435 −15 −15 −15 −02 −1436 −15 −14 −15 −01 −14

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 33/41

Page 65: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

single-shift, unbalanced, relative backward error (4)

No AMVW ZHSEQR ZGEEV BBEGG BEGG

37 −14 −14 −14 −02 −1238 −14 −13 −14 −02 −1139 −15 −15 −15 −01 −1440 −15 −14 −14 −01 −1341 −15 −14 −14 −01 −1342 −13 −13 −13 +00 −1143 −13 −13 −13 −01 −1044 −15 −14 −14 +00 −1345 −15 −14 −14 +00 −1346 −15 −14 −14 −01 −1347 −13 −13 −13 +00 −1148 −12 −12 −13 +00 −10

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 34/41

Page 66: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

double-shift, unbalanced, relative backward error

No AMVW DHSEQR DGEEV BBEGG CGXZ

1 −15 −15 −15 −09 −112 −15 −15 −15 −01 −063 −14 −15 −15 −01 −014 −15 −15 −15 −13 −145 −16 −16 −16 −15 −156 −15 −15 −16 −02 −147 −15 −15 −15 −02 −158 −15 −15 −15 −01 −149 −15 −15 −15 −01 −0410 −15 −15 −15 −14 −1411 −15 −15 −15 −15 −1512 −06 −12 −15 −01 −01

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 35/41

Page 67: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

double-shift, unbalanced, relative backward error (2)

No AMVW DHSEQR DGEEV BBEGG CGXZ

13 −15 −15 −16 −02 −1414 −15 −15 −15 −04 −1315 −15 −15 −10 −01 −1016 −15 −15 −10 −01 −0517 −17 −16 −24 −16 −1618 −18 −17 +00 −16 −1619 −02 +00 −16 −01 −0120 −01 −17 −16 −01 −0121 −17 −16 −17 −15 −0522 −16 −16 −17 −02 −0123 −16 −16 −16 −16 −1624 −14 −16 −15 −15 −15

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 36/41

Page 68: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

double-shift, unbalanced, relative backward error (3)

No AMVW DHSEQR DGEEV BBEGG CGXZ

25 −16 −16 −24 −16 −1126 −15 −14 −15 −14 −1427 −15 −15 −15 −11 −1428 −14 −14 −15 −01 −0129 −15 −15 −15 −15 −1530 −15 −14 −14 −15 −1431 −15 −14 −14 −15 −1432 −14 −14 −13 −14 −1133 −13 −13 −13 −13 −0934 −15 −15 −15 −15 −1535 −15 −15 −15 −14 −1536 −15 −14 −15 −15 −15

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 37/41

Page 69: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

double-shift, unbalanced, relative backward error (4)

No AMVW DHSEQR DGEEV BBEGG CGXZ

37 −14 −14 −14 −12 −1238 −14 −13 −14 −11 +0739 −15 −14 −15 −15 −1540 −15 −14 −14 −13 −1441 −15 −14 −14 −13 −1442 −14 −13 −13 −11 −1343 −13 −12 −12 −10 −1244 −15 −14 −14 −13 −1445 −15 −14 −14 −13 −1346 −14 −14 −14 −13 −1347 −14 −13 −13 −12 −1248 −13 −12 −12 −10 −12

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 38/41

Page 70: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

Backward stability

We have a proof forU∗(A+∆A)U = A,

where‖∆A‖2 ≤ ‖coefficients of p(x)‖22O(εm).

The square is annoying, and

in the analysis also a dependency of |a0|.But in the numerical experiments

Tests with small |a0| no problem: as accurate as LAPACK.Tests with growing ‖x‖2 no problem: as accurate as LAPACK.

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 39/41

Page 71: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

Backward stability

We have a proof forU∗(A+∆A)U = A,

where‖∆A‖2 ≤ ‖coefficients of p(x)‖22O(εm).

The square is annoying, and

in the analysis also a dependency of |a0|.

But in the numerical experiments

Tests with small |a0| no problem: as accurate as LAPACK.Tests with growing ‖x‖2 no problem: as accurate as LAPACK.

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 39/41

Page 72: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

Backward stability

We have a proof forU∗(A+∆A)U = A,

where‖∆A‖2 ≤ ‖coefficients of p(x)‖22O(εm).

The square is annoying, and

in the analysis also a dependency of |a0|.But in the numerical experiments

Tests with small |a0| no problem: as accurate as LAPACK.Tests with growing ‖x‖2 no problem: as accurate as LAPACK.

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 39/41

Page 73: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

Conclusion

We have a new fast companion eigenvalue method:

about as accurate as LAPACK,

and more accurate than the other fast methods,

does OK on harder problems

faster than LAPACK from size 16 on,

faster than all other fast methods,

”almost” backward stable (see preprint).

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 40/41

Page 74: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

Conclusion

We have a new fast companion eigenvalue method:

about as accurate as LAPACK,

and more accurate than the other fast methods,

does OK on harder problems

faster than LAPACK from size 16 on,

faster than all other fast methods,

”almost” backward stable (see preprint).

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 40/41

Page 75: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

Conclusion

We have a new fast companion eigenvalue method:

about as accurate as LAPACK,

and more accurate than the other fast methods,

does OK on harder problems

faster than LAPACK from size 16 on,

faster than all other fast methods,

”almost” backward stable (see preprint).

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 40/41

Page 76: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

More ...

Preprint: http://www.cs.kuleuven.be/publicaties/rapporten/tw/TW654.abs.html.

Fortran code: http://people.cs.kuleuven.be/~raf.vandebril/homepage/software/companion_qr.php.

Package by Andreas Noack in julia (http://julialang.org/):Pkg.clone("https://github.com/andreasnoackjensen/AMVW.jl")

Pkg.build("AMVW").

Thank you for your attention.

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 41/41

Page 77: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

More ...

Preprint: http://www.cs.kuleuven.be/publicaties/rapporten/tw/TW654.abs.html.

Fortran code: http://people.cs.kuleuven.be/~raf.vandebril/homepage/software/companion_qr.php.

Package by Andreas Noack in julia (http://julialang.org/):Pkg.clone("https://github.com/andreasnoackjensen/AMVW.jl")

Pkg.build("AMVW").

Thank you for your attention.

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 41/41

Page 78: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

More ...

Preprint: http://www.cs.kuleuven.be/publicaties/rapporten/tw/TW654.abs.html.

Fortran code: http://people.cs.kuleuven.be/~raf.vandebril/homepage/software/companion_qr.php.

Package by Andreas Noack in julia (http://julialang.org/):Pkg.clone("https://github.com/andreasnoackjensen/AMVW.jl")

Pkg.build("AMVW").

Thank you for your attention.

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 41/41

Page 79: Fast and backward stable computation of roots of polynomials

Introduction Factorization & Facts Francis’s Algorithm Numerical experiments

More ...

Preprint: http://www.cs.kuleuven.be/publicaties/rapporten/tw/TW654.abs.html.

Fortran code: http://people.cs.kuleuven.be/~raf.vandebril/homepage/software/companion_qr.php.

Package by Andreas Noack in julia (http://julialang.org/):Pkg.clone("https://github.com/andreasnoackjensen/AMVW.jl")

Pkg.build("AMVW").

Thank you for your attention.

J. Aurentz, T. Mach, R. Vandebril, D. Watkins, Fast and stable computation of the roots of polynomials 41/41