I am trying to find the diagonal matrix D of eigenvalues and matrix V whose columns are the corresponding right eigenvectors (where AV = VD) of the tri diagonal matrix J. I’m attempting to implement existing MATLAB code in java however the result I am getting in java is dissimilar to that in MATLAB (the MATLAB result being the correct result). I have created a folder on google drive of the matrices from MATALB and java so you can see the differences.
Java Code Snippet:
RealMatrix J2 = new Array2DRowRealMatrix(j);
EigenDecomposition eig = new EigenDecomposition(J2);
RealMatrix V = eig.getV();
RealMatrix D = eig.getD();
MATLAB Code:
[V,D]=eig(J);
Here are the matrices for each variable:
Variable J:
Variable V:
Expected:
Variable D:
Expected: