eigenvalueeigenvectorapache-commons-mathjamamtj

Computing the complex eigenvectors of a sparse matrix in Java


I am trying to compute the eigenvalues and eigenvectors of a potentially large and sparse non-symmetrical NxN matrix (N > 10^6). I would not need all of them, but maybe the first of them. Ideally, I'd like to do so from Java but could move to C, C++ or Python if required.

My matrix can potentially have both complex eigenvalues and eigenvectors. For example, see the results for this Wolfram Alpha sample.

I found several ways to do this using a number of Java libraries and wrote some evaluation code for them:

But the problem I am facing is that these libraries do not return (or at least I found no way to get) the complex valued eigenvectors. Most of them do return the complex valued eigenvalues, but not complex eigenvectors. They typically provide the latter in the form of a "vector of reals" or "real matrix" having columns as each eigenvector.

I do as a matter of fact need the eigenvalues in complex form, if any.

Now, I recently started looking into Spectra (C++) which seems to support my use case. But would like to first ask and maybe discard a misunderstanding on my side or something I may have skipped from Java land because I'd like to keep using a single platform/language as far as it's possible.

Is there anything I should be looking into? Also, If I end up moving away from Java for this task, any other alternatives to Spectra I could be looking into? Thanks!


Solution

  • Just in case anyone stumbles upon this, I finally went the C++ way because none of the Java libraries provided the complex eigenvectors as I needed.

    I have ended up implementing most of the stuff I need with C++ using Spectra and Eigen. Then I have built a series of native wrapper classes using SWIG.