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

Similar documents
Institute for Advanced Computer Studies. Department of Computer Science. On the Perturbation of. LU and Cholesky Factors. G. W.

Institute for Advanced Computer Studies. Department of Computer Science. On Markov Chains with Sluggish Transients. G. W. Stewart y.

UMIACS-TR July CS-TR 2721 Revised March Perturbation Theory for. Rectangular Matrix Pencils. G. W. Stewart.

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

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

Computation of the mtx-vec product based on storage scheme on vector CPUs

LAPACK-Style Codes for Pivoted Cholesky and QR Updating

Block Bidiagonal Decomposition and Least Squares Problems

(17) (18)

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

14.2 QR Factorization with Column Pivoting

BLAS: Basic Linear Algebra Subroutines Analysis of the Matrix-Vector-Product Analysis of Matrix-Matrix Product

Dense LU factorization and its error analysis

Numerical Linear Algebra

CS412: Lecture #17. Mridul Aanjaneya. March 19, 2015

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

Solving linear equations with Gaussian Elimination (I)

Institute for Advanced Computer Studies. Department of Computer Science. On the Convergence of. Multipoint Iterations. G. W. Stewart y.

ETNA Kent State University

STAT 309: MATHEMATICAL COMPUTATIONS I FALL 2018 LECTURE 9

Last Time. Social Network Graphs Betweenness. Graph Laplacian. Girvan-Newman Algorithm. Spectral Bisection

BlockMatrixComputations and the Singular Value Decomposition. ATaleofTwoIdeas

On Orthogonal Block Elimination. Christian Bischof and Xiaobai Sun. Argonne, IL Argonne Preprint MCS-P

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

Krylov Subspace Methods that Are Based on the Minimization of the Residual

LU Factorization. LU factorization is the most common way of solving linear systems! Ax = b LUx = b

STA141C: Big Data & High Performance Statistical Computing

Contents 1 Introduction 1 Incremental estimators.1 The original incremental condition estimator (ICE) Incremental norm estimation by appr

Main matrix factorizations

Numerical Linear Algebra

Program Lecture 2. Numerical Linear Algebra. Gaussian elimination (2) Gaussian elimination. Decompositions, numerical aspects

QR FACTORIZATIONS USING A RESTRICTED SET OF ROTATIONS

Numerical Methods in Matrix Computations

Perturbation results for nearly uncoupled Markov. chains with applications to iterative methods. Jesse L. Barlow. December 9, 1992.

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

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

Scientific Computing

Linear Algebra (part 1) : Matrices and Systems of Linear Equations (by Evan Dummit, 2016, v. 2.02)

Direct Methods for Solving Linear Systems. Simon Fraser University Surrey Campus MACM 316 Spring 2005 Instructor: Ha Le

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

Solving large scale eigenvalue problems

Abstract The following linear inverse problem is considered: given a full column rank m n data matrix A and a length m observation vector b, nd the be

A fast randomized algorithm for overdetermined linear least-squares regression

Iterative Methods. Splitting Methods

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

Bindel, Fall 2009 Matrix Computations (CS 6210) Week 8: Friday, Oct 17

1 Multiply Eq. E i by λ 0: (λe i ) (E i ) 2 Multiply Eq. E j by λ and add to Eq. E i : (E i + λe j ) (E i )

5.1 Banded Storage. u = temperature. The five-point difference operator. uh (x, y + h) 2u h (x, y)+u h (x, y h) uh (x + h, y) 2u h (x, y)+u h (x h, y)

Course Notes: Week 1

Lecture 4 Orthonormal vectors and QR factorization

Direct Methods for Solving Linear Systems. Matrix Factorization

STAT 309: MATHEMATICAL COMPUTATIONS I FALL 2018 LECTURE 13

The Lanczos and conjugate gradient algorithms

Computational Linear Algebra

AMS526: Numerical Analysis I (Numerical Linear Algebra)

SVD, PCA & Preprocessing

