KEYWORDS. Numerical methods, generalized singular values, products of matrices, quotients of matrices. Introduction The two basic unitary decompositio

Similar documents
Using semiseparable matrices to compute the SVD of a general matrix product/quotient

UMIACS-TR July CS-TR 2494 Revised January An Updating Algorithm for. Subspace Tracking. G. W. Stewart. abstract

Solving large scale eigenvalue problems

Matrix Algorithms. Volume II: Eigensystems. G. W. Stewart H1HJ1L. University of Maryland College Park, Maryland

Computation of eigenvalues and singular values Recall that your solutions to these questions will not be collected or evaluated.

ETNA Kent State University

Bindel, Fall 2016 Matrix Computations (CS 6210) Notes for

Numerical Methods in Matrix Computations

14.2 QR Factorization with Column Pivoting

Institute for Advanced Computer Studies. Department of Computer Science. On the Adjoint Matrix. G. W. Stewart y ABSTRACT

p q m p q p q m p q p Σ q 0 I p Σ 0 0, n 2p q

I-v k e k. (I-e k h kt ) = Stability of Gauss-Huard Elimination for Solving Linear Systems. 1 x 1 x x x x

Institute for Advanced Computer Studies. Department of Computer Science. Two Algorithms for the The Ecient Computation of

Matrices, Moments and Quadrature, cont d

2 and bound the error in the ith eigenvector in terms of the relative gap, min j6=i j i? jj j i j j 1=2 : In general, this theory usually restricts H

Normalized power iterations for the computation of SVD

A Backward Stable Hyperbolic QR Factorization Method for Solving Indefinite Least Squares Problem

EIGENVALUE PROBLEMS. EIGENVALUE PROBLEMS p. 1/4

216 S. Chandrasearan and I.C.F. Isen Our results dier from those of Sun [14] in two asects: we assume that comuted eigenvalues or singular values are

Outline Introduction: Problem Description Diculties Algebraic Structure: Algebraic Varieties Rank Decient Toeplitz Matrices Constructing Lower Rank St

In this section again we shall assume that the matrix A is m m, real and symmetric.

Key words. conjugate gradients, normwise backward error, incremental norm estimation.

Applied Mathematics 205. Unit II: Numerical Linear Algebra. Lecturer: Dr. David Knezevic

Iterative Algorithm for Computing the Eigenvalues

Parallel Singular Value Decomposition. Jiaxing Tan

D. Gimenez, M. T. Camara, P. Montilla. Aptdo Murcia. Spain. ABSTRACT

1 Vectors. Notes for Bindel, Spring 2017 Numerical Analysis (CS 4220)

Introduction. Chapter One

WHEN MODIFIED GRAM-SCHMIDT GENERATES A WELL-CONDITIONED SET OF VECTORS

A Note on Eigenvalues of Perturbed Hermitian Matrices

Outline Background Schur-Horn Theorem Mirsky Theorem Sing-Thompson Theorem Weyl-Horn Theorem A Recursive Algorithm The Building Block Case The Origina

A Method for Constructing Diagonally Dominant Preconditioners based on Jacobi Rotations

AMS526: Numerical Analysis I (Numerical Linear Algebra)

EECS 275 Matrix Computation

4.8 Arnoldi Iteration, Krylov Subspaces and GMRES

Math 411 Preliminaries

Positive Denite Matrix. Ya Yan Lu 1. Department of Mathematics. City University of Hong Kong. Kowloon, Hong Kong. Abstract

Lecture 11. Linear systems: Cholesky method. Eigensystems: Terminology. Jacobi transformations QR transformation

Algorithm 853: an Efficient Algorithm for Solving Rank-Deficient Least Squares Problems

DELFT UNIVERSITY OF TECHNOLOGY

AMS526: Numerical Analysis I (Numerical Linear Algebra for Computational and Data Sciences)

Theorem Let X be a symmetric solution of DR(X) = 0. Let X b be a symmetric approximation to Xand set V := X? X. b If R b = R + B T XB b and I + V B R

Computing Eigenvalues and/or Eigenvectors;Part 2, The Power method and QR-algorithm

Solving large scale eigenvalue problems

AMS526: Numerical Analysis I (Numerical Linear Algebra)

arxiv: v1 [math.na] 5 May 2011

Block Bidiagonal Decomposition and Least Squares Problems

Eigenvalue Problems and Singular Value Decomposition

(17) (18)

Institute for Advanced Computer Studies. Department of Computer Science. Iterative methods for solving Ax = b. GMRES/FOM versus QMR/BiCG

6. Iterative Methods for Linear Systems. The stepwise approach to the solution...

PRECONDITIONING IN THE PARALLEL BLOCK-JACOBI SVD ALGORITHM

1 Singular Value Decomposition and Principal Component

Algorithms to solve block Toeplitz systems and. least-squares problems by transforming to Cauchy-like. matrices

5. Direct Methods for Solving Systems of Linear Equations. They are all over the place...

Generalized interval arithmetic on compact matrix Lie groups

Orthogonal iteration to QR

MS&E 318 (CME 338) Large-Scale Numerical Optimization

Index. book 2009/5/27 page 121. (Page numbers set in bold type indicate the definition of an entry.)

Gradient Method Based on Roots of A

The restarted QR-algorithm for eigenvalue computation of structured matrices

Lecture 4: Linear Algebra 1

Jim Lambers MAT 610 Summer Session Lecture 2 Notes

LAPACK-Style Codes for Pivoted Cholesky and QR Updating. Hammarling, Sven and Higham, Nicholas J. and Lucas, Craig. MIMS EPrint: 2006.

A Divide-and-Conquer Algorithm for Functions of Triangular Matrices

