Answered step by step
Verified Expert Solution
Question
1 Approved Answer
We saw in lectures that computing the LU-factorization of an nxn matrix costs about 2n/3 flops, whereas computing the Cholesky factorization of an nxn symmetric
We saw in lectures that computing the LU-factorization of an nxn matrix costs about 2n/3 flops, whereas computing the Cholesky factorization of an nxn symmetric positive-definite matrix costs about n/3 flops. Write a script that does the following tasks. 1. Set n=3000. 2. Construct an nxn symmetric positive-definite matrix A of the form A= al + BTB with a > 0 which is symmetric and positive-definite. Here, we choose a=0.5 and B = wilkinson(n), with B being a Wilkinson's test matrix. is an upper 3. Compute the LU factorization of A and store the results into two matrices L and u, where L is a unit lower triangular matrix and triangular matrix. 4. Compute the Cholesky factorization of A and store the result in the matrix R. 5. Print out the CPU times taken by lu and chol to factor A. Use tic and toc commands to measure the CPU times. Do these times reflect the numbers of flops needed in each case
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started