# ?spsvx

Uses the diagonal pivoting factorization to compute the solution to the system of linear equations with a real or complex symmetric matrix A stored in packed format, and provides error bounds on the solution.

## Syntax

FORTRAN 77:

call sspsvx( fact, uplo, n, nrhs, ap, afp, ipiv, b, ldb, x, ldx, rcond, ferr, berr, work, iwork, info )

call dspsvx( fact, uplo, n, nrhs, ap, afp, ipiv, b, ldb, x, ldx, rcond, ferr, berr, work, iwork, info )

call cspsvx( fact, uplo, n, nrhs, ap, afp, ipiv, b, ldb, x, ldx, rcond, ferr, berr, work, rwork, info )

call zspsvx( fact, uplo, n, nrhs, ap, afp, ipiv, b, ldb, x, ldx, rcond, ferr, berr, work, rwork, info )

Fortran 95:

call spsvx( a, b, x [,uplo] [,af] [,ipiv] [,fact] [,ferr] [,berr] [,rcond] [,info] )

## Description

This routine uses the diagonal pivoting factorization to compute the solution to a real or complex system of linear equations `A*X = B`, where A is a n-by-n symmetric matrix stored in packed format, 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 ?spsvx performs the following steps:

1. If `fact = 'N'`, the diagonal pivoting method is used to factor the matrix A. The form of the factorization is `A = U*D*UT` or`A = L*D*LT`, where U (or L) is a product of permutation and unit upper (lower) triangular matrices, and D is symmetric and block diagonal with 1-by-1 and 2-by-2 diagonal blocks.

2. If some `di,i` = 0, so that D is exactly singular, 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 has been supplied on entry.

  If `fact = 'F'`: on entry, afp and ipiv contain the factored form of A. Arrays ap, afp, and ipiv are not modified.

  If `fact = 'N'`, the matrix A is copied to afp and factored.

uplo

  CHARACTER*1. Must be 'U' or 'L'.

  Indicates whether the upper or lower triangular part of A is stored and how A is factored:

  If `uplo = 'U'`, the array ap stores the upper triangular part of the symmetric matrix A, and A is factored as `U*D*UT`.

  If `uplo = 'L'`, the array ap stores the lower triangular part of the symmetric matrix A; A is factored as `L*D*LT`.

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`.

ap,afp,b,work

  REAL for sspsvx

  DOUBLE PRECISION for dspsvx

  COMPLEX for cspsvx

  DOUBLE COMPLEX for zspsvx.

  Arrays: `ap(*)`, `afp(*)`, `b(ldb,*)`, `work(*)`.

  The array ap contains the upper or lower triangle of the symmetric matrix A in packed storage (see Matrix Storage Schemes).

  The array afp is an input argument if `fact = 'F'`. It contains the block diagonal matrix D and the multipliers used to obtain the factor U or L from the factorization `A = U*D*UT` or `A = L*D*LT` as computed by ?sptrf, in the same storage format as A.

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

  `work(*)` is a workspace array.

  The dimension of arrays ap and afp must be at least `max(1, n(n+1)/2)`; the second dimension of b must be at least `max(1,nrhs)`; the dimension of work must be at least `max(1,3*n)` for real flavors and `max(1,2*n)` for complex flavors.

ldb

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

ipiv

  INTEGER.

  Array, DIMENSION at least `max(1, n)`. The array ipiv is an input argument if `fact = 'F'`. It contains details of the interchanges and the block structure of D, as determined by ?sptrf.

  If `ipiv(i) = k > 0`, then `dii` is a 1-by-1 diagonal block, and the i-th row and column of A was interchanged with the k-th row and column.

  If `uplo = 'U'` and ipiv(i) =ipiv(i-1) = -m < 0, then D has a 2-by-2 block in rows/columns i and `i-1`, and (`i-1`)-th row and column of A was interchanged with the m-th row and column.

  If `uplo = 'L'` and ipiv(i) =ipiv(i+1) = -m < 0, then D has a 2-by-2 block in rows/columns i and `i+1`, and (`i+1`)-th row and column of A was interchanged with the m-th row and column.

ldx

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

iwork

  INTEGER. Workspace array, DIMENSION at least `max(1, n)`; used in real flavors only.

rwork

  REAL for cspsvx

  DOUBLE PRECISION for zspsvx.

  Workspace array, DIMENSION at least `max(1, n)`; used in complex flavors only.

## Output Parameters

x

  REAL for sspsvx

  DOUBLE PRECISION for dspsvx

  COMPLEX for cspsvx

  DOUBLE COMPLEX for zspsvx.

  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)`.

afp, ipiv

  These arrays are output arguments if `fact = 'N'`. See the description of afp, ipiv 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. 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, berr

  REAL for single precision flavors

  DOUBLE PRECISION for double precision flavors.

  Arrays, DIMENSION at least `max(1, nrhs)`. Contain the component-wise forward and relative backward errors, respectively, for each solution vector.

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`, then `dii` is exactly zero. The factorization has been completed, but the block diagonal matrix D is exactly singular, so the solution and error bounds could not be computed; rcond = 0 is returned.

  If `info = i`, and i = n + 1, then D 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 spsvx interface are as follows:

a

  Stands for argument ap in Fortan 77 interface. Holds the array A of size (`n*(n+1)/2`).

b

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

x

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

af

  Stands for argument afp in Fortan 77 interface. Holds the array AF of size (`n*(n+1)/2`).

ipiv

  Holds the vector of length (n).

ferr

  Holds the vector of length (nrhs).

berr

  Holds the vector of length (nrhs).

uplo

  Must be 'U' or 'L'. The default value is 'U'.

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