Example: Current in an Electrical Circuit. Solving Linear Systems:Direct Methods. Linear Systems of Equations. Solving Linear Systems: Direct Methods

Arnoldi Methods in SLEPc

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

Numerical Methods. Elena loli Piccolomini. Civil Engeneering. piccolom. Metodi Numerici M p. 1/??

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

1.5 Gaussian Elimination With Partial Pivoting.

Rank revealing factorizations, and low rank approximations

MODULE 7. where A is an m n real (or complex) matrix. 2) Let K(t, s) be a function of two variables which is continuous on the square [0, 1] [0, 1].

Linear Least squares

6.4 Krylov Subspaces and Conjugate Gradients

Applied Linear Algebra in Geoscience Using MATLAB

Subset selection for matrices

MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS. + + x 1 x 2. x n 8 (4) 3 4 2

Linear Solvers. Andrew Hazel

Introduction. Chapter One

An exploration of matrix equilibration

STA141C: Big Data & High Performance Statistical Computing

Krylov Space Methods. Nonstationary sounds good. Radu Trîmbiţaş ( Babeş-Bolyai University) Krylov Space Methods 1 / 17

Parallel Scientific Computing

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

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

Matrix decompositions

ANALYTICAL MATHEMATICS FOR APPLICATIONS 2018 LECTURE NOTES 3

CPE 310: Numerical Analysis for Engineers

problem Au = u by constructing an orthonormal basis V k = [v 1 ; : : : ; v k ], at each k th iteration step, and then nding an approximation for the e

Gradient Method Based on Roots of A

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

PROOF OF TWO MATRIX THEOREMS VIA TRIANGULAR FACTORIZATIONS ROY MATHIAS

Solving Dense Linear Systems I

LINEAR SYSTEMS (11) Intensive Computation

Numerical Methods I Solving Square Linear Systems: GEM and LU factorization

Householder reflectors are matrices of the form. P = I 2ww T, where w is a unit vector (a vector of 2-norm unity)

Numerical Methods - Numerical Linear Algebra

AMS 209, Fall 2015 Final Project Type A Numerical Linear Algebra: Gaussian Elimination with Pivoting for Solving Linear Systems

Applied Numerical Linear Algebra. Lecture 8

Review of matrices. Let m, n IN. A rectangle of numbers written like A =

Matrices, Vector Spaces, and Information Retrieval

Parallel Singular Value Decomposition. Jiaxing Tan

On the loss of orthogonality in the Gram-Schmidt orthogonalization process

Section 3.5 LU Decomposition (Factorization) Key terms. Matrix factorization Forward and back substitution LU-decomposition Storage economization

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

AM205: Assignment 2. i=1

The Solution of Linear Systems AX = B

Matrix Factorizations

Transcription:

