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

1 view (last 30 days)
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?
n=100;
L=tril(randn(n));
new=ones(1,n);
L(1,:)=new
b=ones(n,1);
x=L\b;
Omar B. on 28 Jan 2021

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.
Omar B. on 28 Jan 2021
Thank you.