title: Why the eigenvalue calculated by Java (JAMA/math3) and Matlab/Python are different?
body: <p>There are some needs to calculate the eigenvalues of a given matrix, but I found different results are given in Matlab and Java.
  <strong>Given a Matrix in Matlab</strong>:</p>
  <pre><code> x=[[0.9991064766057767, 1.3003274547457159E8, 8.2589524321425552E16,9.065301406782726E25, 3.1791759769979634E34, 5.145828201380777E42];[5.905543519041531E-4,6.52297956260086E7,1.1242553048989866E16,2.9885609033349647E24,8.710071169857434E32,4.288190167817314E41];[1.8659562881188536E-4,2095424.7256421563,9.512929502991425E14,1.6603116129638694E23,0,0];[1.0062771059108464E-4, 271629.131101761, 8.648117729992205E13, 0, 0, 0];[1.3392896733345797E-5,38804.161585965856,0,0,0,0]; [2.3528061828850723E-6,0,0,0,0,0]]
  </code></pre>
  <p><strong>Output V matrix (use function eigs()):</strong></p>
  <pre><code>   0.9993 + 0.0000i   0.9993 + 0.0000i  -0.9987 + 0.0000i  -0.9987 + 0.0000i   0.9998 + 0.0000i   0.9998 + 0.0000i
     0.0387 + 0.0000i   0.0387 + 0.0000i  -0.0509 + 0.0000i  -0.0510 + 0.0000i  -0.0211 + 0.0000i  -0.0211 - 0.0000i
     0.0000 + 0.0000i   0.0000 + 0.0000i   0.0077 + 0.0000i   0.0077 + 0.0000i   0.0000 + 0.0000i   0.0000 - 0.0000i
     0.0000 + 0.0000i  -0.0000 + 0.0000i   0.0000 + 0.0000i  -0.0000 + 0.0000i   0.0000 + 0.0000i   0.0000 - 0.0000i
     0.0000 + 0.0000i  -0.0000 + 0.0000i  -0.0000 + 0.0000i   0.0000 + 0.0000i  -0.0000 + 0.0000i  -0.0000 - 0.0000i
     0.0000 + 0.0000i  -0.0000 + 0.0000i  -0.0000 + 0.0000i   0.0000 + 0.0000i   0.0000 - 0.0000i   0.0000 + 0.0000i
  </code></pre>
  <p><strong>D matrix:</strong>
  1.0e+18 *</p>
  <pre><code>   7.7371 + 0.0000i   0.0000 + 0.0000i   0.0000 + 0.0000i   0.0000 + 0.0000i   0.0000 + 0.0000i   0.0000 + 0.0000i
     0.0000 + 0.0000i  -7.7371 + 0.0000i   0.0000 + 0.0000i   0.0000 + 0.0000i   0.0000 + 0.0000i   0.0000 + 0.0000i
     0.0000 + 0.0000i   0.0000 + 0.0000i   3.7897 + 0.0000i   0.0000 + 0.0000i   0.0000 + 0.0000i   0.0000 + 0.0000i
     0.0000 + 0.0000i   0.0000 + 0.0000i   0.0000 + 0.0000i  -3.7888 + 0.0000i   0.0000 + 0.0000i   0.0000 + 0.0000i
     0.0000 + 0.0000i   0.0000 + 0.0000i   0.0000 + 0.0000i   0.0000 + 0.0000i   0.0000 + 3.7358i   0.0000 + 0.0000i
     0.0000 + 0.0000i   0.0000 + 0.0000i   0.0000 + 0.0000i   0.0000 + 0.0000i   0.0000 + 0.0000i   0.0000 - 3.7358i
  </code></pre>
  <p>while in JAVA:
  define the same test matrix:</p>
  <pre><code>    double[][] test = new double[6][6];
      test[0][0] = 0.9991064766057767;
      test[0][1] = 1.3003274547457159E8;
      test[0][2] = 8.2589524321425552E16;
      test[0][3] = 9.065301406782726E25;
      test[0][4] = 3.1791759769979634E34;
      test[0][5] = 5.145828201380777E42;
      test[1][0] = 5.905543519041531E-4;
      test[1][1] = 6.52297956260086E7;
      test[1][2] = 1.1242553048989866E16;
      test[1][3] = 2.9885609033349647E24;
      test[1][4] = 8.710071169857434E32;
      test[1][5] = 4.288190167817314E41;
      test[2][0] = 1.8659562881188536E-4;
      test[2][1] = 2095424.7256421563;
      test[2][2] = 9.512929502991425E14;
      test[2][3] = 1.6603116129638694E23;
      test[3][0] = 1.0062771059108464E-4;
      test[3][1] = 271629.131101761;
      test[3][2] = 8.648117729992205E13;
      test[4][0] = 1.3392896733345797E-5;
      test[4][1] = 38804.161585965856;
      test[5][0] = 2.3528061828850723E-6;
      RealMatrix matrix = new Array2DRowRealMatrix(test);
      EigenDecomposition eigen = new EigenDecomposition(matrix);
  </code></pre>
  <p>I get D matrix:</p>
  <pre><code>Array2DRowRealMatrix{{-151115727451828650000000.0,151115727451828650000000.0,0.0,0.0,0.0,0.0},{-151115727451828650000000.0,-151115727451828650000000.0,0.0,0.0,0.0,0.0},{0.0,0.0,121490934714923220000000.0,835322221745495900000000.0,0.0,0.0},{0.0,0.0,-835322221745495900000000.0,121490934714923220000000.0,0.0,0.0},{0.0,0.0,0.0,0.0,-24594465620584907000000.0,24594465620584907000000.0},{0.0,0.0,0.0,0.0,-24594465620584907000000.0,-24594465620584907000000.0}}
  </code></pre>
  <p>Why the results are greatly different (one is in the level of E18, while the other one is in the level of E23)?
  I tried Python, they output the same results as those in Matlab.</p>
  <p>When I tried some matrix with Integer numbers, JAVA and Matlab can output the same results.</p>
  <p>Is there anything I did uncorrectly?</p>