University of Maryland Institute for Advanced Computer Studies Department of Computer Science College Park TR{98{12 TR{3875 Two Algorithms for the The Ecient Computation of Truncated Pivoted QR Approximations to a Sparse Matrix G. W. Stewart y ABSTRACT In this note we propose two algorithms to compute truncated pivoted QR approximations to a sparse matrix. One is based on the Gram{Schmidt algorithm, and the other on Householder triangularization. Both algorithms leave the original matrix unchanged, and the only additional storage requirements are arrays to contain the factorization itself. Thus, the algorithms are particularly suited to determining low-rank approximations to a sparse matrix. This report is available by anonymous ftp from thales.cs.umd.edu in the directory pub/reports or on the web at http://www.cs.umd.edu/ stewart/. y Department of Computer Science and Institute for Advanced Computer Studies, University of Maryland, College Park, MD 20742. This work was supported by the National Science Foundation under grant CCR-95-03126.

Two Algorithms for the The Ecient Computation of Truncated Pivoted QR Approximations to a Sparse Matrix G. W. Stewart y Dedicated to Olof Widlund on his sixtieth birthday. ABSTRACT In this note we propose two algorithms to compute truncated pivoted QR approximations to a sparse matrix. One is based on the Gram{Schmidt algorithm, and the other on Householder triangularization. Both algorithms leave the original matrix unchanged, and the only additional storage requirements are arrays to contain the factorization itself. Thus, the algorithms are particularly suited to determining low-rank approximations to a sparse matrix. 1. Introduction Let X be an np matrix with n > p. This paper concerns the approximation of X by a matrix ^X of rank k < p. The most elegant solution to this problem is the truncated singular value approximation which gives an ^X that deviates minimally from X in both the spectral and Frobenius norms. 1 A dierent approximation may be had from the pivoted QR decomposition. This decomposition is a factorization of the form T ; X = Q R 0 where Q is orthogonal, R is upper triangular, and is a permutation matrix that corresponds to column interchanges in X (i.e., pivoting). If we partition 2 X = (Q 11 Q 1;k+1 Q 1;p+1 ) 0 @ R 11 R 1;k+1 0 R k+1;k+1 0 0 1 A T ; (1) This report is available by anonymous ftp from thales.cs.umd.edu in the directory pub/reports or on the web at http://www.cs.umd.edu/ stewart/. y Department of Computer Science and Institute for Advanced Computer Studies, University of Maryland, College Park, MD 20742. This work was supported by the National Science Foundation under grant CCR-95-03126. 1 Since the purpose of this note is to describe rearrangements of two standard algorithms, we assume that the reader is familiar with the basics, which are covered in an excellent book by A. Bjorck [1] 2 In the partitions to follow we use northwest indexing, in which each block has the index of the element in the northwest corner. 1

2 Computing truncated pivoted QR decompositions where R 11 is of order k, then ^X = Q 11 (R 11 R 1;k+1 ) T (2) is a rank k approximation to X with k ^X Xk = krk+1;k+1 k in the spectral and Frobenius norms. If R k+1;k+1 is suciently small, the approximation ^X solves our problem. We will call (2) the truncated pivoted QR approximation to X. The singular value and pivoted QR decompositions loose some of their their appeal when X is large and sparse. The problem is that the conventional algorithms for computing these decomposition proceed by transformations that quickly destroy the sparsity of X. 3 For the singular value decomposition, recourse must be had to iterative approximations. The purpose of this note is to show that the pivoted QR decomposition can be implemented in such a way that the sparsity of X is not compromised. We actually give two algorithms, one based on Gram{Schmidt orthogonalization and the other on Householder triangularization. The key idea of both is to build up the Q-factor column by column and the R-factor row by row, leaving the original matrix X unchanged. Only when a column of X is needed to form a column of Q is it transformed. The Gram{Schmidt variant computes the explicit factorization and is conceptually simpler. The algorithm based on Householder triangularization provides an implicit basis for the orthogonal complement of the column space of the decomposition. Both have essentially the same complexity. 2. The Gram{Schmidt variant Let X = (x 1 x p ) be partitioned by columns, and let X k = (x 1 x k ). Suppose we have computed a QR factorization. X k 1 = Q k 1 R 11 ; where R 11 is upper triangular of order k 1. Then the corresponding QR approximation is where ^X k 1 = Q k 1 (R 11 R 1k ); R 1k = Q T (x k x p ): Now suppose we want to update this approximation to include X k. This can be accomplished by one step of the Gram{Schmidt algorithm: 3 It should be stressed that the problem is not in the lack of sparsity of approximation ^X, which in both approaches is represented economically in factored form.

Computing truncated pivoted QR decompositions 3 Then 1. r 1k = Q T k 1 x k 2. q k = x k Q k 1 r 1k 3. r kk = kq k k 4. q k = q k =r kk. X k = (X k 1 x k ) = (Q k 1 q k )! R (k 1) 11 r 1k 0 r kk (3) is the updated QR factorization. To compute the rest of the approximation, we need only compute the kth row of R, which has the form r T k;k+1 = q T k (x k+1 x p ): (4) This updating procedure is very close to what we promised above. Each step generates a new column of Q and a new row of R. The only part of X that is modied is the column that eventually becomes the new column of Q. The only other use made of X is a vector-matrix product in (4) to ll out the kth row of R. However, there remain two problems. The rst problem is that to get good approximations we must incorporate column pivoting into our algorithm. Specically, at the beginning of the kth stage of the algorithm, we must select the column x j of (x k x p ) for which k(i Q k 1 Q T k 1 )x jk is maximal and interchange it with x k. The computation of (I Q k 1 Q T k 1 )x j for all j k eectively transforms X into a dense matrix. The answer to the this problem lies in the following well-known formula: k(i Q k 1 Q T k 1)x j k = kx j k 2 This formula allows us to downdate the column norms of X as we compute rows of R to give the norms of the projected columns. The second problem is that the Gram{Schmidt algorithms as implemented above is not guaranteed to produce a matrix Q k whose columns are orthogonal to working accuracy. The cure for this problem is a process in which q k is reorthogonalized against the previous q j. The details of this process, which also alters the kth columns of R have been well treated in [1], and we omit them. Figure 1 contains an algorithm implementing this method. The algorithm continues until the projected columns norms, which correspond to the norms of the columns of R k+1;k+1 in (1), become suciently small, at which point the process terminate with the rank k approximation ^X = Q[:; 1:k]R[1:k; 1:p]. For ease of exposition we have made explicit interchanges in X. The only unusual feature is the omission of the step Xk 1 i=1 r 2 ij :

4 Computing truncated pivoted QR decompositions Given an np (n p) matrix X this algorithm returns a truncated pivoted QR decomposition of X. Initially, the matrices Q and R are void. 1. j = kx[:; j]k 2 ; j = 1; : : : ; p 2. Determine an index p 1 such that p1 is maximal 3. for k = 1 to p 4. X[:; k] $ X[:; p k ] 5. R[1:k 1; k] $ R[1:k 1; p k ] 6. Q[:; k] = X[:; k] Q[:; 1:k 1]R[1:k 1; k] 7. R[k; k] = kq[:; k]k 8. Q[:; k] = Q[:; k]=r[k; k] 9. If necessary reorthogonalize Q[:; k] and adjust R[1:k 1; k] 10. R[k; k+1:p] = Q[:; k] T X[:; k+1:p] 11. j = j R[k; j] 2 ; j = k+1; : : : ; n 12. Determine an index p k+1 k+1 such that pk+1 is maximal 13. if ( pk+1 is suciently small) leave k 14. end for k. Figure 1: Truncated pivoted QR factorization: Gram{Schmidt version 1. R[1:k 1; k] = Q[:; 1:k 1] T X[:; k] that corresponds to statement 1 in (3). The reason is that these numbers have already been computed as we have added rows to R. 3. Orthogonal triangularization We now turn to using orthogonal triangularization to compute truncated pivoted QR approximations. We begin with a brief description of how the pivoted QR decomposition is computed via Householder transformations. Before the kth stage of the reduction, we have determined Householder transformations H 1 ; : : : ; H k 1 and a permutation matrix k 1 such that H k 1 H 1 X k 1 = R11 R1k 0 Xkk ; (5) where R 11 is triangular of order k 1. One then determines the column of largest 2-norm of Xkk and swaps it with the rst, along with the corresponding columns of R 1k, to get H k 1 H 1 X k 1 k = R11 R1k ~ 0 Xkk ~ :

Computing truncated pivoted QR decompositions 5 Here k is a permutation matrix representing the interchange of columns. Now a Householder transformation H ~ k = I ~u k ~u T k is determined so that ~H k ~ Xkk = rkk r T k;k+1 0 Xk+1;k+1 If we set u T = (0 k ~ut ), k H k = I u k u T, and k k = k kk, then (5) holds with k advanced by one. If after the kth stage the largest column norm of Xk+1;k+1 is suciently small, we may terminate the procedure with a truncated approximation to X of rank k, in which the matrix Q T is represented as the product H k H 1. In these terms, the pivoting strategy introduced above amounts to pivoting on the column of X for which the corresponding column norm of Xkk is maximal. As above, the square of the norm of the jth column x (kk) j is (ignoring interchanges) given by kx (kk) j k 2 = kx j k 2 If we know the rst k 1 rows of R, we can downdate the column norms of X to give the column norms of Xkk. Moreover to compute the Householder transformation at the kth stage we need only one column from Xk to compute u k. This column can be computed on the spot from the corresponding column of X, used to generate u k, and discarded. Thus there is no need to transform the entire matrix X. These ideas are best implemented using an elegant representation for the product of Householder transformations due to Schreiber and Van Loan [2]. Specically, if we set then k 1 X i=1 U k = (u 1 u k ); r 2 ij : (I u k u T k ) (I u 1 u T 1 ) = U k T T k U T k ; (6) where the unit lower triangular matrix T k can be generated by the following recurrence: T k = Tk 1 T k 1 U T k 1 u k : (7) 0 1 We will call (6) a UTU representation of the product on the left-hand side. If we maintain the pivoted Q-factor of X in UTU form, we can compute the truncated pivoted factorization without modifying X. Specically, suppose that just before the :

6 Computing truncated pivoted QR decompositions Given an np (n p) matrix X this algorithm returns a truncated pivoted QR decomposition of X. The Q-factor is returned in UTU form. Initially the matrices U, T, R, and S are void. 1. j = kx[:; j]k 2 ; j = 1; : : : ; p 2. Determine an index p 1 such that p1 is maximal 3. for k = 1 to p 4. X[:; k] $ X[:; p k ] 5. R[1:k 1; k] $ R[1:k 1; p k ] 6. S[1:k 1; k] $ S[1:k 1; p k ] 7. x = X[:; k] U[:; 1:k 1]T T U[:; 1:k 1] T X[:; k] 8. Determine u from x 9. T = T T U T u 0 1 10. U = (U u) 11. S = S u T X R 12. R = X[k; :] U[k; :]T T S 13. j = j R[k; j] 2 ; j = k+1; : : : ; n 14. Determine an index p k+1 k+1 such that pk+1 is maximal 15. if ( pk+1 is suciently small) leave k 16. end for k Figure 2: Truncated pivoted QR decomposition: UTU version kth step, we have U k 1, T k 1, and an auxiliary matrix S k 1 = U T k 1 X k 1, along with the current downdated column norms of X. Then the pivot column can be determined from the downdated norms. If x denotes the value of this column in the original matrix X, the transformed value can be calculated as x = x U k 1 T T k 1 U T x. From this the k 1 kth Householder vector u k can be computed, and U k 1, T k 1, and S k 1 can be updated. Finally, if u k denotes the kth row of U k and x k denotes the kth row of X, then the kth row of R can be computed in the form x k u k T k S k. From this the new column norms can be computed and the process repeated. The code in Figure 2 implements this sketch. As with the Gram{Schmidt version, the algorithm is quite ecient in terms of both operations and storage. Excepting interchanges, which we have incorporated explicitly to simplify the exposition, the array X is never modied. One column of it is used at each stage to compute the current Householder transformation, and the vector-matrix product u T X must be formed to

Computing truncated pivoted QR decompositions 7 update the auxiliary matrix S. If the additional storage for S is too burdensome, the rows of R may be dropped after they have been used to downdate the column norms, and R can be reconstituted in S when the algorithm terminates. At this time the one may go on to compute the rst k columns of Q explicitly. Alternatively, one can leave the entire matrix Q in UTU form. References [1] A. Bjorck. Numerical Methods for Least Squares Problems. SIAM, Philadelphia, 1996. [2] R. Schreiber and C. F. Van Loan. A storage ecient WY representation for products of Householder transformations. SIAM Journal on Scientic and Statistical Computing, 10:53{57, 1989.