Computational Thinking, Linear Algebra, Python, Jupyter Notebook, Math.
q dot q = 1 H[i,j] = np.dot(Q[:,i], v) v = v - (H[i,j] * Q[:,i]) H[j+1,j] = np.linalg.norm(v) Q[:,j+1] = v / H[j+1,j] # printing this to see convergence, would be slow to use in practice print(np.linalg.norm(A @ Q[:,:-1] - Q @ H)) return Q[:,:-1], H[:-1,:] Q, H = arnoldi(A) 8.59112969133