# Calculate amount of FLOPs for an eigenvalue problem solver

I have 2 complex, non-symmetric, matrices $$A_{1000\times1000}$$, $$B_{1000\times1000}$$ and I am using Matlab to get it's eigenvalues (functions like eig or eigs). Both matrices are different - one is denser and the other one has more complex values. To compare the complexity of the eigenvalue solving process for both matrices I would like to calculate the number of FLOPs needed for this procedure. Of course, it is possible to calculate the time need for the eigenvalue solver to complete its task, but this is highly unstable since a lot of background processes might be creating some noise.

In Matlab, there is no function that would allow me to get FLOPs for eigs but I might use another software, since I only need these matrices $$A, B$$ which can be exported. Does anyone have an Idea how I could reach my goal?

• Is there any specific reason for you wanting the number of FLOPs? In general, eigenvalue problems are solved iteratively and then the number of operations is not fixed. Commented Jun 20, 2019 at 16:23
• sure, I am comparing two similar methods which are solved via eigenvalue problem. Both methods, depending on their configuration produce different matrices. Sometime these matrices are even hermitian. I need to compare the cost of calculation for both methods - the right way to do it is by counting FLOPs. Commented Jun 20, 2019 at 16:47
• "the right way to do it is by counting FLOPs": I beg to differ, for various reasons, some of which are discussed here Commented Jun 20, 2019 at 20:32
• Thanks @GoHokies, I've read through this very interesting discussion. As Matt Knepley and other point out, FLOPs are important for the efficiency analysis, but admitted, not alone - memory-ops should also be taken into account. In my case counting flops makes sense, because I am performing a relative comparison of matrices on the same hardware. Commented Jun 21, 2019 at 5:48
• if you really want to count FLOPs four your two test cases (again, I believe this is not a good idea, even if you're doing a relative comparison on the same hardware, as memory bandwidth / arithmetic intensity does play a role), you'll have to get much closer to the hardware - perhaps with CPU event counters or a hardware emulator. Commented Jun 21, 2019 at 6:08