F07JPF (ZPTSVX) (PDF version)
F07 Chapter Contents
F07 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentF07JPF (ZPTSVX)

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

## 1  Purpose

F07JPF (ZPTSVX) uses the factorization
 $A=LDLH$
to compute the solution to a complex system of linear equations
 $AX=B ,$
where $A$ is an $n$ by $n$ Hermitian positive definite tridiagonal matrix and $X$ and $B$ are $n$ by $r$ matrices. Error bounds on the solution and a condition estimate are also provided.

## 2  Specification

 SUBROUTINE F07JPF ( FACT, N, NRHS, D, E, DF, EF, B, LDB, X, LDX, RCOND, FERR, BERR, WORK, RWORK, INFO)
 INTEGER N, NRHS, LDB, LDX, INFO REAL (KIND=nag_wp) D(*), DF(*), RCOND, FERR(NRHS), BERR(NRHS), RWORK(N) COMPLEX (KIND=nag_wp) E(*), EF(*), B(LDB,*), X(LDX,*), WORK(N) CHARACTER(1) FACT
The routine may be called by its LAPACK name zptsvx.

## 3  Description

F07JPF (ZPTSVX) performs the following steps:
 1 If ${\mathbf{FACT}}=\text{'N'}$, the matrix $A$ is factorized as $A=LD{L}^{\mathrm{H}}$, where $L$ is a unit lower bidiagonal matrix and $D$ is diagonal. The factorization can also be regarded as having the form $A={U}^{\mathrm{H}}DU$. 2 If the leading $i$ by $i$ principal minor is not positive definite, then the routine returns with ${\mathbf{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, ${\mathbf{INFO}}=\mathbf{N}+{\mathbf{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 to calculate error bounds and backward error estimates for it.
Anderson E, Bai Z, Bischof C, Blackford S, Demmel J, Dongarra J J, Du Croz J J, Greenbaum A, Hammarling S, McKenney A and Sorensen D (1999) LAPACK Users' Guide (3rd Edition) SIAM, Philadelphia http://www.netlib.org/lapack/lug
Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore
Higham N J (2002) Accuracy and Stability of Numerical Algorithms (2nd Edition) SIAM, Philadelphia

## 5  Parameters

1:     $\mathrm{FACT}$ – CHARACTER(1)Input
On entry: specifies whether or not the factorized form of the matrix $A$ has been supplied.
${\mathbf{FACT}}=\text{'F'}$
DF and EF contain the factorized form of the matrix $A$. DF and EF will not be modified.
${\mathbf{FACT}}=\text{'N'}$
The matrix $A$ will be copied to DF and EF and factorized.
Constraint: ${\mathbf{FACT}}=\text{'F'}$ or $\text{'N'}$.
2:     $\mathrm{N}$ – INTEGERInput
On entry: $n$, the order of the matrix $A$.
Constraint: ${\mathbf{N}}\ge 0$.
3:     $\mathrm{NRHS}$ – INTEGERInput
On entry: $r$, the number of right-hand sides, i.e., the number of columns of the matrix $B$.
Constraint: ${\mathbf{NRHS}}\ge 0$.
4:     $\mathrm{D}\left(*\right)$ – REAL (KIND=nag_wp) arrayInput
Note: the dimension of the array D must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{N}}\right)$.
On entry: the $n$ diagonal elements of the tridiagonal matrix $A$.
5:     $\mathrm{E}\left(*\right)$ – COMPLEX (KIND=nag_wp) arrayInput
Note: the dimension of the array E must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{N}}-1\right)$.
On entry: the $\left(n-1\right)$ subdiagonal elements of the tridiagonal matrix $A$.
6:     $\mathrm{DF}\left(*\right)$ – REAL (KIND=nag_wp) arrayInput/Output
Note: the dimension of the array DF must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{N}}\right)$.
On entry: if ${\mathbf{FACT}}=\text{'F'}$, DF must contain the $n$ diagonal elements of the diagonal matrix $D$ from the $LD{L}^{\mathrm{H}}$ factorization of $A$.
On exit: if ${\mathbf{FACT}}=\text{'N'}$, DF contains the $n$ diagonal elements of the diagonal matrix $D$ from the $LD{L}^{\mathrm{H}}$ factorization of $A$.
7:     $\mathrm{EF}\left(*\right)$ – COMPLEX (KIND=nag_wp) arrayInput/Output
Note: the dimension of the array EF must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{N}}-1\right)$.
On entry: if ${\mathbf{FACT}}=\text{'F'}$, EF must contain the $\left(n-1\right)$ subdiagonal elements of the unit bidiagonal factor $L$ from the $LD{L}^{\mathrm{H}}$ factorization of $A$.
On exit: if ${\mathbf{FACT}}=\text{'N'}$, EF contains the $\left(n-1\right)$ subdiagonal elements of the unit bidiagonal factor $L$ from the $LD{L}^{\mathrm{H}}$ factorization of $A$.
8:     $\mathrm{B}\left({\mathbf{LDB}},*\right)$ – COMPLEX (KIND=nag_wp) arrayInput
Note: the second dimension of the array B must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{NRHS}}\right)$.
On entry: the $n$ by $r$ right-hand side matrix $B$.
9:     $\mathrm{LDB}$ – INTEGERInput
On entry: the first dimension of the array B as declared in the (sub)program from which F07JPF (ZPTSVX) is called.
Constraint: ${\mathbf{LDB}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{N}}\right)$.
10:   $\mathrm{X}\left({\mathbf{LDX}},*\right)$ – COMPLEX (KIND=nag_wp) arrayOutput
Note: the second dimension of the array X must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{NRHS}}\right)$.
On exit: if ${\mathbf{INFO}}={\mathbf{0}}$ or $\mathbf{N}+{\mathbf{1}}$, the $n$ by $r$ solution matrix $X$.
11:   $\mathrm{LDX}$ – INTEGERInput
On entry: the first dimension of the array X as declared in the (sub)program from which F07JPF (ZPTSVX) is called.
Constraint: ${\mathbf{LDX}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{N}}\right)$.
12:   $\mathrm{RCOND}$ – REAL (KIND=nag_wp)Output
On exit: the reciprocal condition number of the matrix $A$. If RCOND is less than the machine precision (in particular, if ${\mathbf{RCOND}}=0.0$), the matrix is singular to working precision. This condition is indicated by a return code of ${\mathbf{INFO}}=\mathbf{N}+{\mathbf{1}}$.
13:   $\mathrm{FERR}\left({\mathbf{NRHS}}\right)$ – REAL (KIND=nag_wp) arrayOutput
On exit: the forward error bound for each solution vector ${\stackrel{^}{x}}_{j}$ (the $j$th column of the solution matrix $X$). If ${x}_{j}$ is the true solution corresponding to ${\stackrel{^}{x}}_{j}$, ${\mathbf{FERR}}\left(j\right)$ is an estimated upper bound for the magnitude of the largest element in (${\stackrel{^}{x}}_{j}-{x}_{j}$) divided by the magnitude of the largest element in ${\stackrel{^}{x}}_{j}$.
14:   $\mathrm{BERR}\left({\mathbf{NRHS}}\right)$ – REAL (KIND=nag_wp) arrayOutput
On exit: the component-wise relative backward error of each solution vector ${\stackrel{^}{x}}_{j}$ (i.e., the smallest relative change in any element of $A$ or $B$ that makes ${\stackrel{^}{x}}_{j}$ an exact solution).
15:   $\mathrm{WORK}\left({\mathbf{N}}\right)$ – COMPLEX (KIND=nag_wp) arrayWorkspace
16:   $\mathrm{RWORK}\left({\mathbf{N}}\right)$ – REAL (KIND=nag_wp) arrayWorkspace
17:   $\mathrm{INFO}$ – INTEGEROutput
On exit: ${\mathbf{INFO}}=0$ unless the routine detects an error (see Section 6).

