dsgesv#

Functions

void dsgesv(
    const INT             n,
    const INT             nrhs,
          f64*   restrict A,
    const INT             lda,
          INT*   restrict ipiv,
    const f64*   restrict B,
    const INT             ldb,
          f64*   restrict X,
    const INT             ldx,
          f64*   restrict work,
          float* restrict swork,
          INT*            iter,
          INT*            info
);
void dsgesv(const INT n, const INT nrhs, f64 *restrict A, const INT lda, INT *restrict ipiv, const f64 *restrict B, const INT ldb, f64 *restrict X, const INT ldx, f64 *restrict work, float *restrict swork, INT *iter, INT *info)#

DSGESV computes the solution to a real system of linear equations A * X = B, where A is an N-by-N matrix and X and B are N-by-NRHS matrices.

DSGESV first attempts to factorize the matrix in SINGLE PRECISION and use this factorization within an iterative refinement procedure to produce a solution with DOUBLE PRECISION normwise backward error quality. If the approach fails the method switches to a DOUBLE PRECISION factorization and solve.

Parameters

in
n

The number of linear equations, i.e., the order of A. n >= 0.

in
nrhs

The number of right hand sides. nrhs >= 0.

inout
A

On entry, the N-by-N coefficient matrix A. On exit, if iterative refinement succeeded (iter >= 0), A is unchanged. If f64 precision factorization was used (iter < 0), A contains the factors L and U from A = P*L*U. Array of dimension (lda, n).

in
lda

The leading dimension of A. lda >= max(1, n).

out
ipiv

The pivot indices. Array of dimension n, 0-based.

in
B

The N-by-NRHS right hand side matrix B. Array of dimension (ldb, nrhs).

in
ldb

The leading dimension of B. ldb >= max(1, n).

out
X

If info = 0, the N-by-NRHS solution matrix X. Array of dimension (ldx, nrhs).

in
ldx

The leading dimension of X. ldx >= max(1, n).

out
work

Double precision workspace for residual vectors. Array of dimension (n, nrhs).

out
swork

Single precision workspace for matrix and solutions. Array of dimension n*(n+nrhs).

out
iter

Iteration count:

  • < 0: iterative refinement has failed, f64 precision factorization has been performed

    • -1 : the routine fell back to full precision for implementation- or machine-specific reasons

    • -2 : narrowing the precision induced an overflow, the routine fell back to full precision

    • -3 : failure of SGETRF

    • -31: stop the iterative refinement after the 30th iterations

  • > 0: iterative refinement has been successfully used. Returns the number of iterations

out
info

Exit status:

  • = 0: successful exit

  • < 0: if info = -i, argument i had an illegal value

  • > 0: if info = i, U(i-1,i-1) is exactly zero