CS 219: Sparse matrix algorithms: Homework 3

Similar documents
7. LU factorization. factor-solve method. LU factorization. solving Ax = b with A nonsingular. the inverse of a nonsingular matrix

Numerical Linear Algebra

9. Numerical linear algebra background

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

LU Factorization. Marco Chiarandini. DM559 Linear and Integer Programming. Department of Mathematics & Computer Science University of Southern Denmark

CS513, Spring 2007 Prof. Amos Ron Assignment #5 Solutions Prepared by Houssain Kettani. a mj i,j [2,n] a 11

Gaussian Elimination without/with Pivoting and Cholesky Decomposition

9. Numerical linear algebra background

Scientific Computing with Case Studies SIAM Press, Lecture Notes for Unit VII Sparse Matrix

GAUSSIAN ELIMINATION AND LU DECOMPOSITION (SUPPLEMENT FOR MA511)

Numerical Methods I: Numerical linear algebra

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)

Scientific Computing

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

CS227-Scientific Computing. Lecture 4: A Crash Course in Linear Algebra

22A-2 SUMMER 2014 LECTURE 5

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

SYMBOLIC AND EXACT STRUCTURE PREDICTION FOR SPARSE GAUSSIAN ELIMINATION WITH PARTIAL PIVOTING

ACM106a - Homework 2 Solutions

CSE 245: Computer Aided Circuit Simulation and Verification

Numerical Linear Algebra

STAT 309: MATHEMATICAL COMPUTATIONS I FALL 2018 LECTURE 13

Linear Algebra Section 2.6 : LU Decomposition Section 2.7 : Permutations and transposes Wednesday, February 13th Math 301 Week #4

AMS526: Numerical Analysis I (Numerical Linear Algebra)

Lecture 12 (Tue, Mar 5) Gaussian elimination and LU factorization (II)

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

Linear Systems of n equations for n unknowns

Engineering Computation

MATH 3511 Lecture 1. Solving Linear Systems 1

AMS526: Numerical Analysis I (Numerical Linear Algebra)

Today s class. Linear Algebraic Equations LU Decomposition. Numerical Methods, Fall 2011 Lecture 8. Prof. Jinbo Bi CSE, UConn

Matrix Multiplication Chapter IV Special Linear Systems

Matrix decompositions

Numerical Linear Algebra

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

Hani Mehrpouyan, California State University, Bakersfield. Signals and Systems

Illustration of Gaussian elimination to find LU factorization. A = a 11 a 12 a 13 a 14 a 21 a 22 a 23 a 24 a 31 a 32 a 33 a 34 a 41 a 42 a 43 a 44

Vector Spaces, Orthogonality, and Linear Least Squares

18.06 Problem Set 2 Solution

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

Review Questions REVIEW QUESTIONS 71

CS 322 Homework 4 Solutions

Pivoting. Reading: GV96 Section 3.4, Stew98 Chapter 3: 1.3

Department of Aerospace Engineering AE602 Mathematics for Aerospace Engineers Assignment No. 4

This can be accomplished by left matrix multiplication as follows: I

EE364a Review Session 7

CSC 336F Assignment #3 Due: 24 November 2017.

