Developer Reference for Intel® oneAPI Math Kernel Library for Fortran

ID 766686
Date 12/16/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

?gesvxx

Uses extra precise iterative refinement to compute the solution to the system of linear equations with a square coefficient matrix A and multiple right-hand sides

Syntax

call sgesvxx( fact, trans, n, nrhs, a, lda, af, ldaf, ipiv, equed, r, c, b, ldb, x, ldx, rcond, rpvgrw, berr, n_err_bnds, err_bnds_norm, err_bnds_comp, nparams, params, work, iwork, info )

call dgesvxx( fact, trans, n, nrhs, a, lda, af, ldaf, ipiv, equed, r, c, b, ldb, x, ldx, rcond, rpvgrw, berr, n_err_bnds, err_bnds_norm, err_bnds_comp, nparams, params, work, iwork, info )

call cgesvxx( fact, trans, n, nrhs, a, lda, af, ldaf, ipiv, equed, r, c, b, ldb, x, ldx, rcond, rpvgrw, berr, n_err_bnds, err_bnds_norm, err_bnds_comp, nparams, params, work, rwork, info )

call zgesvxx( fact, trans, n, nrhs, a, lda, af, ldaf, ipiv, equed, r, c, b, ldb, x, ldx, rcond, rpvgrw, berr, n_err_bnds, err_bnds_norm, err_bnds_comp, nparams, params, work, rwork, info )

Include Files
  • mkl.fi, lapack.f90
Description

The routine uses the LU factorization to compute the solution to a real or complex system of linear equations A*X = B, where A is an n-by-n matrix, the columns of the matrix B are individual right-hand sides, and the columns of X are the corresponding solutions.

Both normwise and maximum componentwise error bounds are also provided on request. The routine returns a solution with a small guaranteed error (O(eps), where eps is the working machine precision) unless the matrix is very ill-conditioned, in which case a warning is returned. Relevant condition numbers are also calculated and returned.

The routine accepts user-provided factorizations and equilibration factors; see definitions of the fact and equed options. Solving with refinement and using a factorization from a previous call of the routine also produces a solution with O(eps) errors or warnings but that may not be true for general user-provided factorizations and equilibration factors if they differ from what the routine would itself produce.

The routine ?gesvxx performs the following steps:

  1. If fact = 'E', scaling factors r and c are computed to equilibrate the system:

    trans = 'N': diag(r)*A*diag(c)*inv(diag(c))*X = diag(r)*B

    trans = 'T': (diag(r)*A*diag(c))T*inv(diag(r))*X = diag(c)*B

    trans = 'C': (diag(r)*A*diag(c))H*inv(diag(r))*X = 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 diag(r)*A*diag(c) and B by diag(r)*B (if trans='N') or diag(c)*B (if trans = 'T' or 'C').

  2. If fact = 'N' or 'E', the LU decomposition is used to factor the matrix A (after equilibration if fact = 'E') as A = P*L*U, where P is a permutation matrix, L is a unit lower triangular matrix, and U is upper triangular.

  3. If some Ui,i= 0, so that U is exactly singular, then the routine returns with info = i. Otherwise, the factored form of A is used to estimate the condition number of the matrix A (see the rcond parameter). If the reciprocal of the condition number is less than machine precision, the routine still goes on to solve for X and compute error bounds.

  4. The system of equations is solved for X using the factored form of A.

  5. By default, unless params(la_linrx_itref_i) is set to zero, the routine applies iterative refinement to improve the computed solution matrix and calculate error bounds. Refinement calculates the residual to at least twice the working precision.

  6. If equilibration was used, the matrix X is premultiplied by diag(c) (if trans = 'N') or diag(r) (if trans = 'T' or 'C') so that it solves the original system before equilibration.

Input Parameters

fact

CHARACTER*1. Must be 'F', 'N', or 'E'.

Specifies whether or not the factored form of the matrix A is supplied on entry, and if not, whether the matrix A should be equilibrated before it is factored.

If fact = 'F', on entry, af and ipiv contain the factored form of A. If equed is not 'N', the matrix A has been equilibrated with scaling factors given by r and c. Parameters a, af, and ipiv are not modified.

