Question: Steps for Physics 4 7 3 0 , Fall 2 0 2 4 Homework # 1 Due Sunday September 8 t h In class we
Steps for
Physics Fall
Homework #
Due Sunday September
In class we discussed two methods for inverting matrices, that can be generalized to invert a nonsquare matrix. In the singular value decomposition SVD method, we use the fact that any matrix A can be broken down as follows:
where U is an unitary matrix, is an positive diagonal matrix, and V is an unitary matrix. The inverse of A is given by
Another method is the decomposition method. Here, we use the fact that any matrix A can be broken down as follows:
where is an orthogonal matrix and is an upper triagonal matrix. The inverse of A is given by
For this assignment, we are going to be doing a benchmark test of the two inversion methods. You should submit a Python script
benchmark.py that does the following:
For
generate a random matrix
find inversion time via the SVD method
find inversion time via the method
Make a plot benchmark.png showing and versus
Print to standard output the time in seconds of inverting a matrix by each method. Also print to standard output a statement about which method is the fastest.
You should try to minimize the time taken by both methods. For example, Q is an orthogonal matrix; is it faster to explicitly invert it or take it's transpose? Extra credit to anyone who can find a way of SV or QRinverting a random matrix faster than the instructor.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
