XLPack 6.1
C/C++ API Reference Manual (Basic module)
Loading...
Searching...
No Matches

◆ _dgesv()

void _dgesv ( int  n,
int  nrhs,
int  lda,
double  a[],
int  ipiv[],
int  ldb,
double  b[],
int *  info 
)

(Simple driver) Solution to system of linear equations AX = B for a general matrix

Purpose
This routine computes the solution to a real system of linear equations
A * X = B
where A is an n x n matrix and X and B are n x nrhs matrices.

The LU decomposition with partial pivoting and row interchanges is used to factor A as
A = P * L * U
where P is a permutation matrix, L is unit lower triangular, and U is upper triangular. The factored form of A is then used to solve the system of equations A * X = B.
Parameters
[in]nNumber of linear equations, i.e., order of the matrix A. (n >= 0) (if n = 0, returns without computation)
[in]nrhsNumber of right hand sides, i.e., number of columns of the matrix B. (nrhs >= 0) (if nrhs = 0, returns without computation)
[in]ldaLeading dimension of the two dimensional array a[][]. (lda >= max(1, n))
[in,out]a[][]Array a[la][lda] (la >= n)
[in] n x n coefficient matrix A.
[out] Factors L and U from the factorization A = P*L*U; the unit diagonal elements of L are not stored.
[out]ipiv[]Array ipiv[lipiv] (lipiv >= n)
Pivot indices that define the permutation matrix P; row i of the matrix was interchanged with row ipiv[i-1].
[in]ldbLeading dimension of the two dimensional array b[][]. (ldb >= max(1, n))
[in,out]b[][]Array b[lb][ldb] (lb >= nrhs)
[in] n x nrhs matrix of right hand side matrix B.
[out] If info = 0, n x nrhs solution matrix X.
[out]info= 0: Successful exit
= -1: The argument n had an illegal value (n < 0)
= -2: The argument nrhs had an illegal value (nrhs < 0)
= -3: The argument lda had an illegal value (lda < max(1, n))
= -6: The argument ldb had an illegal value (ldb < max(1, n))
= i > 0: The i-th diagonal element of the factor U is exactly zero. The factorization has been completed, but the factor U is exactly singular, so the solution could not be computed.
Reference
LAPACK