Overload List
| # | Signature | Description |
|---|---|---|
| 1 | TMtx *LQR(TMtx *L, TMtx *Q, TMtx *R, bool Minimized = true) const; | QR or LQ factorization. |
| 2 | TMtx *LQR(TMtx *L, TMtx *Q, TMtx *R, TVecInt *P, bool Minimized = true) const; | QR or LQ factorization. |
Overload 1: TMtx *LQR(TMtx *L, TMtx *Q, TMtx *R, bool Minimized = true) const;
QR or LQ factorization.
Performs QR or LQ factorization. If Matrix::Rows is bigger or equal than Matrix::Cols for the calling matrix, the linear system of equations is overdetermined and the method performs QR factorization. The matrix L is not used and can be nil. If Rows is smaller than Cols, the linear system equations is underdetermined and the method performs LQ factorization. The matrix R is not used and can be nil. If the Matrix Q is nil, then it's not explicitly formed. If the pointer is not nil, the full size Q is computed. If you do not want economy size L, Q and R, set MinSize to false. The calling matrix must have full rank. If the rank is not full, use the Matrix::SVD method.
#include "MtxExpr.h"
using namespace Dew;
using namespace Dew::Math;
void Example()
{
Matrix Q, R, A;
A.SetIt(3, 2, false, DewArray<double>{1, 2, 3, 4, 3, 3});
A.LQR(nullptr, Q, R, false);
}
Overload 2: TMtx *LQR(TMtx *L, TMtx *Q, TMtx *R, TVecInt *P, bool Minimized = true) const;
QR or LQ factorization.
Performs QR factorization with optional pivoting or LQ factorization. The pivoting of columns in the calling matrix is performed only when P is not nil and Rows > Cols.
The P[i] holds the permutation of columns in A, so that:
P(A) = Q*R
#include "MtxExpr.h"
using namespace Dew;
using namespace Dew::Math;
void Example()
{
Matrix Q, R, A;
A = {{1, 2}, {3, 4}, {3, 3}};
A.LQR(nullptr, Q, R, false);
}