subject

P1. Write a MATLAB function with inputs • m and n, two positive integers, • a matrix A of size m × n, • a vector x of size n × 1, and which outputs the product vector A × x (note that the size of this vector should be m × 1). Your code should check that the sizes of the inputs are right and then do the multiplication using two nested "for" loops. a) How many floating point operations (additions and multiplications) does the code use? Find a formula in terms of m and n. b) Run the code with n = 100, m = 100, and inputs A =rand(m, n) and x =rand(n, 1). Modify the function by introducing a new output variable, op count, which initializes to 0 outside of the nested for loops (just like we did with product in class) and is incremented inside the innermost of the for loops by the number of operations done to update product. (We will do an example of this on Wednesday.) Output op count as well as product. Repeat the experiment for m = 200, n = 100; m = 100, n = 200; and m = n = 200. Do the ratios of the new op count outputs to the old one you got for m = n = 100 confirm the floating point operation formula you found in part a)?

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 15:00
Jake really works well with numbers and is skilled with computers but doesn't work well with others. which of the jobs discussed in this unit might be best for jake? why?
Answers: 3
question
Computers and Technology, 23.06.2019 17:00
*! 20 points! *jeff wants to create a website with interactive and dynamic content. which programming language will he use? a. dhtml b. html c. css d. javascript
Answers: 1
question
Computers and Technology, 23.06.2019 18:50
What is transmission control protocol/internet protocol (tcp/ip)? software that prevents direct communication between a sending and receiving computer and is used to monitor packets for security reasons a standard that specifies the format of data as well as the rules to be followed during transmission a simple network protocol that allows the transfer of files between two computers on the internet a standard internet protocol that provides the technical foundation for the public internet as well as for large numbers of private networks
Answers: 2
question
Computers and Technology, 24.06.2019 01:00
Me if you do then you get 10 points and brainliest
Answers: 1
You know the right answer?
P1. Write a MATLAB function with inputs • m and n, two positive integers, • a matrix A of size m × n...
Questions
question
Chemistry, 14.10.2019 16:30
Questions on the website: 13722367