a logo for the course

Matrix Computations

David Gleich

Purdue University

Fall 2023

Course number CS-51500

Tuesday-Thursday 1:30-2:45pm. Hampton 2123


Homework 5

Homework 5

Please answer the following questions in complete sentences in a clearly prepared manuscript and submit the solution by the due date on Gradescope, around 4am on Monday November 20nd

Remember that this is a graduate class. There may be elements of the problem statements that require you to fill in appropriate assumptions. You are also responsible for determining what evidence to include. An answer alone is rarely sufficient, but neither is an overly verbose description required. Use your judgement to focus your discussion on the most interesting pieces. The answer to "should I include 'something' in my solution?" will almost always be: Yes, if you think it helps support your answer.

Problem 0: Homework checklist

Problem 1: Updating factorizations of linear systems of equations

In class, we showed how to solve when given a fast factorization method to solve . In this problem, we will address the question of how to update the factorization itself. Suppose that we are given a Cholesky factorization of as we saw in class. Show how to update this factorization to produce . Your algorithm should do no more than work.

Problem 2: Matrix functions in practice

In general, we don't compute Matrix functions by taking their eigenvalues and applying a function to their eigenvalues -- this is just a nice theory that works to explain what's going on in the simple case.

Instead, we create customized algorithms to compute a function of a matrix. One such algorithm that computes the cosine of a matrix was proposed by Serbin and Blalack and analyzed by Higham and Smith in 2003 https://login.ezproxy.lib.purdue.edu/login?url=https://link.springer.com/article/10.1023/A:1026152731904

The idea is that use the cosine double angle formula: combined with some way of estimating . Then, we can compute . Also, for then we should be able to use a simple formula to get a good enough approximation.

  1. Show that the double angle formula holds for symmetric matrices .

  2. In the paper, they show that if , then there is a specific type of approximation of called a Pad\'{e} approxiomation that gives an answer down to machine precision. The specific approximation is

    When applied to a matrix with , this approximation guarantees

    Note that this is a rational function for some polynomials and . One way to evaluate this for a matrix is compute .

    Based on , let's create values and so that Then to evaluate we have the algorithm.

        A2 = A*A
        A4 = A2*A2 
        A6 = A4 * A2
        A8 = A4 * A4
        P = pi0*I + pi2*A2 + pi4*A4 + pi6*A6 + pi8*A8
        Q = mu0*I + mu2*A2 + mu4*A4 + mu6*A6 + mu8*A8
        R = Q\P
    

    Implement this algorithm and show that for matrices where we have the given bound on accuracy. (Instruction note: While I have tried to be careful to check the accuracy of the coefficients, we will verify this ourselves and let you know if there are issues and note any correction to the problem.)

    You may assume that calling in Julia is accurate.

  3. Show how to determine the smallest such that .

  4. Implement the Serbin/Blalack/Higham/Smith procedure to compute , i.e.

    compute m such that ||2^{-m} A||_oo <= 1 
    compute R = r_88(2^{-m} A)
    for i=1:m 
        R = 2*R*R - I 
    end
    return R
    

    For a 1000 by 1000 matrix, compare the runtime to compute via a spectral eigenvalue decomposition.

Problem 3: Weighted orthogonality for SVD.

One possible weighted generalization of the SVD involves producing a factorization where and , where and are symmetric positive definite matrices.

A common theme in solving more advanced problems is converting or translating them into problems that we know how to solve.

Show how to use a standard SVD computation to produce this weighted SVD factorization.

Problem 4: Implementing a rank-k solution update.

Given and an LU factorization of , then updating the solution of a linear system to a new solution can be done fairly efficiently.

Write code or fairly detailed pseudo-code to do this. This uses the Julia factorization F which enables you to solve systems with without recomputing the factorization.

function update(x::Vector, b::Vector, F::LUFact, U::Matrix, V::Matrix)
end

Problem 5: Adding and deleting an equation

Recall that a linear system represents the simultaneously solution of a set of linear equations Consider a set of equations and unknowns with a unique solution for any possible set of values .

Let be an algorithm to solve for when given .

Show how to use in order to solve for in the system of equations That is, we deleted the equation with and added a new equation with instead. If you use \texttt{alg} too many times, you may lose points. Be efficient!

(Hint: this is essentially a special case of other problems on this homework or other things we've seen in class.)

Problem 6: The Krylov subspace and eigenvalue algorithms

In class, we showed that the Krylov subspace: arises when solving via the simple Neumann series method. Here, we note that it also arises in the power-method to identify the largest eigenvalue of a matrix. Note that the simple monomial basis for the Krylov subspace is: In this case, the power-method uses the vector as the estimate of the largest eigenvalue.

  1. State an algorithm to search the Krylov subspace for the largest eigenvalue of a symmetric matrix using the fact that the largest eigenvalue solves the problem: (Note, that you are welcome to use ideas that we discuss in subsequent lectures, but you don't have to. Everything can be done with the material presented through lecture 21.) Note that you may use any routine you want on a -by- matrix.

  2. Implement your algorithm and compare the eigenvalue estimates for a few small matrices. (Hint, a good idea here would be to show convergence plots for the error in the largest eigenvalue compared with iterations -- usually on a log-y-scale.)

  3. Comment on any issues that arise in your implementation.