## 6  Error Indicators and Warnings

${\mathbf{INFO}}<0$
If ${\mathbf{INFO}}=-i$, argument $i$ had an illegal value. An explanatory message is output, and execution of the program is terminated.
${\mathbf{INFO}}>0 \text{and} {\mathbf{INFO}}\le {\mathbf{N}}$
The leading minor of order $〈\mathit{\text{value}}〉$ of $A$ is not positive definite, so the factorization could not be completed, and the solution has not been computed. ${\mathbf{RCOND}}=0.0$ is returned.
${\mathbf{INFO}}={\mathbf{N}}+1$
$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.

## 7  Accuracy

For each right-hand side vector $b$, the computed solution $\stackrel{^}{x}$ is the exact solution of a perturbed system of equations $\left(A+E\right)\stackrel{^}{x}=b$, where
 $E ≤ c n ε RT R , where ​ R = D12 U ,$
$c\left(n\right)$ is a modest linear function of $n$, and $\epsilon$ is the machine precision. See Section 10.1 of Higham (2002) for further details.
If $x$ is the true solution, then the computed solution $\stackrel{^}{x}$ satisfies a forward error bound of the form
 $x-x^∞ x^∞ ≤ wc condA,x^,b$
where $\mathrm{cond}\left(A,\stackrel{^}{x},b\right)={‖\left|{A}^{-1}\right|\left(\left|A\right|\left|\stackrel{^}{x}\right|+\left|b\right|\right)‖}_{\infty }/{‖\stackrel{^}{x}‖}_{\infty }\le \mathrm{cond}\left(A\right)={‖\left|{A}^{-1}\right|\left|A\right|‖}_{\infty }\le {\kappa }_{\infty }\left(A\right)$. If $\stackrel{^}{x}$ is the $j$th column of $X$, then ${w}_{c}$ is returned in ${\mathbf{BERR}}\left(j\right)$ and a bound on ${‖x-\stackrel{^}{x}‖}_{\infty }/{‖\stackrel{^}{x}‖}_{\infty }$ is returned in ${\mathbf{FERR}}\left(j\right)$. See Section 4.4 of Anderson et al. (1999) for further details.

