Uses factorization to compute the solution to the system of linear equations with a symmetric (Hermitian) positive definite tridiagonal coefficient matrix A, and provides error bounds on the solution.

## Syntax

lapack_int LAPACKE_sptsvx( int matrix_layout, char fact, lapack_int n, lapack_int nrhs, const float* d, const float* e, float* df, float* ef, const float* b, lapack_int ldb, float* x, lapack_int ldx, float* rcond, float* ferr, float* berr );

lapack_int LAPACKE_dptsvx( int matrix_layout, char fact, lapack_int n, lapack_int nrhs, const double* d, const double* e, double* df, double* ef, const double* b, lapack_int ldb, double* x, lapack_int ldx, double* rcond, double* ferr, double* berr );

lapack_int LAPACKE_cptsvx( int matrix_layout, char fact, lapack_int n, lapack_int nrhs, const float* d, const lapack_complex_float* e, float* df, lapack_complex_float* ef, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* ferr, float* berr );

lapack_int LAPACKE_zptsvx( int matrix_layout, char fact, lapack_int n, lapack_int nrhs, const double* d, const lapack_complex_double* e, double* df, lapack_complex_double* ef, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* ferr, double* berr );

• mkl.h

## Description

The routine uses the Cholesky factorization A = L*D*LT (real)/A = L*D*LH (complex) to compute the solution to a real or complex system of linear equations A*X = B, where A is a n-by-n symmetric or Hermitian positive definite tridiagonal matrix, the columns of matrix B are individual right-hand sides, and the columns of X are the corresponding solutions.

Error bounds on the solution and a condition estimate are also provided.

The routine ?ptsvx performs the following steps:

1. If fact = 'N', the matrix A is factored as A = L*D*LT (real flavors)/A = L*D*LH (complex flavors), where L is a unit lower bidiagonal matrix and D is diagonal. The factorization can also be regarded as having the form A = UT*D*U (real flavors)/A = UH*D*U (complex flavors).

2. If the leading i-by-i principal minor is not positive-definite, then the routine returns with info = i. Otherwise, the factored form of A is used to estimate the condition number of the matrix A. If the reciprocal of the condition number is less than machine precision, info = n+1 is returned as a warning, but the routine still goes on to solve for X and compute error bounds as described below.

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

4. Iterative refinement is applied to improve the computed solution matrix and calculate error bounds and backward error estimates for it.

## Input Parameters

 matrix_layout Specifies whether matrix storage layout is row major (LAPACK_ROW_MAJOR) or column major (LAPACK_COL_MAJOR). fact Must be 'F' or 'N'. Specifies whether or not the factored form of the matrix A is supplied on entry. If fact = 'F': on entry, df and ef contain the factored form of A. Arrays d, e, df, and ef will not be modified. If fact = 'N', the matrix A will be copied to df and ef, and factored. n The order of matrix A; n≥ 0. nrhs The number of right-hand sides, the number of columns in B; nrhs≥ 0. d, df Arrays: d (size n), df (size n). The array d contains the n diagonal elements of the tridiagonal matrix A. The array df is an input argument if fact = 'F' and on entry contains the n diagonal elements of the diagonal matrix D from the L*D*LT (real)/ L*D*LH (complex) factorization of A. e,ef,b Arrays: e (size n -1), ef (size n -1), b, size max(ldb*nrhs) for column major layout and max(ldb*n) for row major layout. The array e contains the (n - 1) subdiagonal elements of the tridiagonal matrix A. The array ef is an input argument if fact = 'F' and on entry contains the (n - 1) subdiagonal elements of the unit bidiagonal factor L from the L*D*LT (real)/ L*D*LH (complex) factorization of A. The array b contains the matrix B whose columns are the right-hand sides for the systems of equations. ldb The leading dimension of b; ldb≥ max(1, n) for column major layout and ldb≥nrhs for row major layout. ldx The leading dimension of x; ldx≥ max(1, n) for column major layout and ldx≥nrhs for row major layout.

## Output Parameters

 x Array, size max(1, ldx*nrhs) for column major layout and max(1, ldx*n) for row major layout. If info = 0 or info = n+1, the array x contains the solution matrix X to the system of equations. df, ef These arrays are output arguments if fact = 'N'. See the description of df, ef in Input Arguments section. rcond An estimate of the reciprocal 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. This condition is indicated by a return code of info > 0. ferr Array, size at least max(1, nrhs). Contains the estimated forward error bound for each solution vector xj (the j-th column of the solution matrix X). If xtrue is the true solution corresponding to xj, ferrj is an estimated upper bound for the magnitude of the largest element in (xj - xtrue) divided by the magnitude of the largest element in xj. The estimate is as reliable as the estimate for rcond, and is almost always a slight overestimate of the true error. berr Array, size at least max(1, nrhs). Contains the component-wise relative backward error for each solution vector xj, that is, the smallest relative change in any element of A or B that makes xj an exact solution.

## 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, and in, 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 and error bounds could not be computed; rcond =0 is returned.

If info = i, and i = n + 1, then U is nonsingular, but rcond is less than machine precision, meaning that the matrix is singular to working precision. Nevertheless, the solution and error bounds are computed because there are a number of situations where the computed solution can be more accurate than the value of rcond would suggest.