Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Now we are going to see how the computational complexity scales with the size of our Nx N matrix. Write a loop from N=1


 image

Now we are going to see how the computational complexity scales with the size of our Nx N matrix. Write a loop from N=1 to 100 that: creates matrix of size N with random entries, calls GE_count for each matrix, saves the number of operations in a vector count vector (one entry for each matrix) define a vector, Nvector from 1 to 100 You can generate random matrices of size Nx N by using the MATLAB command: rand (N). Make a plot of the size of the matrix (x-axis) by the number of scaling operations and number of subtraction/replacement operations (y-axis). Use the commands figure (1) %generates a new figure plot (Nvector, countvector) %Nvector and count vector need to be the same length xlabel ('Size of Matrix, N') ylabel('Number of operations') title('Computational complexity of GE') (c) Do the operations both grow like O(N)? Plot on a log-log scale to check. You can also plot (N vs N) to compare the slope. The command for plotting on log-log is loglog(x,y). (d) Find the number of necessary floating point operations required to com- pute the following operations (using the big-oh notation introduced in class). Explain your reasoning in each case. (a) Compute the sum A + B for A, B = Rmxn. (b) Compute the product Ax for x E Rn and A E Rnxn where A is upper triangular.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial Accounting and Reporting a Global Perspective

Authors: Michel Lebas, Herve Stolowy, Yuan Ding

4th edition

978-1408066621, 1408066629, 1408076861, 978-1408076866

More Books

Students also viewed these Computer Network questions