Computes the solution to the system of linear equations with a square coefficient matrix A and multiple right-hand sides.
The routine solves for
Xthe system of linear equations
nmatrix, the columns of matrix
Bare individual right-hand sides, and the columns of
Xare the corresponding solutions.
LUdecomposition with partial pivoting and row interchanges is used to factor
Pis a permutation matrix,
Lis unit lower triangular, and
Uis upper triangular. The factored form of
Ais then used to solve the system of equations
zcgesvare 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
ilaenvin 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