Precept 9: Krylov subspace methods

Task 1: Compute a basis for the Krylov subspace:

$$K_n(A,b) = \{b, Ab, A^2b, \dots, A^{k-1}b \} $$

using the Arnoldi iteration. Your function in Arnoldi step should do one step of the Arnoldi iteration, and fit into the (already written) Arnoldi iteration.

Recall the Arnoldi iteration: gs1

Task 2: GMRES

Using your Arnoldi step function, write a GMRES solver:

gs1

Also compute the residual at each step and return it along with the last iterate. Although step n of GMRES can be computed in O(n^2), you can use a O(n^3) solver for the QR factorization (use `np.linalg.qr')