# ?ptsvx

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

## Syntax

FORTRAN 77:

call sptsvx( fact, n, nrhs, d, e, df, ef, b, ldb, x, ldx, rcond, ferr, berr, work, info )

call dptsvx( fact, n, nrhs, d, e, df, ef, b, ldb, x, ldx, rcond, ferr, berr, work, info )

call cptsvx( fact, n, nrhs, d, e, df, ef, b, ldb, x, ldx, rcond, ferr, berr, work, rwork, info )

call zptsvx( fact, n, nrhs, d, e, df, ef, b, ldb, x, ldx, rcond, ferr, berr, work, rwork, info )

Fortran 95:

call ptsvx( d, e, b, x [,df] [,ef] [,fact] [,ferr] [,berr] [,rcond] [,info] )

## Description

This 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

fact

  CHARACTER*1. 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

  INTEGER. The order of matrix A; n ≥ 0.

nrhs

  INTEGER. The number of right-hand sides, the number of columns in `B; nrhs ≥ 0`.

d, df, rwork

  REAL for single precision flavors

  DOUBLE PRECISION for double precision flavors.

  Arrays: `d(n)`, `df(n)`, `rwork(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.

  The array rwork is a workspace array used for complex flavors only.

e,ef,b,work

  REAL for sptsvx

  DOUBLE PRECISION for dptsvx

  COMPLEX for cptsvx

  DOUBLE COMPLEX for zptsvx.

  Arrays: `e(n -1)`, `ef(n -1)`, `b(ldb*)`, `work(*)`. 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.

  The array work is a workspace array. The dimension of work must be at least `2*n` for real flavors, and at least n for complex flavors.

ldb

  INTEGER. The leading dimension of b; `ldb ≥ max(1, n)`.

ldx

  INTEGER. The leading dimension of x; `ldx ≥ max(1, n)`.

## Output Parameters

x

  REAL for sptsvx

  DOUBLE PRECISION for dptsvx

  COMPLEX for cptsvx

  DOUBLE COMPLEX for zptsvx.

  Array, DIMENSION `(ldx,*)`.

  If `info = 0` or `info = n+1`, the array x contains the solution matrix X to the system of equations. The second dimension of x must be at least `max(1,nrhs)`.

df, ef

  These arrays are output arguments if `fact = 'N'`. See the description of df, ef in Input Arguments section.

rcond

  REAL for single precision flavors

  DOUBLE PRECISION for double precision flavors.

  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

  REAL for single precision flavors

  DOUBLE PRECISION for double precision flavors.

  Array, DIMENSION at least `max(1, nrhs)`. Contains the estimated forward error bound for each solution vector `x(j)` (the j-th column of the solution matrix X). If xtrue is the true solution corresponding to `x(j)`, `ferr(j)` is an estimated upper bound for the magnitude of the largest element in `(x(j) - xtrue)` divided by the magnitude of the largest element in `x(j)`. The estimate is as reliable as the estimate for rcond, and is almost always a slight overestimate of the true error.

berr

  REAL for single precision flavors

  DOUBLE PRECISION for double precision flavors.

  Array, DIMENSION at least `max(1, nrhs)`. Contains the component-wise 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.

info

  INTEGER. If `info = 0`, the execution is successful.

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

  If `info = i`, and `i ≤ n`, 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.

## Fortran 95 Interface Notes

Routines in Fortran 95 interface have fewer arguments in the calling sequence than their Fortran 77 counterparts. For general conventions applied to skip redundant or reconstructible arguments, see Fortran 95 Interface Conventions.

Specific details for the routine ptsvx interface are as follows:

d

  Holds the vector of length (n).

e

  Holds the vector of length (`n-1`).

b

  Holds the matrix B of size (`n,nrhs`).

x

  Holds the matrix X of size (`n,nrhs`).

df

  Holds the vector of length (n).

ef

  Holds the vector of length (`n-1`).

ferr

  Holds the vector of length (nrhs).

berr

  Holds the vector of length (nrhs).

fact

  Must be 'N' or 'F'. The default value is 'N'. If `fact = 'F'`, then both arguments af and ipiv must be present; otherwise, an error is returned.

Parent topic: Driver Routines