I used MKL Lapack SBGVX because it can solve for "selected" eigenvalues/modes (both positive and negative), thinking it would be efficient, but it is extremely slow when compared with Bathe's subspace iteration eigensolver, which unfortunately can solve only for positive eigenvalues. I need only the smallest positive eigenvalue and its mode.
I am trying to solve the problem
$$
(\mathbf{K} - e\,\mathbf{M})\,\mathbf{u} = \mathbf{0}
$$
with $\mathbf{M}$ not +definite, and $\mathbf{K}$-- A-- that is +definite.
Here, $\mathbf{K}$ is has the form of a stiffness matrix and is invertible while $\mathbf{M}$ is like a mass matrix, some of the components of which can be negative (for instance, for negative-mass metamaterials). It is possible that some of the diagonal terms are zero, but let us assume that the matrix is invertible.
Since SBGVX needs the second matrix to be +definite, I multiply by $-1/e$ and rearrange it as $$ (\mathbf{M} - e'\,\mathbf{K})\,\mathbf{u} = \mathbf{0} $$ then look for the highest $e'$, which is positive, to then compute the lowest positive eigenvalue $e=1/e'$ . It works, but it is very slow.
Does anyone know how to modify Bathe's subspace iteration eigensolver to compute the highest eigenvalue instead of the smaller?
Or, how can I transform $$ (\mathbf{K} - e\,\mathbf{M})\,\mathbf{u} = \mathbf{0} $$ to solve for eigenvalues $e^2$ instead of $e$, so I can use Bathe's solver to find the smallest $e$? Bathe's solver crashes trying to solve for the smallest $e$ when the problem has negative eigenvalues.
Or, does anyone know another solver that I can try? A typical system has 5000 equations.