Julia is slower than matlab when it comes to matrix diagonalization?

From the Matlab eigs documentation:

using 'smallestabs', which employs a Krylov method using the inverse of A.

This is what I suggested above: the Julia libraries won’t do shift/invert automatically (whereas Matlab will). This can drastically change the number of iterations.

So to get a comparable number of iterations to Matlab with M \ (K + 0.1 * M) (which is internally inverted) you’ll want to do something like:

F = cholesky(Symmetric(K + 0.1 * M))
eigsolve(x -> F \ (M * x), ..., :SM)

(:SM is the equivalent of smallestabs in Matlab, not :SR, though :SR should work as well since all the eigenvalues are real and positive). Then invert and shift the resulting eigenvalues to get the eigenvalues of the original problem.

Correction: Once you invert, you should be using :LM to look for largest-magnitude eigenvalues (rather than :SM).

1 Like