How do we know the relation between times and the number of arithmetic floating point ?

1 view (last 30 days)
Omar B.
Omar B. on 28 Jan 2021
Commented: Omar B. on 28 Jan 2021
I am trying to find out if solution of linear systems of equations with a triangular matrix by the backslash operation in Matlab requires about n^2 or n^3 arithmetic floating point operations, but I do know how to find the follwing:
How to compute the average time for the computation x=L\b using the tic-toc?
how to plot a graph of the average times versus n using semilogy?
what the exponent of n is?
Can you please explain it to me? Thank you in advance.

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 28 Jan 2021
Generally speaking, measure the time for a calculation on a matrix m x m, then for one a*m x a*m, then b*m x b*m. If the calculation is linear in m, then the time for the first should be m^2*C1+C2 for constants C1 and C2, and the time for the middle should be a^2*m^2*C1+C2 and that is enough information to solve for C1 and C2. Use those to make a prediction for b*m. Was the third time close to that? If so then the time is approximately linear in m^2. Or quadratic in m, depending on how you want to look at it.
Now if the times are not predictive for b*m then change your model ffrom ^2 to ^n for unknown n, and write out the math for m, a*m, and b*m. Three unknowns, three equations, and you can proceed to estimate n. You can cross-check with a fourth test.

Sign in to comment.


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!