Please answer the following questions in complete sentences in a typed, clearly prepared manuscript and submit the solution by the due date on Blackboard (Monday, November 13th, 2017, around 4-5 am)
Please identify anyone, whether or not they are in the class, with whom you discussed your homework. This problem is worth 1 point, but on a multiplicative scale.
Make sure you have included your source-code and prepared your solution according to the most recent Piazza note on homework submissions.
Implement a CG method based on the Lanczos method. That is, implement the Lanczos method to compute the matrix and . Then solve and compute . (All this notation is taken from the CG handout from class, here https://www.cs.purdue.edu/homes/dgleich/cs515-2017/notes/conjugate-gradient.pdf). Show the code for your implementation. At each step, you should compute the normalized residuals.
Compare the first 25 residuals from your Lanczos-based CG code with the a standard implementation of CG from: http://www.cs.purdue.edu/homes/dgleich/cs515-2017/julia/cg.jl for the linear system
n = 100
on = ones(Int64,n)
A = spdiagm((-2*on[1:end-1],4*on,-2*on[1:end-1]),(-1,0,1))
b = ones(n)
Using the cg.jl
function, look at how many iterations are
required for CG to converge to a tolerance of
for the matrix in the last part.
Determine how this scales with .
Let and , , .
Consider the -by- matrix with diagonal elements
(This is called the Strako\v{s} matrix.)
Implement the Lanczos method starting from a a random vector and the vector and then plot the quantity for to . Describe what you SHOULD find and what you actually find. Do your results depend on the starting vector?
Plot for the to . Also plot for to .
What is What should it be?
Plot for to .