If fact = 'N', the matrix A will be copied to af and factored.

If fact = 'E', the matrix A will be equilibrated, if necessary, copied to af and factored.

trans

CHARACTER*1. Must be 'N', 'T', or 'C'.

Specifies the form of the system of equations:

If trans = 'N', the system has the form A*X = B (No transpose).

If trans = 'T', the system has the form AT*X = B (Transpose).

If trans = 'C', the system has the form AH*X = B (Conjugate Transpose = Transpose for real flavors, Conjugate Transpose for complex flavors).

n

INTEGER. The number of linear equations; the order of the matrix A; n 0.

nrhs

INTEGER. The number of right hand sides; the number of columns of the matrices B and X; nrhs 0.

a, af, b, work

REAL for sgesvxx

DOUBLE PRECISION for dgesvxx

COMPLEX for cgesvxx

DOUBLE COMPLEX for zgesvxx.

Arrays: a(size lda by *), af(size ldafby *), b(size ldb by *), work(*).

The array a contains the matrix A. If fact = 'F' and equed is not 'N', then A must have been equilibrated by the scaling factors in r and/or c. The second dimension of a must be at least max(1,n).

The array af is an input argument if fact = 'F'. It contains the factored form of the matrix A, that is, the factors L and U from the factorization A = P*L*U as computed by ?getrf. If equed is not 'N', then af is the factored form of the equilibrated matrix A. The second dimension of af must be at least max(1,n).

The array b contains the matrix B whose columns are the right-hand sides for the systems of equations. The second dimension of b must be at least max(1,nrhs).

work(*) is a workspace array. The dimension of work must be at least max(1,4*n) for real flavors, and at least max(1,2*n) for complex flavors.

lda

INTEGER. The leading dimension of a; lda max(1, n).

ldaf

INTEGER. The leading dimension of af; ldaf max(1, n).

ipiv

INTEGER.

Array, size at least max(1, n). The array ipiv is an input argument if fact = 'F'. It contains the pivot indices from the factorization A = P*L*U as computed by ?getrf; row i of the matrix was interchanged with row ipiv(i).

equed

CHARACTER*1. Must be 'N', 'R', 'C', or 'B'.

equed is an input argument if fact = 'F'. It specifies the form of equilibration that was done:

If equed = 'N', no equilibration was done (always true if fact = 'N').

If equed = 'R', row equilibration was done, that is, A has been premultiplied by diag(r).

If equed = 'C', column equilibration was done, that is, A has been postmultiplied by diag(c).

If equed = 'B', both row and column equilibration was done, that is, A has been replaced by diag(r)*A*diag(c).

r, c

REAL for single precision flavors

DOUBLE PRECISION for double precision flavors.

Arrays: r (size n), c (size n). The array r contains the row scale factors for A, and the array c contains the column scale factors for A. These arrays are input arguments if fact = 'F' only; otherwise they are output arguments.

If equed = 'R' or 'B', A is multiplied on the left by diag(r); if equed = 'N' or 'C', r is not accessed.

If fact = 'F' and equed = 'R'or 'B', each element of r must be positive.

If equed = 'C' or 'B', A is multiplied on the right by diag(c); if equed = 'N' or 'R', c is not accessed.

If fact = 'F' and equed = 'C' or 'B', each element of c must be positive.

Each element of r or c should be a power of the radix to ensure a reliable solution and error estimates. Scaling by powers of the radix does not cause rounding errors unless the result underflows or overflows. Rounding errors during scaling lead to refining with a matrix that is not equivalent to the input matrix, producing error estimates that may not be reliable.

ldb

INTEGER. The leading dimension of the array b; ldb max(1, n).

ldx

INTEGER. The leading dimension of the output array x; ldx max(1, n).

n_err_bnds

INTEGER. Number of error bounds to return for each right hand side and each type (normwise or componentwise). See err_bnds_norm and err_bnds_comp descriptions in Output Arguments section below.

nparams

INTEGER. Specifies the number of parameters set in params. If 0, the params array is never referenced and default values are used.

params

REAL for single precision flavors

DOUBLE PRECISION for double precision flavors.

