f07 Chapter Contents
f07 Chapter Introduction
NAG C Library Manual

# NAG Library Function Documentnag_zgttrf (f07crc)

## 1  Purpose

nag_zgttrf (f07crc) computes the $LU$ factorization of a complex $n$ by $n$ tridiagonal matrix $A$.

## 2  Specification

 #include #include
 void nag_zgttrf (Integer n, Complex dl[], Complex d[], Complex du[], Complex du2[], Integer ipiv[], NagError *fail)

## 3  Description

nag_zgttrf (f07crc) uses Gaussian elimination with partial pivoting and row interchanges to factorize the matrix $A$ as
 $A=PLU ,$
where $P$ is a permutation matrix, $L$ is unit lower triangular with at most one nonzero subdiagonal element in each column, and $U$ is an upper triangular band matrix, with two superdiagonals.

## 4  References

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

## 5  Arguments

1:     nIntegerInput
On entry: $n$, the order of the matrix $A$.
Constraint: ${\mathbf{n}}\ge 0$.
2:     dl[$\mathit{dim}$]ComplexInput/Output
Note: the dimension, dim, of the array dl must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}-1\right)$.
On entry: must contain the $\left(n-1\right)$ subdiagonal elements of the matrix $A$.
On exit: is overwritten by the $\left(n-1\right)$ multipliers that define the matrix $L$ of the $LU$ factorization of $A$.
3:     d[$\mathit{dim}$]ComplexInput/Output
Note: the dimension, dim, of the array d must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
On entry: must contain the $n$ diagonal elements of the matrix $A$.
On exit: is overwritten by the $n$ diagonal elements of the upper triangular matrix $U$ from the $LU$ factorization of $A$.
4:     du[$\mathit{dim}$]ComplexInput/Output
Note: the dimension, dim, of the array du must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}-1\right)$.
On entry: must contain the $\left(n-1\right)$ superdiagonal elements of the matrix $A$.
On exit: is overwritten by the $\left(n-1\right)$ elements of the first superdiagonal of $U$.
5:     du2[${\mathbf{n}}-2$]ComplexOutput
On exit: contains the $\left(n-2\right)$ elements of the second superdiagonal of $U$.
6:     ipiv[n]IntegerOutput
On exit: contains the $n$ pivot indices that define the permutation matrix $P$. At the $i$th step, row $i$ of the matrix was interchanged with row ${\mathbf{ipiv}}\left[i-1\right]$. ${\mathbf{ipiv}}\left[i-1\right]$ will always be either $i$ or $\left(i+1\right)$, ${\mathbf{ipiv}}\left[i-1\right]=i$ indicating that a row interchange was not performed.
7:     failNagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

## 6  Error Indicators and Warnings

On entry, argument $〈\mathit{\text{value}}〉$ had an illegal value.
NE_INT
On entry, ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{n}}\ge 0$.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
NE_SINGULAR
$U\left(〈\mathit{\text{value}}〉,〈\mathit{\text{value}}〉\right)$ is exactly zero. The factorization has been completed, but the factor $U$ is exactly singular, and division by zero will occur if it is used to solve a system of equations.

## 7  Accuracy

The computed factorization satisfies an equation of the form
 $A+E=PLU ,$
where
 $E∞=OεA∞$
and $\epsilon$ is the machine precision.
Following the use of this function, nag_zgttrs (f07csc) can be used to solve systems of equations $AX=B$ or ${A}^{\mathrm{T}}X=B$ or ${A}^{\mathrm{H}}X=B$, and nag_zgtcon (f07cuc) can be used to estimate the condition number of $A$.

The total number of floating point operations required to factorize the matrix $A$ is proportional to $n$.
The real analogue of this function is nag_dgttrf (f07cdc).

## 9  Example

This example factorizes the tridiagonal matrix $A$ given by
 $A = -1.3+1.3i 2.0-1.0i 0.0i+0.0 0.0i+0.0 0.0i+0.0 1.0-2.0i -1.3+1.3i 2.0+1.0i 0.0i+0.0 0.0i+0.0 0.0i+0.0 1.0+1.0i -1.3+3.3i -1.0+1.0i 0.0i+0.0 0.0i+0.0 0.0i+0.0 2.0-3.0i -0.3+4.3i 1.0-1.0i 0.0i+0.0 0.0i+0.0 0.0i+0.0 1.0+1.0i -3.3+1.3i .$

### 9.1  Program Text

Program Text (f07crce.c)

### 9.2  Program Data

Program Data (f07crce.d)

### 9.3  Program Results

Program Results (f07crce.r)