Page 1 of 1

Your Task: Assuming A E Rnxn is a Matrix object, and b ER" is a Vec object, implement a function solve_qr(A, b) that use

Posted: Sun May 15, 2022 8:43 am
by answerhappygod
Your Task Assuming A E Rnxn Is A Matrix Object And B Er Is A Vec Object Implement A Function Solve Qr A B That Use 1
Your Task Assuming A E Rnxn Is A Matrix Object And B Er Is A Vec Object Implement A Function Solve Qr A B That Use 1 (99.94 KiB) Viewed 52 times
Your Task: Assuming A E Rnxn is a Matrix object, and b ER" is a Vec object, implement a function solve_qr(A, b) that uses the QR-factorization of A to compute and return the solution to the system Aă = V. Hints: 1. If A = QR, then Aă: = b becomes QR = b. What happens if we multiply both sides of the equation by the transpose of Q? i.e., What does QʻQRÍ = Q* simplify to? 2. Part of your code for the solvers in CA #6 will come in handy. = In [ ]: def solve_qr(a, b): # todo pass In [ ]: "TESTER CELL" = A = Matrix( [[2, -2, 18], [2, 1, 0], [1, 2, 0]]) X_true Vec( [3, 4, 5]) b = A * x_true print("Expected:", x_true) X = solve_qr(A, b) print("Returned:", x)