Array, size max(1, nparams). Specifies algorithm parameters. If an entry is less than 0.0, that entry is filled with the default value used for that parameter. Only positions up to nparams are accessed; defaults are used for higher-numbered parameters. If defaults are acceptable, you can pass nparams = 0, which prevents the source code from accessing the params argument.

params(1) : Whether to perform iterative refinement or not. Default: 1.0

=0.0

No refinement is performed and no error bounds are computed.

=1.0

Use the double-precision refinement algorithm, possibly with doubled-single computations if the compilation environment does not support double precision.

(Other values are reserved for future use.)

params(2) : Maximum number of residual computations allowed for refinement.

Default

10.0

Aggressive

Set to 100.0 to permit convergence using approximate factorizations or factorizations other than LU. If the factorization uses a technique other than Gaussian elimination, the guarantees in err_bnds_norm and err_bnds_comp may no longer be trustworthy.

params(3) : Flag determining if the code will attempt to find a solution with a small componentwise relative error in the double-precision algorithm. Positive is true, 0.0 is false. Default: 1.0 (attempt componentwise convergence).

iwork

INTEGER. Workspace array, size at least max(1, n); used in real flavors only.

rwork

REAL for single precision flavors

DOUBLE PRECISION for double precision flavors.

Workspace array, size at least max(1, 3*n); used in complex flavors only.

Output Parameters
x

REAL for sgesvxx

DOUBLE PRECISION for dgesvxx

COMPLEX for cgesvxx

DOUBLE COMPLEX for zgesvxx.

Array, size (ldx,*).

If info = 0, the array x contains the solution n-by-nrhs matrix X to the original system of equations. Note that A and B are modified on exit if equed'N', and the solution to the equilibrated system is:

inv(diag(c))*X, if trans = 'N' and equed = 'C' or 'B'; or inv(diag(r))*X, if trans = 'T' or 'C' and equed = 'R' or 'B'. The second dimension of x must be at least max(1,nrhs).

a

Array a is not modified on exit if fact = 'F' or 'N', or if fact = 'E' and equed = 'N'.

If equed'N', A is scaled on exit as follows:

equed = 'R': A = diag(r)*A

equed = 'C': A = A*diag(c)

equed = 'B': A = diag(r)*A*diag(c).

af

If fact = 'N' or 'E', then af is an output argument and on exit returns the factors L and U from the factorization A = PLU of the original matrix A (if fact = 'N') or of the equilibrated matrix A (if fact = 'E'). See the description of a for the form of the equilibrated matrix.

b

Overwritten by diag(r)*B if trans = 'N' and equed = 'R' or 'B';

overwritten by trans = 'T' or 'C' and equed = 'C' or 'B';

not changed if equed = 'N'.

r, c

These arrays are output arguments if fact'F'. Each element of these arrays is a power of the radix. See the description of r, c in Input Arguments section.

rcond

REAL for single precision flavors

DOUBLE PRECISION for double precision flavors.

Reciprocal scaled condition number. An estimate of the reciprocal Skeel condition number of the matrix A after equilibration (if done). If rcond is less than the machine precision, in particular, if rcond = 0, the matrix is singular to working precision. Note that the error may still be small even if this number is very small and the matrix appears ill-conditioned.

rpvgrw

REAL for single precision flavors

DOUBLE PRECISION for double precision flavors.

Contains the reciprocal pivot growth factor:

If this is much less than 1, the stability of the LU factorization of the (equlibrated) matrix A could be poor. This also means that the solution X, estimated condition numbers, and error bounds could be unreliable. If factorization fails with 0 < infon, this parameter contains the reciprocal pivot growth factor for the leading info columns of A. In ?gesvx, this quantity is returned in work(1).

berr

REAL for single precision flavors

DOUBLE PRECISION for double precision flavors.

Array, size at least max(1, nrhs). Contains the componentwise relative backward error for each solution vector x(j), that is, the smallest relative change in any element of A or B that makes x(j) an exact solution.

err_bnds_norm

REAL for single precision flavors

DOUBLE PRECISION for double precision flavors.

Array of size nrhs by n_err_bnds. For each right-hand side, contains information about various error bounds and condition numbers corresponding to the normwise relative error, which is defined as follows:

Normwise relative error in the i-th solution vector

