Question: Gram-Schmidt Algorithm and QR decomposition (5 marks) - Please use SIMPLE PYTHON and NOT Numpy for soling this question i) Write a code to generate

Gram-Schmidt Algorithm and QR decomposition (5 marks) - Please use SIMPLE PYTHON and NOT Numpy for soling this question

i) Write a code to generate a random matrix A of size m n with m > n and calculate its Frobenius norm, F . The entries of A must be of the form r.dddd (example 5.4316). The inputs are the positive integers m and n and the output should display the the dimensions and the calculated norm value.

Deliverable(s) : The code with the desired input and output

ii) Write a code (using basic Python functions & not Numpy)to decide if Gram-Schmidt Algorithm can be applied to columns of a given matrix A through calculation of rank. The code should print appropriate messages indicating whether Gram-Schmidt is applicable on columns of the matrix or not.

Deliverable(s) : The code that performs the test. (1)

iii) Write a code (using basic Python functions & not Numpy) to generate the orthogonal matrix Q from a matrix A by performing the Gram-Schmidt orthogonalization method. Ensure that A has linearly independent columns by checking the rank. Keep generating A until the linear independence is obtained.

Deliverable(s) : The code that produces matrix Q from A (1)

iv) Write a code (using basic Python functions & not Numpy )to create a QR decomposition of the matrix A by utilizing the code developed in the previous sub-parts of this question. Find the matrices Q and R and then display the value A (Q.R)F , where F is the Frobenius norm. The code should also display the total number of additions, multiplications and divisions to find the result.

Deliverable(s) : The code with the said input and output. The results obtained for A generated with m = 7 and n = 5 with random entries described above.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!