## 8  Parallelism and Performance

F07JPF (ZPTSVX) is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
F07JPF (ZPTSVX) makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

## 9  Further Comments

The number of floating-point operations required for the factorization, and for the estimation of the condition number of $A$ is proportional to $n$. The number of floating-point operations required for the solution of the equations, and for the estimation of the forward and backward error is proportional to $nr$, where $r$ is the number of right-hand sides.
The condition estimation is based upon Equation (15.11) of Higham (2002). For further details of the error estimation, see Section 4.4 of Anderson et al. (1999).
The real analogue of this routine is F07JBF (DPTSVX).

## 10  Example

This example solves the equations
 $AX=B ,$
where $A$ is the Hermitian positive definite tridiagonal matrix
 $A = 16.0i+00.0 16.0-16.0i 0.0i+0.0 0.0i+0.0 16.0+16.0i 41.0i+00.0 18.0+9.0i 0.0i+0.0 0.0i+00.0 18.0-09.0i 46.0i+0.0 1.0+4.0i 0.0i+00.0 0.0i+00.0 1.0-4.0i 21.0i+0.0$
and
 $B = 64.0+16.0i -16.0-32.0i 93.0+62.0i 61.0-66.0i 78.0-80.0i 71.0-74.0i 14.0-27.0i 35.0+15.0i .$
Error estimates for the solutions and an estimate of the reciprocal of the condition number of $A$ are also output.

### 10.1  Program Text

Program Text (f07jpfe.f90)

### 10.2  Program Data

Program Data (f07jpfe.d)

### 10.3  Program Results

Program Results (f07jpfe.r)

F07JPF (ZPTSVX) (PDF version)
F07 Chapter Contents
F07 Chapter Introduction
NAG Library Manual