Class ComplexLstsqSolver
- All Implemented Interfaces:
LinearMatrixSolver<CMatrix,
,CVector> LinearSolver<CMatrix>
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
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:
- Create an instance of
RealLstsqSolver
. - Call
decompse(A)
once on the coefficient matrix \( A \). - Call
solve(b)
orsolve(B)
as many times as needed to solve each system for with the various \( b \) vectors and/or \( B \) matrices.
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:
-
Field Summary
Fields inherited from class org.flag4j.linalg.solvers.lstsq.LstsqSolver
backSolver, Qh, qr, R
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a solver for solving complex linear systems of the form Ax = b or AX = B in a least-squares sense. -
Method Summary
-
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
-