Triangular Factorization (trf)

trf (defined in namespace flens::lapack) computes an \( LU \) factorization of a general \( m \times n \) matrix \( A \) using partial pivoting with row interchanges.

The factorization has the form

\[ A = P L U \]

where \( P \) is a permutation matrix, \( L \) is lower triangular with unit diagonal elements (lower trapezoidal if \( m > n \)), and \( U \) is upper triangular (upper trapezoidal if \( m < n \)).

Interface

A

(input/output) real or complex valued GeMatrix
On entry, the \( m \times n \) matrix to be factored.
On exit, the factors \( L \) and \( U \) from the factorization \( A = PLU \). The unit diagonal elements of \( L \) are not stored.

piv

(output) integer valued DenseVector
The pivot indices. For \( 1 \leq i \leq \min\{m, n\} \), row \( i \) of the matrix was interchanged with row \( piv_i \).

Return value:

i=0

Successful exit.

i>0

\( U_{i,i} \) is exactly zero. The factorization has been completed, but the factor \( U \) is exactly singular, so the solution could not be computed.

Notes