Content |
Solve a System of Linear Equations (svx)
svx (defined in namespace flens::lapack) uses the \(LU\) factorization to compute the solution to a real system of linear equations
\[ A X = B, \]where \(A\) is an \(n \times n\) matrix and \(X\) and \(B\) are \(n \times n_{rhs}\) matrices.
Error bounds on the solution and a condition estimate are also provided.
Description
The following steps are performed:
-
If fact = Equilibrate, real scaling factors are computed to equilibrate the system:
-
trans = NoTrans: \(\text{diag}(r)\,A\,\text{diag}(c)\; \text{diag}(c)^{-1}\,X = \text{diag}(r)\,B\)
-
trans = Trans: \(\left(\text{diag}(r)\,A\,\text{diag}(c)\right)^T\; \text{diag}(c)^{-1}\,X = \text{diag}(c)\,B\)
-
trans = ConjTrans: \(\left(\text{diag}(r)\,A\,\text{diag}(c)\right)^H\; \text{diag}(c)^{-1}\,X = \text{diag}(c)\,B\).
Whether or not the system will be equilibrated depends on the scaling of the matrix \(A\), but if equilibration is used, \(A\) is overwritten by \(\text{diag}(r)\,A\,\text{diag}(c)\) and \(B\) by \(\text{diag}(r)\,B\) (if trans = NoTrans) or \(\text{diag}(c)\,B\) (otherwise).
-
-
If fact = NotFactored or fact = Equilibrate, the \(LU\) decomposition is used to factor the matrix \(A\) (after equilibration if fact = Equilibrate) as
\[ A = P L U, \]where \(P\) is a permutation matrix, \(L\) is a unit lower triangular matrix, and \(U\) is upper triangular.
-
If some \(U_{i,i}=0\), so that \(U\) is exactly singular, then the routine returns index \(i\). Otherwise, the factored form of \(A\) is used to estimate the condition number of the matrix \(A\). If the reciprocal of the condition number is less than machine precision, \(n+1\) is returned as a warning, but the routine still goes on to solve for \(X\) and compute error bounds as described below.
-
The system of equations is solved for \(X\) using the factored form of \(A\).
-
Iterative refinement is applied to improve the computed solution matrix and calculate error bounds and backward error estimates for it.
-
If equilibration was used, the matrix \(X\) is premultiplied by \(\text{diag}(c)\) (if trans = NoTrans) or \(\text{diag}(r)\) (otherwise) so that it solves the original system before equilibration.
Interface
|
fact |
(input)
|
||||||||
|
trans |
(input)
|
||||||||
|
A |
(input/output) real valued GeMatrix On exit, if equed is not None, \(A\) is scaled as follows:
|
||||||||
|
AF |
(input or output) real valued GeMatrix If fact = NotFactored, then \(AF\) is an output argument and on exit returns the factors \(L\) and \(U\) from the factorization \(A = P L U\) of the original matrix \(A\). If fact = Equilibrate, then \(AF\) is an output argument and on exit returns the factors \(L\) and \(U\) from the factorization \(A = PLU\) of the equilibrated matrix \(A\) (see the description of \(A\) for the form of the equilibrated matrix). |
||||||||
|
piv |
(input or output) INTEGER array, dimension (N) If fact = NotFactored, then \(piv\) is an output argument and on exit contains the pivot indices from the factorization \(A = P L U\) of the original matrix \(A\). If fact = Equilibrate, then \(piv\) is an output argument and on exit contains the pivot indices from the factorization \(A = P L U\) of the equilibrated matrix \(A\). |
||||||||
|
equed |
(input or output)
equed is an input argument if fact = Factored; otherwise, it is an output argument. |
||||||||
|
r |
(input or output) real valued DenseVector |
||||||||
|
c |
(input or output) real valued DenseVector |
||||||||
|
B |
(input/output) real valued GeMatrix
|
||||||||
|
X |
(output) real values GeMatrix |
||||||||
|
rCond |
(output) real number |
||||||||
|
fErr |
(output) real valued DenseVector |
||||||||
|
bErr |
(output) real valued DenseVector |
||||||||
|
work |
(workspace/output) real valued DenseVector, dimension (4n) |
||||||||
|
iWork |
(workspace) integer valued DenseVector, dimension (n) |
Return value:
|
\(i=0\) |
successful exit |
|
\(0< i \leq n\) |
\(U_{i,i}\) is exactly zero. The factorization has been completed, but the factor U is exactly singular, so the solution and error bounds could not be computed. \(rCond =0 \) is returned. |
|
\(i=n+1\) |
\(U\) is nonsingular, but \(rCond\) is less than machine precision, meaning that the matrix is singular to working precision. Nevertheless, the solution and error bounds are computed because there are a number of situations where the computed solution can be more accurate than the value of \(rCond\) would suggest. |