Developer Reference for Intel® oneAPI Math Kernel Library for C

ID 766684
Date 11/07/2023
Public

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

Document Table of Contents

?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 X the real or complex system of linear equations A*X = B, where 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 as

A = UT*U (real flavors) and A = UH*U (complex flavors), if uplo = 'U'

or A = L*LT (real flavors) and A = L*LH (complex flavors), if 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

  • iter is the number of the current iteration in the iterative refinement 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’).
The values 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 of A is stored:

If uplo = 'U', the upper triangle of A is stored.

If uplo = 'L', the lower triangle of A is stored.

n

The order of matrix A; 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(ldb*nrhs) for column major layout and max(ldb*n) for row major layout,. The array a contains the upper or the lower triangular part of the matrix A (see uplo).

Note that in the case of zcposv the imaginary parts of the diagonal elements need not be set and are assumed to be zero.

The array b contains the matrix B whose columns are the right-hand sides for the systems of equations.

lda

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

ldb

The leading dimension of b; ldb max(1, n) for column major layout and ldbnrhs for row major layout.

ldx

The leading dimension of the array x; ldx max(1, n) for column major layout and ldxnrhs for row major layout.

Output Parameters

a

If info = 0, the upper or lower triangular part of a is overwritten by the Cholesky factor U or L, as specified by uplo.

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 or U from the Cholesky factorization.

b

Overwritten by the solution matrix X.

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 = -1: the routine fell back to full precision for implementation- or machine-specific reason

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

  • If iter = -3: failure of spotrf for dsposv, or cpotrf for zcposv

  • If iter = -31: stop the iterative refinement after the 30th iteration.

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

Return Values

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, the leading minor of order 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.