?posv
?posv
Computes the solution to the system of linear equations with a symmetric or Hermitian positive-definite coefficient matrix A and multiple right-hand sides.
Syntax
lapack_int
LAPACKE_sposv
(
int
matrix_layout
,
char
uplo
,
lapack_int
n
,
lapack_int
nrhs
,
float
*
a
,
lapack_int
lda
,
float
*
b
,
lapack_int
ldb
);
lapack_int
LAPACKE_dposv
(
int
matrix_layout
,
char
uplo
,
lapack_int
n
,
lapack_int
nrhs
,
double
*
a
,
lapack_int
lda
,
double
*
b
,
lapack_int
ldb
);
lapack_int
LAPACKE_cposv
(
int
matrix_layout
,
char
uplo
,
lapack_int
n
,
lapack_int
nrhs
,
lapack_complex_float
*
a
,
lapack_int
lda
,
lapack_complex_float
*
b
,
lapack_int
ldb
);
lapack_int
LAPACKE_zposv
(
int
matrix_layout
,
char
uplo
,
lapack_int
n
,
lapack_int
nrhs
,
lapack_complex_double
*
a
,
lapack_int
lda
,
lapack_complex_double
*
b
,
lapack_int
ldb
);
lapack_int
LAPACKE_dsposv
(
int
matrix_layout
,
char
uplo
,
lapack_int
n
,
lapack_int
nrhs
,
double
*
a
,
lapack_int
lda
,
double
*
b
,
lapack_int
ldb
,
double
*
x
,
lapack_int
ldx
,
lapack_int
*
iter
);
lapack_int
LAPACKE_zcposv
(
int
matrix_layout
,
char
uplo
,
lapack_int
n
,
lapack_int
nrhs
,
lapack_complex_double
*
a
,
lapack_int
lda
,
lapack_complex_double
*
b
,
lapack_int
ldb
,
lapack_complex_double
*
x
,
lapack_int
ldx
,
lapack_int
*
iter
);
Include Files
- mkl.h
Description
The routine solves for , where
X
the real or complex system of linear equations A*X
= B
A
is an n
-by-n
symmetric/Hermitian positive-definite matrix, the columns of matrix B
are individual right-hand sides, and the columns of X
are the corresponding solutions.The Cholesky decomposition is used to factor
A
asA
= U
T
*U
(real flavors) and A
= U
H
*U
(complex flavors), if uplo
= 'U'
or (real flavors) and (complex flavors), if ,
A
= L*L
T
A
= L*L
H
uplo
= 'L'
where .
U
is an upper triangular matrix and L
is a lower triangular matrix. The factored form of A
is then used to solve the system of equations A*X
= B
The
dsposv
and zcposv
are mixed precision iterative refinement subroutines for exploiting fast single precision hardware. They first attempt to factorize the matrix in single precision (dsposv
) or single complex precision (zcposv
) and use this factorization within an iterative refinement procedure to produce a solution with double precision (dsposv
) / double complex precision (zcposv
) 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/complex performance over double precision/double complex 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- iteris the number of the current iteration in the iterative refinement process
- rnmris the infinity-norm of the residual
- xnrmis the infinity-norm of the solution
- anrmis the infinity-operator-norm of the matrixA
- epsis the machine epsilon returned bydlamch(‘Epsilon’).
itermax
and bwdmax
are fixed to 30 and 1.0d+00 respectively.Input Parameters
- matrix_layout
- Specifies whether matrix storage layout is row major (LAPACK_ROW_MAJOR) or column major (LAPACK_COL_MAJOR).
- uplo
- Must be'U'or'L'.Indicates whether the upper or lower triangular part ofAis stored:If, the upper triangle ofuplo='U'Ais stored.If, the lower triangle ofuplo='L'Ais stored.
- n
- The order of matrixA;n≥0.
- nrhs
- The number of right-hand sides, the number of columns in.B;nrhs≥0
- a,b
- Arrays:a(size max(1,,lda))b, size max(. The arrayldb*nrhs) for column major layout and max(ldb*n) for row major layout,acontains the upper or the lower triangular part of the matrixA(seeuplo).Note that in the case ofzcposvthe imaginary parts of the diagonal elements need not be set and are assumed to be zero.The arraybcontains the matrixBwhose columns are the right-hand sides for the systems of equations.
- lda
- The leading dimension ofa;.lda≥max(1,n)
- ldb
- The leading dimension ofb;.ldb≥max(1,n) for column major layout andldb≥nrhsfor row major layout
- ldx
- The leading dimension of the arrayx;.ldx≥max(1,n) for column major layout andldx≥nrhsfor row major layout
Output Parameters
- a
- Ifinfo= 0, the upper or lower triangular part ofais overwritten by the Cholesky factorUorL, as specified byuplo.If iterative refinement has been successfully used (info= 0 anditer≥0), thenAis unchanged.If double precision factorization has been used (info= 0 anditer< 0), then the arrayAcontains the factorsLorUfrom the Cholesky factorization.
- b
- Overwritten by the solution matrixX.
- x
- Array, sizemax(1,. Ifldx*nrhs) for column major layout and max(1,ldx*n) for row major layoutinfo= 0, contains then-by-nrhssolution matrixX.
- iter
- If: iterative refinement has failed, double precision factorization has been performediter< 0
- If: the routine fell back to full precision for implementation- or machine-specific reasoniter= -1
- If: narrowing the precision induced an overflow, the routine fell back to full precisioniter= -2
- If: failure ofiter= -3spotrffordsposv, orcpotrfforzcposv
- If: stop the iterative refinement after the 30th iteration.iter= -31
If: iterative refinement has been successfully used. Returns the number of iterations.iter> 0
Return Values
This function returns a value
info
.If , the execution is successful.
info
= 0If , parameter
info
= -i
i
had an illegal value.If , the leading minor of order
info
= i
i
(and therefore the matrix A
itself) is not positive definite, so the factorization could not be completed, and the solution has not been computed.