smile.math.matrix
Class PowerIteration
- java.lang.Object
-
- smile.math.matrix.PowerIteration
-
public class PowerIteration extends java.lang.ObjectThe 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 Static Methods Concrete Methods Modifier and Type Method and Description static doubleeigen(Matrix 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 doubleeigen(Matrix A, double[] v, double tol)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 doubleeigen(Matrix A, double[] v, double p, double tol)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 doubleeigen(Matrix 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.static doubleeigen(Matrix A, double[] v, 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.
-
-
-
Method Detail
-
eigen
public static double eigen(Matrix 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(Matrix A, double[] v, double tol)
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.tol- the desired convergence tolerance.- Returns:
- the largest eigen value.
-
eigen
public static double eigen(Matrix A, double[] v, 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.tol- the desired convergence tolerance.maxIter- the maximum number of iterations in case that the algorithm does not converge.- Returns:
- the largest eigen value.
-
eigen
public static double eigen(Matrix A, double[] v, double p, double tol)
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.- Returns:
- the largest eigen value.
-
eigen
public static double eigen(Matrix 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.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG