Visible to Intel only — GUID: GUID-4CC4330E-D9A9-4923-A2CE-F60D69EDCAA8
Visible to Intel only — GUID: GUID-4CC4330E-D9A9-4923-A2CE-F60D69EDCAA8
?gesv
Computes the solution to the system of linear equations with a square coefficient matrix A and multiple right-hand sides.
lapack_int LAPACKE_sgesv (int matrix_layout , lapack_int n , lapack_int nrhs , float * a , lapack_int lda , lapack_int * ipiv , float * b , lapack_int ldb );
lapack_int LAPACKE_dgesv (int matrix_layout , lapack_int n , lapack_int nrhs , double * a , lapack_int lda , lapack_int * ipiv , double * b , lapack_int ldb );
lapack_int LAPACKE_cgesv (int matrix_layout , lapack_int n , lapack_int nrhs , lapack_complex_float * a , lapack_int lda , lapack_int * ipiv , lapack_complex_float * b , lapack_int ldb );
lapack_int LAPACKE_zgesv (int matrix_layout , lapack_int n , lapack_int nrhs , lapack_complex_double * a , lapack_int lda , lapack_int * ipiv , lapack_complex_double * b , lapack_int ldb );
lapack_int LAPACKE_dsgesv (int matrix_layout, lapack_int n, lapack_int nrhs, double * a, lapack_int lda, lapack_int * ipiv, double * b, lapack_int ldb, double * x, lapack_int ldx, lapack_int * iter);
lapack_int LAPACKE_zcgesv (int matrix_layout, lapack_int n, lapack_int nrhs, lapack_complex_double * a, lapack_int lda, lapack_int * ipiv, lapack_complex_double * b, lapack_int ldb, lapack_complex_double * x, lapack_int ldx, lapack_int * iter);
- mkl.h
The routine solves for X the system of linear equations A*X = B, where A is an n-by-n matrix, the columns of matrix B are individual right-hand sides, and the columns of X are the corresponding solutions.
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.
The dsgesv and zcgesv are mixed precision iterative refinement subroutines for exploiting fast single precision hardware. They first attempt to factorize the matrix in single precision (dsgesv) or single complex precision (zcgesv) and use this factorization within an iterative refinement procedure to produce a solution with double precision (dsgesv) / double complex precision (zcgesv) normwise backward error quality (see below). If the approach fails, the method switches to a double precision or double complex precision factorization respectively and computes the solution.
The iterative refinement is not going to be a winning strategy if the ratio single precision performance over double precision performance is too small. A reasonable strategy should take the number of right-hand sides and the size of the matrix into account. This might be done with a call to ilaenv in the future. At present, iterative refinement is implemented.
The iterative refinement process is stopped if
iter > itermax
or for all the right-hand sides:
rnmr < sqrt(n)*xnrm*anrm*eps*bwdmax
where
- iter is the number of the current iteration in the iterativerefinement process
- rnmr is the infinity-norm of the residual
- xnrm is the infinity-norm of the solution
- anrm is the infinity-operator-norm of the matrix A
- eps is the machine epsilon returned by dlamch (‘Epsilon’).
matrix_layout |
Specifies whether matrix storage layout is row major (LAPACK_ROW_MAJOR) or column major (LAPACK_COL_MAJOR). |
n |
The number of linear equations, that is, the order of the matrix A; n≥ 0. |
nrhs |
The number of right-hand sides, that is, the number of columns of the matrix B; nrhs≥ 0. |
a |
The array a(size max(1, lda*n)) contains the n-by-n coefficient matrix A. |
b |
The array bof size max(1, ldb*nrhs) for column major layout and max(1, ldb*n) for row major layout contains the n-by-nrhs matrix of right hand side matrix B. |
lda |
The leading dimension of the array a; lda≥ max(1, n). |
ldb |
The leading dimension of the array b; ldb≥ max(1, n) for column major layout and ldb≥nrhs for row major layout. |
ldx |
The leading dimension of the array x; ldx≥ max(1, n) for column major layout and ldx≥nrhs for row major layout. |
a |
Overwritten by the factors L and U from the factorization of A = P*L*U; the unit diagonal elements of L are not stored. If iterative refinement has been successfully used (info= 0 and iter≥ 0), then A is unchanged. If double precision factorization has been used (info= 0 and iter < 0), then the array A contains the factors L and U from the factorization A = P*L*U; the unit diagonal elements of L are not stored. |
b |
Overwritten by the solution matrix X for dgesv, sgesv,zgesv,zgesv. Unchanged for dsgesv and zcgesv. |
ipiv |
Array, size at least max(1, n). The pivot indices that define the permutation matrix P; row i of the matrix was interchanged with row ipiv[i-1]. Corresponds to the single precision factorization (if info= 0 and iter≥ 0) or the double precision factorization (if info= 0 and iter < 0). |
x |
Array, size max(1, ldx*nrhs) for column major layout and max(1, ldx*n) for row major layout. If info = 0, contains the n-by-nrhs solution matrix X. |
iter |
If iter < 0: iterative refinement has failed, double precision factorization has been performed
If iter > 0: iterative refinement has been successfully used. Returns the number of iterations. |
This function returns a value info.
If info=0, the execution is successful.
If info = -i, parameter i had an illegal value.
If info = i, Ui, i (computed in double precision for mixed precision subroutines) is exactly zero. The factorization has been completed, but the factor U is exactly singular, so the solution could not be computed.