public class EigenValueDecomposition extends Object
A = V*D*V-1
If A is symmetric, then A = V*D*V' where the eigenvalue matrix D is diagonal and the eigenvector matrix V is orthogonal.
Given a linear transformation A, a non-zero vector x is defined to be an eigenvector of the transformation if it satisfies the eigenvalue equation
A x = λ x
for some scalar λ. In this situation, the scalar λ is called an eigenvalue of A corresponding to the eigenvector x.
The word eigenvector formally refers to the right eigenvector, which is defined by the above eigenvalue equation A x = λ x, and is the most commonly used eigenvector. However, the left eigenvector exists as well, and is defined by x A = λ x.
Let A be a real n-by-n matrix with strictly positive entries aij > 0. Then the following statements hold.
A stochastic matrix, probability matrix, or transition matrix is used to describe the transitions of a Markov chain. A right stochastic matrix is a square matrix each of whose rows consists of nonnegative real numbers, with each row summing to 1. A left stochastic matrix is a square matrix whose columns consist of nonnegative real numbers whose sum is 1. A doubly stochastic matrix where all entries are nonnegative and all rows and all columns sum to 1. A stationary probability vector π is defined as a vector that does not change under application of the transition matrix; that is, it is defined as a left eigenvector of the probability matrix, associated with eigenvalue 1: πP = π. The Perron-Frobenius theorem ensures that such a vector exists, and that the largest eigenvalue associated with a stochastic matrix is always 1. For a matrix with strictly positive entries, this vector is unique. In general, however, there may be several such vectors.
| Modifier and Type | Method and Description |
|---|---|
static EigenValueDecomposition |
decompose(double[][] A)
Full eigen value decomposition of a square matrix.
|
static EigenValueDecomposition |
decompose(double[][] A,
boolean symmetric)
Full eigen value decomposition of a square matrix.
|
static EigenValueDecomposition |
decompose(double[][] A,
boolean symmetric,
boolean onlyValues)
Full eigen value decomposition of a square matrix.
|
static EigenValueDecomposition |
decompose(IMatrix A,
int k)
Find k largest approximate eigen pairs of a symmetric matrix by the
Lanczos algorithm.
|
static EigenValueDecomposition |
decompose(IMatrix A,
int k,
double kappa)
Find k largest approximate eigen pairs of a symmetric matrix by the
Lanczos algorithm.
|
static double |
eigen(IMatrix 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(IMatrix 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 double |
eigen(IMatrix 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 double |
eigen(IMatrix 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 double |
eigen(IMatrix 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.
|
double[][] |
getD()
Returns the block diagonal eigenvalue matrix whose diagonal are the real
part of eigenvalues, lower subdiagonal are positive imaginary parts, and
upper subdiagonal are negative imaginary parts.
|
double[] |
getEigenValues()
Returns the eigenvalues, ordered from largest to smallest.
|
double[][] |
getEigenVectors()
Returns the eigenvector matrix, ordered by eigen values from largest to smallest.
|
double[] |
getImagEigenValues()
Returns the imaginary parts of the eigenvalues, ordered in real part
from largest to smallest.
|
double[] |
getRealEigenValues()
Returns the real parts of the eigenvalues, ordered in real part from
largest to smallest.
|
static double[] |
pagerank(IMatrix A)
Calculate the page rank vector.
|
static double[] |
pagerank(IMatrix A,
double[] v)
Calculate the page rank vector.
|
static double[] |
pagerank(IMatrix A,
double[] v,
double damping,
double tol,
int maxIter)
Calculate the page rank vector.
|
public double[][] getEigenVectors()
public double[] getEigenValues()
public double[] getRealEigenValues()
public double[] getImagEigenValues()
public double[][] getD()
public static double eigen(IMatrix A, double[] v)
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.public static double eigen(IMatrix A, double[] v, double tol)
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.public static double eigen(IMatrix A, double[] v, double tol, int maxIter)
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.public static double eigen(IMatrix A, double[] v, double p, double tol)
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.public static double eigen(IMatrix A, double[] v, double p, double tol, int maxIter)
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.public static double[] pagerank(IMatrix A)
A - the matrix supporting matrix vector multiplication operation.public static double[] pagerank(IMatrix A, double[] v)
A - the matrix supporting matrix vector multiplication operation.v - the teleportation vector.public static double[] pagerank(IMatrix A, double[] v, double damping, double tol, int maxIter)
A - the matrix supporting matrix vector multiplication operation.v - the teleportation vector.damping - the damper factor.tol - the desired convergence tolerance.maxIter - the maximum number of iterations in case that the algorithm
does not converge.public static EigenValueDecomposition decompose(IMatrix A, int k)
A - the matrix supporting matrix vector multiplication operation.k - the number of eigenvalues we wish to compute for the input matrix.
This number cannot exceed the size of A.public static EigenValueDecomposition decompose(IMatrix A, int k, double kappa)
A - the matrix supporting matrix vector multiplication operation.k - the number of eigenvalues we wish to compute for the input matrix.
This number cannot exceed the size of A.kappa - relative accuracy of ritz values acceptable as eigenvalues.public static EigenValueDecomposition decompose(double[][] A)
A - square matrix which will be altered during decomposition.public static EigenValueDecomposition decompose(double[][] A, boolean symmetric)
A - square matrix which will be altered during decomposition.symmetric - if true, the matrix is assumed to be symmetric.public static EigenValueDecomposition decompose(double[][] A, boolean symmetric, boolean onlyValues)
A - square matrix which will be altered during decomposition.symmetric - if true, the matrix is assumed to be symmetric.onlyValues - if true, only compute eigenvalues; the default is to compute eigenvectors also.Copyright © 2015. All rights reserved.