f = flops
flops(0)
f = flops
returns the cumulative number of floating-point operations.
flops(0)
resets the count to zero.
A
and B
are real n
-by-n
matrices, some typical flop counts for different operations are
--------------------- Operation Flop Count ---------------------MATLAB's version of the LINPACK benchmark isA+B
n^2
A*B
2*n^3
A^100
99*(2*n^3)
lu(A)
(2/3)*n^3
---------------------
n = 100;
A = rand(n,n);
b = rand(n,1);
flops(0)
tic;
x = A\b;
t = toc
megaflops = flops/t/1.e6