Class BaseLinearSolverQrp_FDRM

  • All Implemented Interfaces:
    org.ejml.interfaces.linsol.LinearSolver<org.ejml.data.FMatrixRMaj,​org.ejml.data.FMatrixRMaj>, org.ejml.interfaces.linsol.LinearSolverDense<org.ejml.data.FMatrixRMaj>
    Direct Known Subclasses:
    LinearSolverQrpHouseCol_FDRM, SolvePseudoInverseQrp_FDRM

    public abstract class BaseLinearSolverQrp_FDRM
    extends LinearSolverAbstract_FDRM

    Base class for QR pivot based pseudo inverse classes. It will return either the basic of minimal 2-norm solution. See [1] for details. The minimal 2-norm solution refers to the solution 'x' whose 2-norm is the smallest making it unique, not some other error function.

     R = [ R12  R12 ] r      P^T*x = [ y ] r       Q^T*b = [ c ] r
         [  0    0  ] m-r            [ z ] n -r            [ d ] m-r
            r   n-r
    
     where r is the rank of the matrix and (m,n) is the dimension of the linear system.
     
     The solution 'x' is found by solving the system below.  The basic solution is found by setting z=0
    
         [ R_11^-1*(c - R12*z) ]
     x = [          z          ]
     

    NOTE: The matrix rank is determined using the provided QR decomposition. [1] mentions that this will not always work and could cause some problems.

    [1] See page 258-259 in Gene H. Golub and Charles F. Van Loan "Matrix Computations" 3rd Ed, 1996

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.ejml.data.FMatrixRMaj I  
      protected org.ejml.interfaces.linsol.LinearSolverDense<org.ejml.data.FMatrixRMaj> internalSolver  
      protected boolean norm2Solution  
      protected org.ejml.data.FMatrixRMaj R  
      protected org.ejml.data.FMatrixRMaj R11  
      protected int rank  
      protected org.ejml.data.FMatrixRMaj Y  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected BaseLinearSolverQrp_FDRM​(org.ejml.interfaces.decomposition.QRPDecomposition_F32<org.ejml.data.FMatrixRMaj> decomposition, boolean norm2Solution)
      Configures internal parameters.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.ejml.interfaces.decomposition.QRPDecomposition_F32<org.ejml.data.FMatrixRMaj> getDecomposition()  
      void invert​(org.ejml.data.FMatrixRMaj A_inv)  
      double quality()  
      boolean setA​(org.ejml.data.FMatrixRMaj A)  
      protected void upgradeSolution​(org.ejml.data.FMatrixRMaj X)
      Upgrades the basic solution to the optimal 2-norm solution.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.ejml.interfaces.linsol.LinearSolver

        modifiesA, modifiesB, solve
    • Field Detail

      • norm2Solution

        protected boolean norm2Solution
      • Y

        protected org.ejml.data.FMatrixRMaj Y
      • R

        protected org.ejml.data.FMatrixRMaj R
      • R11

        protected org.ejml.data.FMatrixRMaj R11
      • I

        protected org.ejml.data.FMatrixRMaj I
      • rank

        protected int rank
      • internalSolver

        protected org.ejml.interfaces.linsol.LinearSolverDense<org.ejml.data.FMatrixRMaj> internalSolver
    • Constructor Detail

      • BaseLinearSolverQrp_FDRM

        protected BaseLinearSolverQrp_FDRM​(org.ejml.interfaces.decomposition.QRPDecomposition_F32<org.ejml.data.FMatrixRMaj> decomposition,
                                           boolean norm2Solution)
        Configures internal parameters.
        Parameters:
        decomposition - Used to solve the linear system.
        norm2Solution - If true then the optimal 2-norm solution will be computed for degenerate systems.
    • Method Detail

      • setA

        public boolean setA​(org.ejml.data.FMatrixRMaj A)
      • quality

        public double quality()
      • upgradeSolution

        protected void upgradeSolution​(org.ejml.data.FMatrixRMaj X)

        Upgrades the basic solution to the optimal 2-norm solution.

         First solves for 'z'
        
               || x_b - P*[ R_11^-1 * R_12 ] * z ||2
         min z ||         [ - I_{n-r}      ]     ||
        
         
        Parameters:
        X - basic solution, also output solution
      • invert

        public void invert​(org.ejml.data.FMatrixRMaj A_inv)
        Specified by:
        invert in interface org.ejml.interfaces.linsol.LinearSolverDense<org.ejml.data.FMatrixRMaj>
        Overrides:
        invert in class LinearSolverAbstract_FDRM
      • getDecomposition

        public org.ejml.interfaces.decomposition.QRPDecomposition_F32<org.ejml.data.FMatrixRMaj> getDecomposition()