Class EigenPowerMethod_FDRM


  • public class EigenPowerMethod_FDRM
    extends java.lang.Object

    The power method is an iterative method that can be used to find dominant eigen vector in a matrix. Computing Anq for larger and larger values of n, where q is a vector. Eventually the dominant (if there is any) eigen vector will "win".

    Shift implementations find the eigen value of the matrix B=A-pI instead. This matrix has the same eigen vectors, but can converge much faster if p is chosen wisely.

    See section 5.3f in "Fundamentals of Matrix Computations" Second Edition, David S. Watkins.

    WARNING: These functions have well known conditions where they will not converge or converge very slowly and are only used in special situations in practice. I have also seen it converge to none dominant eigen vectors.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean computeDirect​(org.ejml.data.FMatrixRMaj A)
      This method computes the eigen vector with the largest eigen value by using the direct power method.
      boolean computeShiftDirect​(org.ejml.data.FMatrixRMaj A, float alpha)
      Computes the most dominant eigen vector of A using a shifted matrix.
      boolean computeShiftInvert​(org.ejml.data.FMatrixRMaj A, float alpha)
      Computes the most dominant eigen vector of A using an inverted shifted matrix.
      org.ejml.data.FMatrixRMaj getEigenVector()  
      void setOptions​(int maxIterations, float tolerance)  
      void setSeed​(org.ejml.data.FMatrixRMaj seed)
      Sets the value of the vector to use in the start of the iterations.
      • Methods inherited from class java.lang.Object

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

      • EigenPowerMethod_FDRM

        public EigenPowerMethod_FDRM​(int size)
        Parameters:
        size - The size of the matrix which can be processed.
    • Method Detail

      • setSeed

        public void setSeed​(org.ejml.data.FMatrixRMaj seed)
        Sets the value of the vector to use in the start of the iterations.
        Parameters:
        seed - The initial seed vector in the iteration.
      • setOptions

        public void setOptions​(int maxIterations,
                               float tolerance)
        Parameters:
        maxIterations -
        tolerance -
      • computeDirect

        public boolean computeDirect​(org.ejml.data.FMatrixRMaj A)
        This method computes the eigen vector with the largest eigen value by using the direct power method. This technique is the easiest to implement, but the slowest to converge. Works only if all the eigenvalues are real.
        Parameters:
        A - The matrix. Not modified.
        Returns:
        If it converged or not.
      • computeShiftDirect

        public boolean computeShiftDirect​(org.ejml.data.FMatrixRMaj A,
                                          float alpha)
        Computes the most dominant eigen vector of A using a shifted matrix. The shifted matrix is defined as B = A - αI and can converge faster if α is chosen wisely. In general it is easier to choose a value for α that will converge faster with the shift-invert strategy than this one.
        Parameters:
        A - The matrix.
        alpha - Shifting factor.
        Returns:
        If it converged or not.
      • computeShiftInvert

        public boolean computeShiftInvert​(org.ejml.data.FMatrixRMaj A,
                                          float alpha)
        Computes the most dominant eigen vector of A using an inverted shifted matrix. The inverted shifted matrix is defined as B = (A - αI)-1 and can converge faster if α is chosen wisely.
        Parameters:
        A - An invertible square matrix matrix.
        alpha - Shifting factor.
        Returns:
        If it converged or not.
      • getEigenVector

        public org.ejml.data.FMatrixRMaj getEigenVector()