Class ComplexLstsqSolver

java.lang.Object
org.flag4j.linalg.solvers.lstsq.LstsqSolver<CMatrix,CVector>
org.flag4j.linalg.solvers.lstsq.ComplexLstsqSolver
All Implemented Interfaces:
LinearMatrixSolver<CMatrix,CVector>, LinearSolver<CMatrix>

public class ComplexLstsqSolver extends LstsqSolver<CMatrix,CVector>

Instances of this class solve complex linear systems of the form \( Ax = b \) or \( AX = B \) in a least-squares sense. The system may be under-, well-, or over-determined. Specifically, this solver minimizes the sum of squared residuals:

  • \( ||Ax - b||_{2}^{2} \) for vector-based problems, or
  • \( ||AX - B||_{F}^{2} \) for matrix-based where problems
where \( ||\cdot||_{2} \) is the Euclidean vector norm and \( ||\cdot||_{F} \) is the Frobenius norm. This is equivalent to solving the normal equations given by: \( A^{H}Ax = A^{H}b \) or \( A^{H}AX = A^{H}B \)

Usage:

A single system may be solved by calling either LstsqSolver.solve(MatrixMixin, VectorMixin) or LstsqSolver.solve(MatrixMixin, VectorMixin).

Instances of this solver may also be used to efficiently solve many systems of the form \( Ax = b \) or \( AX = B \) for the same coefficient matrix \( A \) but numerous constant vectors/matrices \( b \) or \( B \). To do this, the workflow would be as follows:

  1. Create an instance of RealLstsqSolver.
  2. Call decompse(A) once on the coefficient matrix \( A \).
  3. Call solve(b) or solve(B) as many times as needed to solve each system for with the various \( b \) vectors and/or \( B \) matrices.
Note: Any call made to one of the following methods after a call to decompse(A) will override the coefficient matrix set that call:

Implementation Notes:

Minimizing the sum of squared residuals is achieved by computing a QR decomposition of the coefficient matrix \( A \): \[ A = QR \] where \( Q \) is a unity matrix and \( R \) is an upper triangular matrix. The normal equations then reduces to: \[ \begin{alignat*}{6} & &A^HAx &= A^Hb &&\; \text{ or }\; &A^HAX &= A^HB \\ &\implies &(QR)^HQRx &= (QR)^Hb &&\; \text{ or }\; &(QR)^HQRX &= (QR)^HB \\ &\implies &R^HQ^HQRx &= R^HQ^Hb &&\; \text{ or }\; &R^HQ^HQRX &= R^HQ^HB \\ &\implies &R^HRx &= R^HQ^Hb &&\; \text{ or }\; &R^HRX &= R^HQ^HB \quad \text{ since } Q \text{ is unity.} \\ &\implies &Rx &= Q^Hb &&\; \text{ or }\; & RX &= Q^HB \end{alignat*} \] which is easily solved by back-substitution on \( R \).

See Also:
  • Constructor Details

    • ComplexLstsqSolver

      public ComplexLstsqSolver()
      Creates a solver for solving complex linear systems of the form Ax = b or AX = B in a least-squares sense. The system may be under-, well-, or over-determined. The solution is computed by minimizing the sum of squared residuals:
      • ||Ax - b||22 for vector-based problems, or
      • ||AX - B||F2 for matrix-based where problems