code: public static double eigen(Matrix A, double[] v, double p, double tol) {
          return eigen(A, v, p, tol, Math.max(20, 2 * A.nrows()));
      }
docs: Returns the largest eigen pair of matrix with the power iteration
  under the assumptions A has an eigenvalue that is strictly greater
  in magnitude than its other eigenvalues and the starting
  vector has a nonzero component in the direction of an eigenvector
  associated with the dominant eigenvalue.
  @param A the matrix supporting matrix vector multiplication operation.
  @param v on input, it is the non-zero initial guess of the eigen vector.
  On output, it is the eigen vector corresponding largest eigen value.
  @param p the origin in the shifting power method. A - pI will be
  used in the iteration to accelerate the method. p should be such that
  |(&lambda;<sub>2</sub> - p) / (&lambda;<sub>1</sub> - p)| &lt; |&lambda;<sub>2</sub> / &lambda;<sub>1</sub>|,
  where &lambda;<sub>2</sub> is the second largest eigenvalue in magnitude.
  If we known the eigenvalue spectrum of A, (&lambda;<sub>2</sub> + &lambda;<sub>n</sub>)/2
  is the optimal choice of p, where &lambda;<sub>n</sub> is the smallest eigenvalue
  in magnitude. Good estimates of &lambda;<sub>2</sub> are more difficult
  to compute. However, if &mu; is an approximation to largest eigenvector,
  then using any x<sub>0</sub> such that x<sub>0</sub>*&mu; = 0 as the initial
  vector for a few iterations may yield a reasonable estimate of &lambda;<sub>2</sub>.
  @param tol the desired convergence tolerance.
  @return the largest eigen value.