subject

In the present module, it was demonstrated that you could estimate the exponent of the asymptotic time complexity (i. e., a of O(na)) by plotting the runtime of an algorithim as a function of the problem size on a log-log plot and determining the slope of the resulting line. In this problem, you will write a function that uses this methodology to estimate a given the runtimes and associated problem sizes. Write a function called estTC with the following declaration line
begin code
function alpha estTC(nSize, runTime)
end code
where the input arguments are:
• nSize: a 1-by-n array whose elements are the problem size for each test
• runtime: a k-by-n array where each row is the runtimes for an algorithm tested at each problem size. Thus the number of rows corresponds to the number of algorithms.
The output argument, alpha, is a k-by-1 array that contains the estimate of the exponent for each of the k algorithms.
The estTC function should first transform both of the input arguments using the base-10 logarithm (i. e., log10 in MATLAB). Then, using regression you should fit an linear function (i. e., of the form f(x) = ax + 3) to the transformed input data. As seen in the module, the slope of this function will then be an estimate for a, the exponent of the asymptotic time complexity.
You should test this function using the data from the previous problem. Additionally in the assignment download there is a runTimeData. mat file that contains runtime data for 4 operations involving matrices. The first row corresponds to vector-vector multiplication (i. e., xTy where x and y are n-by-1 vectors). The first row corresponds to matrix-vector multiplication (i. e., Ay where y is a n-by-1 vector and A is a n-by-n matrix). The third row corresponds to matrix- matrix multiplication (i. e., AB where A and B are n-by-n matrices). The fourth row corresponds to solving a system of linear equations Ax = b (i. e., where b is a n-by-1 vector and A is a n-by-n matrix). An example using this function with the supplied data is given below.
begin code load runTimeData 2 3 alpha = estTC(nSize, runTime) 4 5 alpha 6 7 8 0.8193 1.8465 2.8224 2.5852 9 10 end code

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 15:10, passions3534ovf6dt
Which activity should be part of a long-term plan to positively affect yourhealth? oa. wearing regular clothing when handling toxinsob. not worrying about secondhand smokeoc. avoiding excessive exposure to sunlightod. drinking only well water
Answers: 1
image
Computers and Technology, 23.06.2019 10:00, austintules2005
Whats three fourths of 15(this is supposed to be in math but i clicked too fast)
Answers: 1
image
Computers and Technology, 23.06.2019 18:30, milkshakegrande101
Where can page numbers appear? check all that apply. in the header inside tables in the footer at the bottom of columns at the top of columns
Answers: 1
image
Computers and Technology, 23.06.2019 21:20, FlowerChild1229
For positive constants a and b, the force between two atoms in a molecule is given f(r) = −a r2 + b r3 , where r > 0 is the distance between the atoms. note: a and b are upper case letters. (a) find f '(r) = (b) find the critical point for f(r). r = (c) find f ''(r) = (d) find the value of r so that f ''(r) = 0.
Answers: 1
You know the right answer?
In the present module, it was demonstrated that you could estimate the exponent of the asymptotic ti...

Questions in other subjects:

Konu
Mathematics, 31.01.2020 14:02