smile.math.matrix

Class PowerIteration

• java.lang.Object
• smile.math.matrix.PowerIteration

• ```public class PowerIteration
extends java.lang.Object```
The power iteration (also known as power method) is an eigenvalue algorithm that will produce the greatest (in absolute value) eigenvalue and a nonzero vector the corresponding eigenvector.
• Constructor Summary

Constructors
Constructor and Description
`PowerIteration()`
• Method Summary

All Methods
Modifier and Type Method and Description
`static double` ```eigen(DMatrix A, double[] v)```
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.
`static double` ```eigen(DMatrix A, double[] v, double p, double tol, int maxIter)```
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.
• Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• Constructor Detail

• PowerIteration

`public PowerIteration()`
• Method Detail

• eigen

```public static double eigen(DMatrix A,
double[] v)```
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.
Parameters:
`A` - the matrix supporting matrix vector multiplication operation.
`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.
Returns:
the largest eigen value.
• eigen

```public static double eigen(DMatrix A,
double[] v,
double p,
double tol,
int maxIter)```
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.
Parameters:
`A` - the matrix supporting matrix vector multiplication operation.
`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.
`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 |(λ2 - p) / (λ1 - p)| < |λ2 / λ1|, where λ2 is the second largest eigenvalue in magnitude. If we known the eigenvalue spectrum of A, (λ2 + λn)/2 is the optimal choice of p, where λn is the smallest eigenvalue in magnitude. Good estimates of λ2 are more difficult to compute. However, if μ is an approximation to largest eigenvector, then using any x0 such that x0*μ = 0 as the initial vector for a few iterations may yield a reasonable estimate of λ2.
`tol` - the desired convergence tolerance.
`maxIter` - the maximum number of iterations in case that the algorithm does not converge.
Returns:
the largest eigen value.