y b where U. matrix inverse A 1 ( L. 1 U 1. L 1 U 13 U 23 U 33 U 13 2 U 12 1

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

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

The System of Linear Equations. Direct Methods. Xiaozhou Li.

4 ORTHOGONALITY ORTHOGONALITY OF THE FOUR SUBSPACES 4.1

CSE 160 Lecture 13. Numerical Linear Algebra

Numerical Analysis Fall. Gauss Elimination

Chapter 9: Gaussian Elimination

ANALYTICAL MATHEMATICS FOR APPLICATIONS 2018 LECTURE NOTES 3

MA 138 Calculus 2 with Life Science Applications Matrices (Section 9.2)

1.Chapter Objectives

Cheat Sheet for MATH461

Sparse least squares and Q-less QR

MODEL ANSWERS TO THE FIRST QUIZ. 1. (18pts) (i) Give the definition of a m n matrix. A m n matrix with entries in a field F is a function

ECE133A Applied Numerical Computing Additional Lecture Notes

Lecture 2 INF-MAT : , LU, symmetric LU, Positve (semi)definite, Cholesky, Semi-Cholesky

Linear algebra I Homework #1 due Thursday, Oct Show that the diagonals of a square are orthogonal to one another.

Linear Algebra. Solving Linear Systems. Copyright 2005, W.R. Winfrey

1 Last time: linear systems and row operations

Matrices and systems of linear equations

Matrix decompositions

Chapter 6 - Orthogonality

Direct Methods for Solving Linear Systems. Matrix Factorization

PRACTICE PROBLEMS (TEST I).

Matrix Factorization Reading: Lay 2.5

Find the solution set of 2x 3y = 5. Answer: We solve for x = (5 + 3y)/2. Hence the solution space consists of all vectors of the form

Maths for Signals and Systems Linear Algebra for Engineering Applications

2.1 Gaussian Elimination

Math 4A Notes. Written by Victoria Kala Last updated June 11, 2017

Problem Set # 1 Solution, 18.06

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

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

4 Elementary matrices, continued

18.06 Quiz 2 April 7, 2010 Professor Strang

Linear Equations and Matrix

Math 502 Fall 2005 Solutions to Homework 3

MH1200 Final 2014/2015

Homework 2 Foundations of Computational Math 2 Spring 2019

1.5 Gaussian Elimination With Partial Pivoting.

Lecture 9. Errors in solving Linear Systems. J. Chaudhry (Zeb) Department of Mathematics and Statistics University of New Mexico

The Solution of Linear Systems AX = B

Matrices and Matrix Algebra.

CS 621: Final Exam Solutions

(x 1 +x 2 )(x 1 x 2 )+(x 2 +x 3 )(x 2 x 3 )+(x 3 +x 1 )(x 3 x 1 ).

1 GSW Sets of Systems

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

MTH 464: Computational Linear Algebra

. =. a i1 x 1 + a i2 x 2 + a in x n = b i. a 11 a 12 a 1n a 21 a 22 a 1n. i1 a i2 a in

A Column Pre-ordering Strategy for the Unsymmetric-Pattern Multifrontal Method

Solving linear systems (6 lectures)

Numerical Methods I Non-Square and Sparse Linear Systems

CPE 310: Numerical Analysis for Engineers

Solving Consistent Linear Systems

Transcription:

CS 219: Sparse matrix algorithms: Homework 3 Assigned April 24, 2013 Due by class time Wednesday, May 1 The Appendix contains definitions and pointers to references for terminology and notation. Problem 1: Unsymmetric matrix menagerie. The purpose of this problem is for you to identify a set of a dozen or so unsymmetric matrices that span a range of characteristics, for use in testing and analyzing different approaches to solving unsymmetric linear systems. Explore the Florida sparse matrix collection and choose a set of 10 to 15 matrices. Every matrix in your set should satisfy all the following criteria: 1. square (same number of rows as columns) 2. dimension between 500 and 10000 3. not symmetric 4. full structural rank (sprank(a) == size(a,1)) 5. Matlab can do x = A\b in less than a minute Your set should contain a few matrices of each of the following types: 1. nearly strong Hall (few or one diagonal blocks in dmperm) and diagonally dominant 2. nearly strong Hall and not diagonally dominant 3. far from strong Hall (many diagonal blocks) You can use the Matlab function cs dmspy() to visualize the block triangular form of a matrix and see how nearly strong Hall it is. A good way to look for matrices that are far from strong Hall is to search the Florida collection for matrices with low structural symmetry (say less than 50%). However, be careful that you are only picking matrices with full structural rank; many of the highly nonsymmetric matrices in the collection have less than full rank. Compute the following statistics for each matrix A in your set, and make a table of the results. 1. dimensions: size(a) 2. nonzeros: nnz(a) 1

3. structural symmetry: 4. numeric symmetry: B = A-diag(diag(A)); nnz(b & B )/nnz(b) Asymm = (A+A )/2; Askew = (A-A )/2; (norm(asymm, fro ) - norm(askew, fro )) / norm(a, fro ) 5. number of blocks in Dulmage-Mendelsohn decomposition: [p q r] = dmperm(a); r-1 6. fraction of lower triangle within diagonal blocks: [p q r] = dmperm(a); sum(diff(r).^2) / prod(size(a)) 7. column diagonal dominance: B = abs(a); d = diag(b); min( d./ sum(b-diag(d)) ) 8. row diagonal dominance: B = abs(a ); d = diag(b); min( d./ sum(b-diag(d)) ) Problem 2: Column intersection graph. Let A be n-by-n, square, and nonsingular. See the Appendix for the definition of the column intersection graph G (A). 2a. Suppose A has a triangular factorization A = LU without pivoting; that is, no row or column permutations are needed to avoid dividing by a zero diagonal element during Gaussian elimination. Prove that G(L + U) G + (A); in other words, every directed fill edge that arises in G(L) or G(U) corresponds to an undirected fill edge that arises in the symmetric Cholesky factorization of the column intersection graph G (A). 2

Hint: Play the directed graph game for vertices j = 1 : n on the directed graph G(A), and also play the Cholesky graph game for vertices j = 1 : n on the undirected graph G (A). Proceed by induction on j. 2b. Prove that, if P is any row permutation, G (A) = G (P A); in other words, the column intersection graph is independent of the ordering of the rows of the matrix. Theorem, not proved here: In the absence of numerical cancellation, if A is strong Hall, then for every edge (i, j) with i > j of the filled column intersection graph G + (A), there exists a row permutation P such that U(i, j) is nonzero in the factorization P A = LU. In other words, for strong Hall matrices the upper bound in Problem (2a) on the nonzero structure of U is the tightest possible given only the nonzero structure of A. 2c (extra credit). Exhibit a specific matrix A for which the upper bound G(L + U) G + (A) is not tight for U; that is, G + (A) has an edge (i, j) with i > j, but for every row permuation of A that has a factorization P A = LU, element U(i, j) = 0. Hint: Problem (2a) implies that A cannot be strong Hall (unless there s numerical cancellation). Find a suitable non-strong-hall matrix A such that G (A) is completely nonzero. Problem 3: Orderings for unsymmetric LU factorization. The moral of problem 2 is that a good symmetric permutation for the rows and columns of the (symmetric) matrix A T A (i.e. for the column intersection graph G (A)) might be expected to be a good permutation for just the columns of A, if the rows are going to be permuted unpredictably by numerical partial pivoting. The idea of this problem is to see how well this works for the three different classes of matrices you identified in problem 1. 3a. For this part, use Matlab s [L,U,P] = lu(a(:,q)). This permutes the columns of matrix A according to permutation vector q, and then computes the LU factorization with partial pivoting using the left-looking triangular-solve algorithm presented in class on April 22. Try factoring each of the dozen or so matrices in your test set with each of the following column permutations: 1. q = amd(a *A), which is a good symmetric ordering on G (A). 2. q = colamd(a), which is a similar ordering that Matlab can compute without forming the matrix A T A. 3. q = amd(a A ), which is a symmetric ordering that should be good if only there were no numerical pivoting in the factorization. In this case, you might try using [L,U,P] = lu(a(q,q)) to preserve the diagonal of A. For each experiment, report two complexity results: 1. Number of nonzeros in factors. This is just nnz(l+u). 3

2. Number of flops in factorization. It s not hard to prove (try it!) that the number of nonzero floating-point operations needed to compute the factorization P A = LU is the same as the number of nonzero floating-point operations needed to multiply L by U (to get back P A). We know from Homework 2, problem 1, that this is equal to (nnz(l(:, i)) nnz(u(i, :))). i Can you draw any conclusions about the suitability of different orderings for different classes of nonsymmetric problems? 3b. Repeat the experiment in (3a) above, but use the Matlab call [L,U,P,Q] = lu(a(:,q)). Instead of pure partial pivoting (where the column permutation is for sparsity and the row permutation is for numerics), this uses a more complicated strategy that tries to balance sparsity and numerics in both the row and column permutations. What conclusions can you draw? Problem 4 (extra credit): Block triangular solve. 4a. (See Davis problem 7.4.) Write a Matlab function that solves Ax = b by using the output of dmperm(a) to permute A to block upper triangular form (the same form displayed by cs dmspy(a)), and then doing a block triangular backsolve to get x from b. The block backsolve should use Matlab s backslash operation once for each diagonal block of the permuted matrix. Confirm that your function is correct by comparing its results Matlab s. Hint: In Matlab, if I and J are vectors of indices, then A(I,J) is a submatrix and/or permutation of A with just rows I and columns J in the specified order. With careful use of indexing notation, the block solve routine is only about a dozen lines of Matlab. 4b. Do an experiment similar to (3a) above, evaluating for each matrix the complexity in fill and flops of the factorization. This time, however, you should count fill and flops according to the block triangular form, factoring only the diagonal blocks. Thus, for each matrix and each column ordering method, you will first permute the entire matrix to block triangular form as in (4a); then factor each diagonal block A i = L i U i individually after permuting just the block A i by the chosen column ordering method; then report total fill and total flops as follows. 1. fill: total number of nonzeros in each diagonal block s individual factors L i + U i, plus the total number of nonzeros in all the off-diagonal blocks of the original matrix A. 2. flops: total number of flops to compute all the individual A i = L i U i factorizations. What conclusions can you draw for the various classes of matrices in your test set? Appendix: Definitions and references. A matrix is column diagonally dominant if the absolute value of every diagonal element is larger than the sum of the absolute values of the other elements in its column. 4

The structural rank of a matrix A is the maximum number of nonzeros that can be placed on the diagonal of A by row and column permutations P AQ, or equivalently the size of the largest matching in the bipartite graph of A. See Davis 7.2 and Matlab function sprank(). A square nonsingular n-by-n matrix must have structural rank n, also called full structural rank. The column intersection graph G (A) of an m-by-n matrix A is an undirected graph with n vertices, one for each column of A, with an (undirected) edge (i, j) whenever columns i and j have nonzeros in some common row k. In the absence of numerical cancellation, G (A) is the same as G(A T A), the graph of the symmetric n-by-n matrix A T A. (This is because the (i, j) element of A T A is the dot product of columns i and j of A, which is zero if the nonzero structures of those columns don t intersect.) The definition and an example are in the posted class slides for April 22, though I didn t talk about G (A) in class. The definition works whether or not A is square. The filled column intersection graph G + (A) is the result of playing the Cholesky graph game on G (A); it s also the ordinary filled graph G + (A T A). See April 22 class slides. For block triangular form see Davis 7.3 and Matlab function dmperm(). An m-by-n matrix is strong Hall (see Davis 7.3 and the April 22 class slides) if every set of k columns has nonzeros in at least k + 1 rows, for every k in the range 1 to n 1. A square matrix is strong Hall if it can t be permuted to a nontrivial block triangular form. See Matlab function cs dmspy(). The Dulmage-Mendelsohn decomposition of a matrix is a generalization of block triangular form. See Davis 7.3, Matlab functions dmperm() and cs dmspy(), and the April 22 class slides. Computing the DM decomposition of a matrix amounts to first finding a maximumsize matching in a bipartite graph associated with the matrix, and then finding the strongly connected components of the directed graph of a permuted version of the matrix. 5