code: public static void tred2(int n, double v[][], double d[], double e[]) {
  
      //  This is derived from the Algol procedures tred2 by
      //  Bowdler, Martin, Reinsch, and Wilkinson, Handbook for
      //  Auto. Comp., Vol.ii-Linear Algebra, and the corresponding
      //  Fortran subroutine in EISPACK.
  
      System.arraycopy(v[n - 1], 0, d, 0, n);
  
      // Householder reduction to tridiagonal form.
  
      for (int i = n - 1; i > 0; i--) {
  
        // Scale to avoid under/overflow.
  
        double scale = 0.0;
        double h = 0.0;
        for (int k = 0; k < i; k++) {
          scale = scale + Math.abs(d[k]);
        }
        if (scale == 0.0) {
          e[i] = d[i - 1];
          for (int j = 0; j < i; j++) {
            d[j] = v[i - 1][j];
            v[i][j] = 0.0;
            v[j][i] = 0.0;
          }
        } else {
  
          h = householderIteration(i, scale, v, d, e);
  
        }
        d[i] = h;
      }
  
      // Accumulate transformations.
      accumulateTransformations(n, v, d);
  
      e[0] = 0.0;
    }
docs: Symmetric Householder reduction to tridiagonal form, taken from JAMA package.