Computational Thinking, Linear Algebra, Python, Jupyter Notebook, Math.
np.random.rand(n,n) AT = A @ A.T def pure_qr(A, max_iter=50000): Ak = np.copy(A) n = A.shape[0] QQ = np.eye(n) for k in range(max_iter): Q, R = np.linalg.qr(Ak) Ak = R @ Q QQ = QQ @ Q if k % 100 == 0: print(Ak) print("\n") return Ak, QQ Pure QR Ak, Q = pure_qr(A) Let’s compare to the eigenvalues: