code: private Matrix[] decomposeSymmetricMatrix(Matrix matrix) {
  
          Matrix d = matrix.copy();
          Matrix v = SparseMatrix.identity(matrix.rows());
  
          Vector r = generateR(d);
          Matrix u = SparseMatrix.identity(matrix.rows());
  
          VectorAccumulator normAccumulator = Vectors.mkEuclideanNormAccumulator();
  
          double n = Matrices.EPS;
          double nn = r.fold(normAccumulator);
  
          int kk = 0;
          int ll = 0;
  
          while (Math.abs(n - nn) > Matrices.EPS) {
  
              int k = findMax(r);
              int l = findMax(d, k);
  
              regenerateU(u, d, k, l, kk, ll);
  
              kk = k;
              ll = l;
  
              v = v.multiply(u);
              d = u.transpose().multiply(d.multiply(u));
  
              r.set(k, generateRi(d, k));
              r.set(l, generateRi(d, l));
  
              n = nn;
              nn = r.fold(normAccumulator);
          }
  
          return new Matrix[] { v, d };
      }
docs: Returns the result of Eigen decomposition for <a
  href="http://mathworld.wolfram.com/SymmetricMatrix.html"> symmetric</a>
  matrix
  <p>
  See <a href="http://mathworld.wolfram.com/EigenDecomposition.html">
  http://mathworld.wolfram.com/EigenDecomposition.html</a> for more
  details.
  </p>
  
  @param matrix
  @return { V, D }