Class ComplexEigenDecomposition

  • Direct Known Subclasses:
    OrderedComplexEigenDecomposition

    public class ComplexEigenDecomposition
    extends Object
    Given a matrix A, it computes a complex eigen decomposition AV = VD.

    Complex Eigen Decomposition differs from the EigenDecompositionSymmetric since it computes the eigen vectors as complex eigen vectors (if applicable).

    Beware that in the complex case, you do not always have \(V \times V^{T} = I\) or even a diagonal matrix, even if the eigenvectors that form the columns of the V matrix are independent. On example is the square matrix \[ A = \left(\begin{matrix} 3 & -2\\ 4 & -1 \end{matrix}\right) \] which has two conjugate eigenvalues \(\lambda_1=1+2i\) and \(\lambda_2=1-2i\) with associated eigenvectors \(v_1^T = (1, 1-i)\) and \(v_2^T = (1, 1+i)\). \[ V\timesV^T = \left(\begin{matrix} 2 & 2\\ 2 & 0 \end{matrix}\right) \] which is not the identity matrix. Therefore, despite \(A \times V = V \times D\), \(A \ne V \times D \time V^T\), which would hold for real eigendecomposition.

    Also note that for consistency with Wolfram langage eigenvectors, we add zero vectors when the geometric multiplicity of the eigenvalue is smaller than its algebraic multiplicity (hence the regular eigenvector matrix should be non-square). With these additional null vectors, the eigenvectors matrix becomes square. This happens for example with the square matrix \[ A = \left(\begin{matrix} 1 & 0 & 0\\ -2 & 1 & 0\\ 0 & 0 & 1 \end{matrix}\right) \] Its characteristic polynomial is \((1-\lambda)^3\), hence is has one eigen value \(\lambda=1\) with algebraic multiplicity 3. However, this eigenvalue leads to only two eigenvectors \(v_1=(0, 1, 0)\) and \(v_2=(0, 0, 1)\), hence its geometric multiplicity is only 2, not 3. So we add a third zero vector \(v_3=(0, 0, 0)\), in the same way Wolfram language does.

    Compute complex eigen values from the Schur transform. Compute complex eigen vectors based on eigen values and the inverse iteration method. see: https://en.wikipedia.org/wiki/Inverse_iteration https://en.wikiversity.org/wiki/Shifted_inverse_iteration http://www.robots.ox.ac.uk/~sjrob/Teaching/EngComp/ecl4.pdf http://www.math.ohiou.edu/courses/math3600/lecture16.pdf
    • Field Detail

      • DEFAULT_EIGENVECTORS_EQUALITY

        public static final double DEFAULT_EIGENVECTORS_EQUALITY
        Default threshold below which eigenvectors are considered equal.
        See Also:
        Constant Field Values
      • DEFAULT_EPSILON

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

        public static final double DEFAULT_EPSILON_AV_VD_CHECK
        Internally used epsilon criteria for final AV=VD check.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ComplexEigenDecomposition

        public ComplexEigenDecomposition​(RealMatrix matrix,
                                         double eigenVectorsEquality,
                                         double epsilon,
                                         double epsilonAVVDCheck)
        Constructor for decomposition.

        The eigenVectorsEquality threshold is used to ensure the L∞-normalized eigenvectors found using inverse iteration are different from each other. if \(min(|e_i-e_j|,|e_i+e_j|)\) is smaller than this threshold, the algorithm considers it has found again an already known vector, so it drops it and attempts a new inverse iteration with a different start vector. This value should be much larger than epsilon which is used for convergence

        Parameters:
        matrix - real matrix.
        eigenVectorsEquality - threshold below which eigenvectors are considered equal
        epsilon - Epsilon used for internal tests (e.g. is singular, eigenvalue ratio, etc.)
        epsilonAVVDCheck - Epsilon criteria for final AV=VD check
        Since:
        1.8
    • Method Detail

      • getEigenvalues

        public Complex[] getEigenvalues()
        Getter of the eigen values.
        Returns:
        eigen values.
      • getEigenvector

        public FieldVector<Complex> getEigenvector​(int i)
        Getter of the eigen vectors.
        Parameters:
        i - which eigen vector.
        Returns:
        eigen vector.
      • matricesToEigenArrays

        protected void matricesToEigenArrays()
        Reset eigenvalues and eigen vectors from matrices.

        This method is intended to be called by sub-classes (mainly OrderedComplexEigenDecomposition) that reorder the matrices elements. It rebuild the eigenvalues and eigen vectors arrays from the D and V matrices.

        Since:
        2.1
      • hasComplexEigenvalues

        public boolean hasComplexEigenvalues()
        Confirm if there are complex eigen values.
        Returns:
        true if there are complex eigen values.
      • getDeterminant

        public double getDeterminant()
        Computes the determinant.
        Returns:
        the determinant.
      • findEigenValues

        protected void findEigenValues​(RealMatrix matrix)
        Compute eigen values using the Schur transform.
        Parameters:
        matrix - real matrix to compute eigen values.
      • findEigenVectors

        protected void findEigenVectors​(FieldMatrix<Complex> matrix)
        Compute the eigen vectors using the inverse power method.
        Parameters:
        matrix - real matrix to compute eigen vectors.
      • checkDefinition

        protected void checkDefinition​(RealMatrix matrix)
        Check definition of the decomposition in runtime.
        Parameters:
        matrix - matrix to be decomposed.