Class EigenDecompositionNonSymmetric


  • public class EigenDecompositionNonSymmetric
    extends Object
    Calculates the eigen decomposition of a non-symmetric real matrix.

    The eigen decomposition of matrix A is a set of two matrices: \(V\) and \(D\) such that \(A V = V D\) where $\(A\), \(V\) and \(D\) are all \(m \times m\) matrices.

    This class is similar in spirit to the EigenvalueDecomposition class from the JAMA library, with the following changes:

    This class supports non-symmetric matrices, which have complex eigenvalues. Support for symmetric matrices is provided by EigenDecompositionSymmetric.

    As \(A\) is not symmetric, then the eigenvalue matrix \(D\) is block diagonal with the real eigenvalues in 1-by-1 blocks and any complex eigenvalues, \(\lambda \pm i \mu\), in 2-by-2 blocks:

    \[ \begin{bmatrix} \lambda & \mu\\ -\mu & \lambda \end{bmatrix} \]

    The columns of \(V\) represent the eigenvectors in the sense that \(A V = V D\), i.e. A.multiply(V) equals V.multiply(D). The matrix \(V\) may be badly conditioned, or even singular, so the validity of the equation \(A = V D V^{-1}\) depends upon the condition of \(V\).

    This implementation is based on the paper by A. Drubrulle, R.S. Martin and J.H. Wilkinson "The Implicit QL Algorithm" in Wilksinson and Reinsch (1971) Handbook for automatic computation, vol. 2, Linear algebra, Springer-Verlag, New-York.

    Since:
    3.0
    See Also:
    MathWorld, Wikipedia
    • Field Detail

      • DEFAULT_EPSILON

        public static final double DEFAULT_EPSILON
        Default epsilon value to use for internal epsilon
        See Also:
        Constant Field Values
    • Constructor Detail

      • EigenDecompositionNonSymmetric

        public EigenDecompositionNonSymmetric​(RealMatrix matrix)
        Calculates the eigen decomposition of the given real matrix.
        Parameters:
        matrix - Matrix to decompose.
        Throws:
        MathIllegalStateException - if the algorithm fails to converge.
        MathRuntimeException - if the decomposition of a general matrix results in a matrix with zero norm
      • EigenDecompositionNonSymmetric

        public EigenDecompositionNonSymmetric​(RealMatrix matrix,
                                              double epsilon)
                                       throws MathRuntimeException
        Calculates the eigen decomposition of the given real matrix.
        Parameters:
        matrix - Matrix to decompose.
        epsilon - Epsilon used for internal tests (e.g. is singular, eigenvalue ratio, etc.)
        Throws:
        MathIllegalStateException - if the algorithm fails to converge.
        MathRuntimeException - if the decomposition of a general matrix results in a matrix with zero norm
    • Method Detail

      • getV

        public RealMatrix getV()
        Gets the matrix V of the decomposition. V is a matrix whose columns hold either the real or the imaginary part of eigenvectors.
        Returns:
        the V matrix.
      • getD

        public RealMatrix getD()
        Gets the block diagonal matrix D of the decomposition. D is a block diagonal matrix. Real eigenvalues are on the diagonal while complex values are on 2x2 blocks { {real +imaginary}, {-imaginary, real} }.
        Returns:
        the D matrix.
      • getEpsilon

        public double getEpsilon()
        Get's the value for epsilon which is used for internal tests (e.g. is singular, eigenvalue ratio, etc.)
        Returns:
        the epsilon value.
      • getVInv

        public RealMatrix getVInv()
        Gets the inverse of the matrix V of the decomposition.
        Returns:
        the inverse of the V matrix.
      • getEigenvalues

        public Complex[] getEigenvalues()
        Gets a copy of the eigenvalues of the original matrix.
        Returns:
        a copy of the eigenvalues of the original matrix.
        See Also:
        getD(), getEigenvalue(int)
      • getEigenvalue

        public Complex getEigenvalue​(int i)
        Returns the ith eigenvalue of the original matrix.
        Parameters:
        i - index of the eigenvalue (counting from 0)
        Returns:
        ith eigenvalue of the original matrix.
        See Also:
        getD(), getEigenvalues()
      • getEigenvector

        public FieldVector<Complex> getEigenvector​(int i)
        Gets a copy of the ith eigenvector of the original matrix.

        Note that if the the ith is complex this method will throw an exception.

        Parameters:
        i - Index of the eigenvector (counting from 0).
        Returns:
        a copy of the ith eigenvector of the original matrix.
        See Also:
        getD()
      • getDeterminant

        public Complex getDeterminant()
        Computes the determinant of the matrix.
        Returns:
        the determinant of the matrix.