QR-decomposition. The QR-decomposition of an n k matrix A, k n, is an n n unitary matrix Q and an n k upper triangular matrix R for which A = QR

LAPACK-Style Codes for Pivoted Cholesky and QR Updating

MATH 425-Spring 2010 HOMEWORK ASSIGNMENTS

Lecture 2: Numerical linear algebra

Introduction 5. 1 Floating-Point Arithmetic 5. 2 The Direct Solution of Linear Algebraic Systems 11

that of the SVD provides new understanding of left and right generalized singular vectors. It is shown

Main matrix factorizations

Chapter 12 Block LU Factorization

Numerical Linear Algebra

Orthogonal iteration to QR

2 DIECI AND PAPINI how to choose k; on one hand, we need k large enough because Pade approximations are accurate only if A=2 k is suciently small (see

Numerical Linear Algebra Primer. Ryan Tibshirani Convex Optimization /36-725

Sensitivity of Gauss-Christoffel quadrature and sensitivity of Jacobi matrices to small changes of spectral data

Sparsity-Preserving Difference of Positive Semidefinite Matrix Representation of Indefinite Matrices

ANONSINGULAR tridiagonal linear system of the form

Eigenvalue problems and optimization

AMS526: Numerical Analysis I (Numerical Linear Algebra) Lecture 23: GMRES and Other Krylov Subspace Methods; Preconditioning

AM 205: lecture 8. Last time: Cholesky factorization, QR factorization Today: how to compute the QR factorization, the Singular Value Decomposition

CME 302: NUMERICAL LINEAR ALGEBRA FALL 2005/06 LECTURE 6

1. Introduction Let the least value of an objective function F (x), x2r n, be required, where F (x) can be calculated for any vector of variables x2r

Preconditioned Parallel Block Jacobi SVD Algorithm

3 QR factorization revisited

S.F. Xu (Department of Mathematics, Peking University, Beijing)

Parallel Numerical Algorithms

Reduction of two-loop Feynman integrals. Rob Verheyen

Department of. Computer Science. Functional Implementations of. Eigensolver. December 15, Colorado State University

Dominant feature extraction

Preliminary/Qualifying Exam in Numerical Analysis (Math 502a) Spring 2012

Reduced Synchronization Overhead on. December 3, Abstract. The standard formulation of the conjugate gradient algorithm involves

11.0 Introduction. An N N matrix A is said to have an eigenvector x and corresponding eigenvalue λ if. A x = λx (11.0.1)

The Lanczos and conjugate gradient algorithms

Example: 2x y + 3z = 1 5y 6z = 0 x + 4z = 7. Definition: Elementary Row Operations. Example: Type I swap rows 1 and 3

AMS526: Numerical Analysis I (Numerical Linear Algebra for Computational and Data Sciences)

ECS231 Handout Subspace projection methods for Solving Large-Scale Eigenvalue Problems. Part I: Review of basic theory of eigenvalue problems

Krylov subspace projection methods

Transcription:

COMPUTING THE SVD OF A GENERAL MATRIX PRODUCT/QUOTIENT GENE GOLUB Computer Science Department Stanford University Stanford, CA USA golub@sccm.stanford.edu KNUT SLNA SC-CM Stanford University Stanford, CA USA solna@sccm.stanford.edu PAUL VAN DOOREN Cesame Universite Catholique de Louvain Louvain-la-Neuve Belgium vandooren@anma.ucl.ac.be ABSTRACT. In this paper we derive a new algorithm for constructing a unitary decomposition of a sequence of matrices in product or quotient form. The unitary decomposition requires only unitary left and right transformations on the individual matrices and amounts to computing the generalized singular value decomposition of the sequence. The proposed algorithm is related to the classical Golub-Kahan procedure for computing the singular value decomposition of a single matrix in that it constructs a bidiagonal form of the sequence as an intermediate result. When applied to two matrices this new method is an alternative way of computing the quotient and product SVD and is more economical than current methods. 1

KEYWORDS. Numerical methods, generalized singular values, products of matrices, quotients of matrices. Introduction The two basic unitary decompositions of a matrix A yielding some spectral information are the Schur form A = UT U { where U is unitary and T is upper triangular { and the singular value decomposition A = UV { where U and V are unitary and is diagonal { (for the latter A does not need to be square). It is interesting to note that both these forms are computed by a QR-like iteration []. The SVD algorithm of Golub-Kahan [] is indeed an implicit QR-algorithm applied to the Hermitian matrix A A. When looking at unitary decompositions involving two matrices, say A and B, a similar implicit algorithm was given in [] and is known as the QZ-algorithm. It computes A = QT a Z and B = QT b Z where Q and Z are unitary and T a and T b are upper triangular. This algorithm is in fact the QR-algorithm again performed implicitly on the quotient B?1 A. The corresponding decomposition is therefore also known as the generalized Schur form. This is not the case, though, when considering the generalized singular value decomposition of two matrices, appearing as a quotient B?1 A or a product BA. In this case the currently used algorithm is not of QR type but of a Jacobi type. The reason for this choice is that Jacobi methods extend to products and quotients without too many problems. The bad news is that the Jacobi algorithm typically has a (moderately) higher complexity than the QR algorithm. Yet, so far, nobody proposed an implicit QR-like method for the SVD of a product or quotient of two matrices. In this paper we show that, in fact, such an implicit algorithm is easy to derive and that it even extends straightforwardly to sequences of products/quotients of several matrices. Moreover, the complexity will be shown to be lower than for the corresponding Jacobi like methods. 1 Implicit singular value decomposition Consider the problem of computing the singular value decomposition of a matrix A that is an expression of the following type : A = A s K K ::: A s As 1 1 ; (1)

where s i = 1, i.e. a sequence of products of quotients of matrices. For simplicity we assume that the A i matrices are square nn and invertible, but as was pointed out in [], this does not aect the generality of what follows. While it is clear that one has to perform left and right transformations on A to get U AV =, these transformations will only aect A K and A 1. Beyond this, one can insert an expression Q i Q i = I n in between every pair A s i+1 i+1 As i : : i in (1). If we also dene Q K = U and Q0 = V, we arrive at the following expression : U AV = (Q K As K K Q K?1 ) ::: (Q As Q 1) (Q 1 As 1 1 Q 0): () With the degrees of freedom present in these K + 1 unitary transformations Q i at hand, one can now choose each expression Q i As i i Q i?1 to be upper triangular. Note that the expression Q i As i i Q i?1 = T s i i with T i upper triangular can be rewritten as : Q i A iq i?1 = T i for s i = 1 ; Q j?1 A jq j = T j for s j =?1: () From the construction of a normal QR decomposition, it is clear that, while making the matrix A upper triangular, this \freezes" only one matrix Q i per matrix A i. The remaining unitary matrix leaves enough freedom to nally diagonalize the matrix A as well. Since meanwhile we computed the singular values of (1), it is clear that such a result can only be obtained by an iterative procedure. On the other hand, one intermediate form that is used in the Golub-Kahan SVD algorithm [] is the bidiagonalization of A and this can be obtained in a nite recurrence. We show in the next section that the matrices Q i in () can be constructed in a nite number of steps in order to obtain a bidiagonal Q K AQ 0 in (). In carrying out this task one should try to do as much as possible implicitly. Moreover, one would like the total complexity of the algorithm to be comparable to { or less than { the cost of K singular value decompositions. This means that the complexity should be O(Kn ) for the whole process. Implicit bidiagonalization We now derive such an implicit reduction to bidiagonal form. Below H(i; j) denotes the group of Householder transformations having (i; j) as the range of rows/columns they operate on. Similarly G(i; i + 1) denotes the group of Givens transformations operating on rows/columns i and i + 1. We rst consider the case where all s i = 1. We thus only have a product of matrices

A i and in order to illustrate the procedure we show its evolution operating on a product of matrices only, i.e. A A A 1. Below is a sequence of \snapshots" of the evolution of the bidiagonal reduction. Each snapshot indicates the pattern of zeros ('0') and nonzeros ('x') in the three matrices. First perform a Householder transformation Q (1) 1 H(1; n) on the rows of A 1 and the columns of A. Choose Q (1) 1 to annihilate all but one element in the rst column of A 1 : : Then perform a Householder transformation Q (1) H(1; n) on the rows of A and the columns of A. Choose Q (1) to annihilate all but one element in the rst column of A : : Then perform a Householder transformation Q (1) H(1; n) on the rows of A. Choose Q (1) to annihilate all but one element in the rst column of A : : Note that this third transformation yields the same form also for the product of the three matrices : = At this stage we are interested in the rst row of this product (indicated in boldface above). This row can be constructed as the product of the rst :

row of A with the matrices to the right of it, and this requires only O(Kn ) ops. Once this row is constructed we can nd a Householder transformation Q (1) 0 H(; n) operating on the last (n? 1) elements which annihilates all but two elements : A (1; :)A A 1 Q (1) 0 = h x x 0 0 0 i : () This transformation is then applied to A 1 only and this completes the rst stage of the bidiagonalization since x x 0 0 0 Q (1) K AQ(1) 0 = : Now perform a Householder transformation Q () 1 H(; n) on the rows of A 1 and the columns of A. Choose Q () 1 to annihilate all but two elements in the second column of A 1 : Then perform a Householder transformation Q () H(; n) on the rows of A and the columns of A. Choose Q () to annihilate all but two elements in the second column of A : : Then perform a Householder transformation Q () H(; n) on the rows of A and choose it to annihilate all but two elements in the second column of A : :

For the product we know that : = x x 0 0 0 At this stage we are interested in the second row of this product (indicated in boldface above). This row can be constructed as the product of the second row of A with the matrices to the right of it, and this again requires only O(K(n?1) ) ops. Once constructed we can nd a Householder transformation Q () 0 H(; n) operating on the last (n? ) elements which annihilates all but two elements : A (; :)A A 1 Q () 0 = h 0 x x 0 0 i : () This transformation is then applied to A 1 only, completing the second step of the bidiagonalization of A : x x 0 0 0 0 x x 0 0 Q () K Q(1) K AQ(1) 0 Q() 0 = : It is now clear from the context how to proceed further with this algorithm to obtain after n? 1 stages : x x 0 0 0 0 x x 0 0 = 0 0 x x 0 0 0 0 x x 0 0 0 x x 0 0 0 x x 0 0 0 0 x 0 0 0 0 x 0 0 0 0 x 0 0 0 x x 0 0 0 0 x Note that we never construct the whole product A = A A A 1, but rather compute one of its rows when needed for constructing the transformations Q (i) 0. The only matrices that are kept in memory and updated are the A i matrices and possibly Q K and Q 0 if we require the singular vectors of A afterwards. The complexity of this bidiagonalization step is easy to evaluate. Each matrix A i gets pre and post multiplied with essentially n Householder transformations of decreasing range. For updating all A i we therefore need : :

Kn = ops, and for updating Q K and Q 0 we need n ops. For constructing the required row vectors of A we need (K? 1)n = ops. Overall we thus need Kn ops for the construction of the triangular T i and n for the outer transformations Q K and Q 0. Essentially this is n ops per updated matrix. If we now have some of the s i =?1 we can not use Householder transformations anymore. Indeed in order to construct the rows of A when needed, the matrices A?1 i have to be triangularized rst, say with a QR factorization. The QR factorization is performed in an initial step. From there on the same procedure is followed, but using Givens rotations instead of Householder transformations. The use of Givens rotations allows us to update the triangularized matrices A?1 i while keeping them upper triangular. Each time a Givens rotation destroys this triangular form, another Givens rotation is applied to the other side of that matrix in order to restore its triangular form. The same technique is for instance used in keeping the B matrix upper triangular in the QZ algorithm applied to B?1 A. The bookkeeping of this algorithm is a little more involved and so are the operation counts, which is why we do not develop this here. One shows that when there are inverses involved, the complexity of the bidiagonalization step amounts to less than n ops per updated matrix. Computing the singular values In the previous section we showed how to obtain an estimate of a bidiagonal decomposition of the matrix product/quotient. We now turn to the problem of obtaining accurate estimates of the singular values. This warrants a discussion of the errors committed in the bidiagonalization step. The use of Householder and Givens transformations for all operations in the bidiagonalization step guarantees that the obtained matrices T i in fact correspond to slightly perturbed data as follows : T i = Q i (A i + A i )Q i?1 ; s i = 1; T j = Q j?1(a j + A j )Q j ; s j =?1; () where ka i k c n ka i k ; kq i Q i? I n k d n ; () with the machine precision and c n ; d n moderate constants depending on the problem size n. This is obvious since each element transformed to zero can indeed be put equal to zero without aecting the bound (see [8], []).

The situation is dierent for the elements of A since they are not stored explicitly in the computer. How does one proceed further to compute the generalized singular values of A? Once the triangular matrices T i are obtained, it is easy and cheap to reconstruct the bidiagonal : T s k K : : : T s T s 1 1 = B = q 1 e o 1; : : : o 1;n q e.......... on?;n... en q n ; (8) and then compute the singular values of the bidiagonal in a standard way. The diagonal elements q i are indeed just a product of the corresponding diagonal elements of the T j matrices, possibly inverted : q i = t s K Ki;i : : : t s i;i t s 1 1 i;i ; and the o diagonal elements e i can be computed from the corresponding diagonal blocks (with index i? 1 and i) of the T j matrices. It is clear that the q i can be computed in a backward stable way since all errors can be superposed on the diagonal elements t ji;i of the matrices T j. For the errors incurred when computing the e i one needs a more detailed analysis. We show below that the backward errors can be superposed on the o-diagonal elements t ji?1;i of T j, without creating any conicts with previously constructed backward errors, and we derive bounds for these backward errors. From the vector recurrence " e q # := " t ji?1;i?1 t ji?1;i 0 t ji;i # sj " we easily derive the following algorithm used for computing q i and e i for i = 1; : : : ; n. q := 1; e := 0; for j = 1 : K if s j = 1 then e := e t ji?1;i?1 + q t ji?1;i ; q := q t ji;i ; else q := q=t ji;i ; e := (e? q t ji?1;i )=t ji?1;i?1 ; end q i := q; e i := e; e q # (9) 8

Note that for i = 1 the same recurrence holds without the expressions involving e. From these recurrences it is clear that the calculation of q i involves 1 op per step j and hence a total of K rounding errors which can be superposed on the diagonal elements t ji;i : q i = comp(t s K Ki;i : :t s 1 1 i;i ) = t s K Ki;i : :t s 1 1 i;i with t ji;i = t ji;i (1 + i;j ); j i;j j < (10) with comp denoting a oating point operator. For the calculation of e i there are ops per step j and hence a total of K roundings which have to be superposed on the t ji?1;i elements. Fortunately, e j is a sum of K terms which contain each a dierent elements t ji?1;i as a factor. We illustrate this for K = and s j = 1, highlighting the relevant elements : e i = comp(t i?1;i :t i;i :t i;i :t 1i;i +t i?1;i?1 :t i?1;i :t i;i :t 1i;i +t i?1;i?1 :t i?1;i?1 :t i?1;i :t 1i;i +t i?1;i?1 :t i?1;i?1 :t i?1;i?1 :t 1i?1;i ) (11) The K rounding errors can thus easily be superposed on these dierent elements t ji?1;i ; j = 1; : : : ; K. But since we have already superposed errors on the all diagonal elements t ji;i we have to add these perturbations here as well to make everything consistent. For s j = 1 we thus have : e i = t i?1;i :t i;i :t i;i :t 1i;i + t i?1;i?1 :t i?1;i :t i;i :t 1i;i + t i?1;i?1 :t i?1;i?1 :t i?1;i :t 1i;i + t i?1;i?1 :t i?1;i?1 :t i?1;i?1 :t 1i?1;i where (K? 1) additional rounding are induced for each factor. Therefore we have t ji?1;i = t ji?1;i (1 + i;j ); j i;j j < (K? 1)=(1? (K? 1)). When some of the s j =?1 the above expression is similar : the t ji;i then appear as inverses, some + signs change to? signs and an additional factor 1=t ji?1;i?1 t ji;i appears in the j-th term if s j =?1. The obtained bound is then j i;j j < (K + 1)=(1? (K + 1)). In the worst case the errors yield a backward perturbation kt j k which is thus bounded by KkT j k and hence much smaller than the errors A j incurred in the triangularization process. The perturbation eect of computing the elements q i and e i is thus negligible to that of the triangularization. We thus showed that the computed bidiagonal corresponds exactly to the bidiagonal of the product of slightly 9

perturbed triangular matrices T j, who in turn satisfy the bounds (,). Unfortunately, nothing of the kind can be quaranteed for the elements o i;j in (8), who are supposed to be zero in exact arithmetic. Notice that the element e i+1 is obtained as the norm of the vector on which a Householder transformation is applied : je i+1 j = kt s K K (i; i : n)t s K?1 K?1 (i : n; i : n) : : : T s 1 1 (i : n; i + 1 : n)k: If all s i = 1 we can obtain by straightforward perturbation results of matrix vector products, a bound of the type jo i;j j c n kt K (i; i : n)k kt K?1 (i : n; i : n)k : : : kt 1 (i : n; i : n)k: If not all s i = 1 we need to use as well perturbation results of solutions of systems of equations, since we need to evaluate the last n? i components of the vector e T i T s K K (i : n; i : n)t s K?1 K?1 (i : n; i : n) : : : T s 1 1 (i : n; i : n) and this requires a solution of a triangular system of equations each time a power s j =?1 is encountered. In such case the bound would become jo i;j j c n kt s K K (i; i : n)k kt s K?1 K?1 (i : n; i : n)k : : : kt s 1 1 (i : n; i : n)k; where is the product of all condition numbers of the inverted triangular systems (and hence much larger than 1). These are much weaker bounds than asking the o diagonal elements of A to be smaller that the ones on the bidiagonal. This would be the case e.g. if instead we had : jo i;j j c n kt s K K (i; i : n)t s K?1 K?1 (i : n; i : n) : : : T s 1 1 (i : n; i + 1 : n)k = c nje i+1 j: Such a bound would guarantee high relative accuracy in the singular values computed from the bidiagonal only, [10]. Hence, this is the kind of result one would hope for. These two bounds can in fact be very dierent when signicant cancellations occur between the individual matrices, e.g. if kak << ka s K K k : : : ka s k kas 1 1 k: One could observe that the bidiagonalization procedure is in fact a Lanczos procedure []. Therefore there is a tendency to nd rst the dominant directions of the expression A s K K : : : A s 1 1 and hence also those directions where there is less cancellations between the dierent factors. We will see in the examples below that such a phenomenon indeed occurs which is a plausible explanation for the good accuracy obtained. One way to test the 10

performance of the algorithm in cases with very small singular values is to generate powers of a symmetric matrix A = S K. The singular values will be the powers of the absolute values of the eigenvalues of S : i (A) = j i (S)j K ; and hence will have a large dynamic range. The same should be true for the bidiagonal of A and the size of the o i;j will then become critical for the accuracy of the singular values when computed from the bidiagonal elements q i ; e i. This, and several other examples, are discussed in the next section. There we observe a very high relative accuracy even for the smallest singular values. The only explanation we can give for this is that as the bidiagonalization proceeds, it progressively nds the largest singular values rst and creates submatrices that are of smaller norm. These then do not really have cancellation between them, but instead the decreasing size of the bidiagonal elements is the result of decreasing elements in each transformed matrix A i. In other words, a grading is created in each of the transformed matrices. We believe this could be explained by the fact that the bidiagonalization is a Lanczos procedure and that such grading is often observed there when the matrix has a large dynamic range of eigenvalues. In practice it is of course always possible to evaluate bounds for the elements jo i;j j and thereby obtain estimates of the accuracy of the computed singular values. The consequence of the above is that the singular values of such sequences can be computed (or better, \estimated") at high relative accuracy from the bidiagonal only! Notice that the bidiagonalization requires Kn ops but that the subsequent SVD of the bidiagonal is essentially free since it is O(n ). Singular vectors and iterative renement If one wants the singular vectors as well as the singular values at a guaranteed accuracy, one can start from the bidiagonal B as follows. First compute the bidiagonal : B = Q K AQ 0 = T s K K : : : T s T s 1 1 ; and then the SVD of B : B = UV ; where we choose the diagonal elements of to be ordered in decreasing order. We then proceed by propagating the transformation U (or V ) and 11

updating each T i so that they remain upper triangular. Since the neglected elements o i;j were small, the new form : ^Q K A s ^Q0 = ^T K s K : : : ^T s ^T 1 1 will be upper triangular, and nearly diagonal. This is the ideal situation to apply one sweep of Kogbetliantz's algorithm. Since this algorithm is quadratically convergent when the diagonal is ordered [], one sweep should be enough to obtain -small o diagonal elements. The complexity of this procedure is as follows. If we use only Givens transformations we can keep all matrices upper triangular by a subsequent Givens correction. Such a pair takes n ops per matrix and we need to propagate n = of those. That means n per matrix. The cost of one Kogbetliantz sweep is exactly the same since we propagate the same amount of Givens rotations. We arrive thus at the following total count for our algorithm : Kn for triangularizing A i! T i n for constructing Q K and Q 0 8n for computing U and V Kn for updating T i! ^Ti Kn for one last Kogbetliantz sweep. The total amount of ops after the bidiagonalization is thus comparable to applying Kogbetliantz sweeps, whereas the Jacobi like methods typically require to 10 sweeps! Moreover, this method allows to select a few singular values and only compute the corresponding singular vectors. The matrices Q K and Q 0 can be stored in factored form and inverse iteration performed on B to nd its selected singular vector pairs, and then transformed back to pairs of A using Q K and Q 0. Numerical examples Computing the SVD of a general product/quotient of matrices is, as suggested above, a delicate numerical problem. In this section we analyze the accuracy of the QR-like algorithm described in this paper using several examples of varying degree of diculty. The examples are chosen in order to illustrate the following points already discussed in the paper. a Implicit methods are more reliable than explicit methods. This is of course well-known, but we illustrate it with some striking examples. 1

b The bidiagonal computed by the QR-like method yields singular values computed to high relative accuracy even when their dynamical range is very big. c The bidiagonal has a typical `graded' structure when the singular values have a wide dynamical range and its `o-bidiagonal' elements are negligible with respect to the bidiagonal elements in the same row. This is due to its connection to the Lanczos procedure as discussed earlier. d The connection with the Lanczos procedure also allow us to terminate the bidiagonalization early and yet have a good estimate of the dominant singular values. Points a to d illustrate the good (relative) accuracy that can be obtained from this procedure even without using iterative renement based on Kogbetliantz's algorithm. The following points now compare the QR-like and Kogbetliantz approaches. e The bidiagonalization and Kogbetliantz methods have comparable accuracy in `dicult' examples with strong cancellation in the product/quotient. f The typical number of Kogbetliantz steps ( to 10) needed for convergence yields a much slower method than mere bidiagonalization. Moreover, the results are comparable, even when the Kogbetliantz iteration is continued further. g The accuracy obtained from the bidiagonal only is already better on average than that of Kogbetliantz. These points illustrate the power of this QR-like method. Note that in all examples we use only the basic part of the algorithm, without the iterative renement step. All calculations were carried out in MATLAB on a Silicon Graphics Indigo workstation with IEEE standard (machine accuracy 10?1 ). For computing the singular values of the computed bidiagonal we use the method due to Fernando and Parlett []. a. Implicit versus explicit. Let us consider the following products : A 1 [n; m] = T m n 1

10 0 a: Accuracy singular values. 10 0 b: Accuracy singular vectors. relative error 10 0 10 0 max abs error 10 10 10 10 0 10 0 10 0 10 0 10 0 c: Accuracy singular value. 10 10 10 0 10 0 10 0 10 0 10 0 d: Accuracy singular vectors. 10 0 relative error 10 0 10 10 max abs error 10 10 10 10 0 10 0 10 10 10 0 10 10 10 0 10 0 10 10 10 0 10 10 Figure 1: The relative accuracy obtained by computing the SVD for the explicitly formed product of Toeplitz matrices. In gures a and b dotted, dashed and solid lines correspond to A 1 [n; m] for n = 10 & m f8; 1; g respectively; in gures c and d: n f10; 0; 0g & m = 8. where T n is a n n symmetric Toeplitz matrix whose rst column is [;?1; 0; 0; ; 0]. Since it only contains integers we can form these powers of T n without any rounding errors, which is important for our comparison. The accuracy obtained by computing the SVD of this explicitly formed product is displayed in Figure 1. The interpretation of the gure is as follows. Subplots a & b correspond to n = 10 and m f8; 1; g; whereas subplots c & d correspond to n f10; 0; 0g and m = 8. The associated results are indicated by the solid, dashed and dotted lines respectively. In subplots a & c we plot the relative accuracy of the singular values as a function of the actual magnitude of the singular value. The lines interpolate the observed relative accuracies, that is the values j i? ^ i j= i : In subplots b & d we plot the maximum absolute error in the left singular vector elements, that is max j [ju ji? ^u ji j]; with u ji being the elements of the i'th singular vector, also 1

10 1 a: Accuracy singular value. 10 1 b: Accuracy singular vector. relative error 10 1 max abs error 10 1 10 0 10 0 10 0 10 0 c: Accuracy singular value. 10 1 10 1 10 0 10 0 10 0 10 0 d: Accuracy singular vector. 10 1 relative error 10 1 10 1 max abs error 10 1 10 1 10 0 10 10 10 0 10 10 10 1 10 0 10 10 10 0 10 10 Figure : Relative accuracy of the SVD estimate obtained by the QR-like algorithm for the product of Toeplitz matrices. In gures a and b dotted, dashed and solid lines correspond to A 1 [n; m] for n = 10 & m f8; 1; g respectively; in gures c and d: nf10; 0; 0g & m = 8. as a function of the magnitude of the corresponding singular value. From the gure it is clear that the relative accuracy of the computed decomposition is quickly lost as we form powers of the matrix. Moreover, the situation is aggravated as we increase the dimension, and hence the condition number, of the matrix. The explanation lies of course in the fact that roundo errors in a matrix A are typically proportional to jjajj. For the product A 1 [n; m] this tends to have a catastrophic eect on the accuracy of the smallest singular values since they are smaller than jja 1 jj. Let us now use the QR-like SVD algorithm. The result is shown in Figure and illustrates that we have obtained a relative accuracy which is essentially independent of the magnitude of the associated singular value. This shows the need for implicit methods. b. Relative accuracy of implicit methods. 1

10 1 a: Accuracy singular value. 10 1 b: Accuracy singular vector. relative error 10 1 max abs error 10 1 10 1 10 0 10 0 c: Accuracy singular value. 10 1 10 1 10 0 10 0 d: Accuracy singular vectors. 10 1 relative error 10 1 10 1 max abs error 10 1 10 1 10 1 10 0 10 0 10 0 10 0 10 1 10 0 10 0 10 0 10 0 Figure : Relative accuracy of the SVD estimate obtained by the QR-like algorithm for the product of non-symmetric matrices. In gures a and b dotted, dashed and solid lines correspond to A [n; m] for n = 10 & m f8; 1; g respectively; in gures c and d: n = f10; 0; 0g & m = 8. A non-symmetric example along the same vein is given in Figure. The interpretation of the gure is as for Figure, but now we consider the product : A [n; m] = (D n D T n ) m : Thus there are m matrices in the matrix product. The matrix D n is obtained by explicitly forming : D n U n (1 : n; 1 : n) V T n ; where the matrices U n and V n are randomly chosen orthogonal matrices. Furthermore, is a diagonal matrix with diagonal : 1

coefficient magnitude 10 10 10 0 10 10 10 0 a: Magnitude bidiagonal. 10 0 0 10 1 0 bidiagonal row coefficient magnitude 10 0 10 10 10 0 10 0 10 0 10 0 b: Magnitude bidiagonal. 10 0 0 10 1 0 bidiagonal row Figure : Grading in the bidiagonal decomposition computed by the QR-like algorithm. Figure a corresponds to A 1 [0; 1] and b to A [0; 1]. The ()'s show the magnitude of the diagonal coecients, the (o)'s the magnitude of the upper bidiagonal coecients. [1; :99; :9; :8; :; :; :; :; :; :] [1; 10?1 ; 10? ; ; 10?10 ]: The motivation for choosing the product in this way is that we obtain an example in which the matrices involved are non-symmetric, and for which we `know' the actual singular values and can examine the obtained relative accuracy. The result is much as above. Using the implicit procedure for computing the singular values returns singular values whose relative accuracies are rather insensitive to the actual magnitude of the corresponding singular value. c. Graded bidiagonal. That the merits of the algorithm can be understood in terms of the Lanczos connection is conrmed by the next example explained in Figure. Here we have plotted the magnitude of the coecients of the computed bidiagonal for the products A 1 [0; 1] and A [0; 1], respectively in subplots a & b. The ()'s show the absolute values of the diagonal coecients and the (o)'s the absolute values of the upper bidiagonal coecients in the computed bidiagonal. We see that in both cases a grading has indeed been obtained. The algorithm picks out the dominant directions rst, leading to a grading in the computed decomposition. The `eective condition number' of remaining subproblems are therefore successively reduced, and the associated singular values can apparently be obtained with high relative accuracy. 1

10 1 a: Accuracy bidiagonal. 10 1 b: Accuracy bidiagonal. relative error 10 1 10 1 10 1 relative error 10 1 10 1 10 1 0 10 1 0 /row # 10 1 0 10 1 0 /row # Figure : Accuracy of the bidiagonal () and of the computed singular values (o). Figure a corresponds to A 1 [0; 1] and b to A [0; 1]. The high accuracy obtained above suggests that the `o-bidiagonal' elements in the transformed product are indeed small relative to the bidiagonal. This is conrmed by the next gure. In Figure we plot, indicated by (), the norm of the o-bidiagonal elements normalized by the norm of the bidiagonal elements. That is, after the transformation to upper triangular form we explicitly form the product of the matrices in the product and compute for each row j, jjo j;(j+):n jj=jjo j;j:(j+1) jj, with o i;j being the elements in the computed product. In exact arithmetics this quantity should be zero. The (o)'s in the gure are the relative accuracies in the computed singular values. Note that the grading and relative smallness of the o-bidiagonal elements makes it possible to compute even the smallest singular values with high relative accuracy. d. Dominant singular value. A consequence of the Lanczos connection is furthermore that we can obtain good estimates for the dominant singular values of the product without computing the full bidiagonal. This is illustrated in Figure. Here we plot the estimate of the dominant singular value we obtain by computing the corresponding singular value for the leading parts of the computed bidiagonal, ^B(1 : i; 1 : i). We plot the relative accuracy of this estimate as a function of i in gures a and b, corresponding to the products A 1 [80; 1] and A [80; 1] respectively. The plots show that we need only compute a part of the bidiagonal in order to obtain a good estimate of the dominant singular value. 18

10 0 a: Accuracy singular value. 10 0 b: Accuracy singular value. relative accuracy 10 10 10 relative accuracy 10 10 10 10 0 0 10 0 0 iteration 0 10 0 0 iteration Figure : Accuracy of estimate of dominant singular value obtained from leading part of computed bidiagonal. Figure a corresponds to A 1 [80; 1] and b to A [80; 1]. e. Examples with strong cancellation. Here we consider examples with a signicant cancellation in the product. That is, a subsequence of the matrices in the product is associated with a large dynamic range relative to that of the product whose associated singular values might be only mildly, or not at all, graded. The following example illustrates this : A [10; m] = D m 10 D?m 10 A [10; m] = (D 10 D?1 10 )m : In Figure subplots a & b correspond to the `vicious' product, that is A, and c & d to its `nice' counterpart A. For the various product sizes we plot the maximum relative error over the computed singular values. We do so as a function of the `product condition number', dened as the product of the condition numbers of the matrices involved, in this case m D. In subplots a & c we let n = 10 and m f; ; 8; 1; ; g, whereas in subplots b & d we let n f10; 1; 18; ; ; 0g and m = 8. Note that for both of the above matrix products the `product condition number' is much bigger than its actual condition number. Subplots a & b show that for the matrix products which are associated with a signicant cancellation there is a loss in relative accuracy. The (o)'s in the plot correspond to computing the decomposition by the Kogbetlianz algorithm, xing the number of sweeps to 1 to avoid issues of convergence tests. Note that the accuracy obtained thereby is not 19

10 0 a: Accuracy singular value. 10 0 b: Accuracy singular value. max relative error 10 10 10 max relative error 10 10 10 10 1 10 0 10 0 10 100 product condition number c: Accuracy singular value. 10 1 10 0 10 0 product condition number d: Accuracy singular value. max relative error 10 1 10 1 max relative error 10 1 10 0 10 0 10 100 product condition number 10 1 10 0 10 0 product condition number Figure : Computation of the SVD of matrix products exhibiting cancellation with respectively the QR-like () and Kogbetlianz (o) algorithms. Figures a and b correspond to A [n; m] and c and d to A [n; m]. In a and c: n = 10 & m f; ; 8; 1; ; g ; in b and d: n f10; 1; 18; ; ; 0g & m = 8. much better than that obtained by the bidiagonalization part of the QR-like algorithm, that is without iterative renement. f. Convergence and complexity. Finally, we turn to the special but important case when m = and compare the performance of the algorithm with that of the Kogbetlianz algorithm. In Figures 8a & 8b we consider the product A [0; 1]. The dashed lines correspond to the relative accuracy obtained by ; ; and 10 sweeps of the Kogbetliantz algorithm. The relatively slow convergence of some singular values corresponds to those being closely spaced. Note that even 10 sweeps of Kogbetlianz's algorithm do not return an approximation with accuracy beyond that obtained by the product SVD algorithm without iterative renement as shown by the solid line. 0

10 0 a: Accuracy singular values. 10 0 b: Accuracy singular vector. relative error 10 10 10 max abs error 10 10 10 10 0 10 10 10 10 0 10 0 10 10 10 10 0 Figure 8: Convergence of Kogbetliantz algorithm, computing the SVD of tha pair of matrices dened by A [0; 1]. g. Comparison of accuracy. The two plots in Figure 9 are obtained as follows. We consider the products dened by : A [n; ] = N n N 0 n with N n being an n n random matrix whose coecients are normally distributed. Moreover n f0; 0; 0; 80g. Let ^ i and ~ i represent the estimates of the singular values associated with respectively the QR-like and the Kogbetliantz algorithms. In the latter case we used 10 sweeps, whereas in the former we did not include iterative renement. Similarly let ^u ij and ~u ij represent the coecients in the left singular vectors. We then plot the ratio max i [j i? ~ i j]=max i [j i? ^ i j] in Figure 9a and the ratio max ij [ju ij? ~u ij j]=max ij [ju ij? ^u ij j] in Figure 9b. The (+)'s correspond to dierent realizations of the matrix N n. We see that the QR-like algorithm typically yields a more accurate approximation, despite its lower computational cost. Concluding remarks The algorithm presented in this paper nicely complements the unitary decompositions for sequences of matrices dened for the generalized QR [] and Schur decompositions [1]. These decompositions nd applications in sequences of matrices dened from discretizations of ordinary dierential 1

10 a: Accuracy singular values. 10 1 b: Accuracy singular vectors. error ratio 10 1 10 0 error ratio 10 0 10 1 0 0 0 80 matrix dimension 10 1 0 0 0 80 matrix dimension Figure 9: Comparison of accuracy of computed SVD obtained respectively by the QR-like and the Kogbetliantz algorithms for the square of a collection of random matrices. equations occurring for instance in two point boundary value problems [9] or control problems [1]. We expect they will lead to powerful tools for analyzing as well as solving problems in these application areas. We want to stress here that in all examples it turned out to be sucient to compute the bidiagonal B of the expression A s K A s 1 and then the singular values of B, without any further iterative renement. This is rather surprising. The bounds obtained on the accuracy of the bidiagonal are much worse than what was observed in the examples. This point and the connection to the Lanczos process need further analysis. That we get accurate approximations for the leading order bidiagonals might be useful when solving ill-post or inverse problems. The main advantage of this method lies exactly in the fact that this bidiagonal is so accurate. If no iterative renement is needed, then the method outperforms Kogbetliantz with a factor to 10! If iterative renement is needed then this method should still be superior since the work then amounts essentially to the work of two Kogbetliantz steps. Finally, we point out that there is recent work on computing singular values to high relative accuracy via the Kogbetliantz algorithm. This work is based on extracting particular scalings from the factors. So far this has been applied to problems involving three factors only. Extensions to several matrices and whether these methods perhaps could be combined with the bidiagonal approach in an advantageous way are still open problems. Those methods and the ideas developed in this paper are, we believe, related. In

both methods grading in the factors, obtained either explicitly or implicitly, is important. Acknowledgements G. Golub was partially supported by the National Science Foundation under Grants DMS-91019 and DMS-90899. K. Slna was partially supported by the Norwegian Council for Research. P. Van Dooren was partially supported by the National Science Foundation under Grant CCR-9099. References [1] A. Bojanczyk, G. Golub and P. Van Dooren, The periodic Schur form. Algorithms and Applications, Proceedings SPIE Conference, pp. 1-, San Diego, July 199. [] B. De Moor and P. Van Dooren, Generalizations of the singular value and QR decomposition, SIAM Matr. Anal. & Applic. 1, pp 99-101, 199. [] G. Golub and V. Kahan, Calculating the singular values and pseudoinverse of a matrix. SIAM Numer. Anal., pp 0-, 19. [] G. Golub and C. Van Loan, Matrix Computations rd edition, The Johns Hopkins University Press, Baltimore, Maryland, 199. [] J.P. Charlier and P. Van Dooren, On Kogbetliantz's SVD algorithm in the presence of clusters. Linear Algebra & Applications 9, pp 1-10, 198. [] K. V. Fernando and B. N. Parlett, Accurate singular values and dierential qd algorithms. Numerische Mathematik, pp 191-9, 199. [] C. Moler and G. Stewart, An algorithm for the generalized matrix eigenvalue problem, SIAM Numer. Anal. 10, pp 1-, 19. [8] J. H. Wilkinson, The algebraic eigenvalue problem, Clarendon press, Oxford, 19. [9] R. Mattheij and S. Wright, Parallel stable compactication for ODE with parameters and multipoint conditions, Int. Rept. Argonne Nat. Lab., IL, 199.

[10] J. Demmel, M. Gu, S. Eisenstat, I. Slapnicar and K. Veselicand, Computing the Singular Value Decomposition with High Relative Accuracy, (UT-CS-9-8).