The array is indexed by the type of error information as described below. There are currently up to three pieces of information returned.

The first index in err_bnds_norm(i,:) corresponds to the i-th right-hand side.

The second index in err_bnds_norm(:,err) contains the following three fields:

err=1

"Trust/don't trust" boolean. Trust the answer if the reciprocal condition number is less than the threshold sqrt(n)*slamch(ε) for single precision flavors and sqrt(n)*dlamch(ε) for double precision flavors.

err=2

"Guaranteed" error bound. The estimated forward error, almost certainly within a factor of 10 of the true error so long as the next entry is greater than the threshold sqrt(n)*slamch(ε) for single precision flavors and sqrt(n)*dlamch(ε) for double precision flavors. This error bound should only be trusted if the previous boolean is true.

err=3

Reciprocal condition number. Estimated normwise reciprocal condition number. Compared with the threshold sqrt(n)*slamch(ε) for single precision flavors and sqrt(n)*dlamch(ε) for double precision flavors to determine if the error estimate is "guaranteed". These reciprocal condition numbers for some appropriately scaled matrix Z are:

Let z=s*a, where s scales each row by a power of the radix so all absolute row sums of z are approximately 1.

err_bnds_comp

REAL for single precision flavors

DOUBLE PRECISION for double precision flavors.

Array of size nrhs by n_err_bnds. For each right-hand side, contains information about various error bounds and condition numbers corresponding to the componentwise relative error, which is defined as follows:

Componentwise relative error in the i-th solution vector:

The array is indexed by the right-hand side i, on which the componentwise relative error depends, and by the type of error information as described below. There are currently up to three pieces of information returned for each right-hand side. If componentwise accuracy is not requested (params(3) = 0.0), then err_bnds_comp is not accessed. If n_err_bnds < 3, then at most the first (:,n_err_bnds) entries are returned.

The first index in err_bnds_comp(i,:) corresponds to the i-th right-hand side.

The second index in err_bnds_comp(:,err) contains the following three fields:

err=1

"Trust/don't trust" boolean. Trust the answer if the reciprocal condition number is less than the threshold sqrt(n)*slamch(ε) for single precision flavors and sqrt(n)*dlamch(ε) for double precision flavors.

err=2

"Guaranteed" error bpound. The estimated forward error, almost certainly within a factor of 10 of the true error so long as the next entry is greater than the threshold sqrt(n)*slamch(ε) for single precision flavors and sqrt(n)*dlamch(ε) for double precision flavors. This error bound should only be trusted if the previous boolean is true.

err=3

Reciprocal condition number. Estimated componentwise reciprocal condition number. Compared with the threshold sqrt(n)*slamch(ε) for single precision flavors and sqrt(n)*dlamch(ε) for double precision flavors to determine if the error estimate is "guaranteed". These reciprocal condition numbers for some appropriately scaled matrix Z are:

Let z=s*(a*diag(x)), where x is the solution for the current right-hand side and s scales each row of a*diag(x) by a power of the radix so all absolute row sums of z are approximately 1.

ipiv

If fact = 'N' or 'E', then ipiv 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 = 'N') or of the equilibrated matrix A (if fact = 'E').

equed

If fact'F', then equed is an output argument. It specifies the form of equilibration that was done (see the description of equed in Input Arguments section).

params

If an entry is less than 0.0, that entry is filled with the default value used for that parameter, otherwise the entry is not modified

info

INTEGER. If info = 0, the execution is successful. The solution to every right-hand side is guaranteed.

If info = -i, the i-th parameter had an illegal value.

If 0 < infon: U(info,info) 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.

If info = n+j: The solution corresponding to the j-th right-hand side is not guaranteed. The solutions corresponding to other right-hand sides k with k > j may not be guaranteed as well, but only the first such right-hand side is reported. If a small componentwise error is not requested params(3) = 0.0, then the j-th right-hand side is the first with a normwise error bound that is not guaranteed (the smallest j such that err_bnds_norm(j,1) = 0.0 or err_bnds_comp(j,1) = 0.0. See the definition of err_bnds_norm and err_bnds_comp for err = 1. To get information about all of the right-hand sides, check err_bnds_norm or err_bnds_comp.