# NAG Library Routine Document

## 1Purpose

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

## 2Specification

Fortran Interface
 Subroutine f07crf ( n, dl, d, du, du2, ipiv, info)
 Integer, Intent (In) :: n Integer, Intent (Out) :: ipiv(n), info Complex (Kind=nag_wp), Intent (Inout) :: dl(*), d(*), du(*) Complex (Kind=nag_wp), Intent (Out) :: du2(n-2)
#include <nagmk26.h>
 void f07crf_ (const Integer *n, Complex dl[], Complex d[], Complex du[], Complex du2[], Integer ipiv[], Integer *info)
The routine may be called by its LAPACK name zgttrf.

## 3Description

f07crf (zgttrf) 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.

## 4References

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

## 5Arguments

1:     $\mathbf{n}$ – IntegerInput
On entry: $n$, the order of the matrix $A$.
Constraint: ${\mathbf{n}}\ge 0$.
2:     $\mathbf{dl}\left(*\right)$ – Complex (Kind=nag_wp) arrayInput/Output
Note: the dimension 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:     $\mathbf{d}\left(*\right)$ – Complex (Kind=nag_wp) arrayInput/Output
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: 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:     $\mathbf{du}\left(*\right)$ – Complex (Kind=nag_wp) arrayInput/Output
Note: the dimension 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:     $\mathbf{du2}\left({\mathbf{n}}-2\right)$ – Complex (Kind=nag_wp) arrayOutput
On exit: contains the $\left(n-2\right)$ elements of the second superdiagonal of $U$.
6:     $\mathbf{ipiv}\left({\mathbf{n}}\right)$ – Integer arrayOutput
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\right)$. ${\mathbf{ipiv}}\left(i\right)$ will always be either $i$ or $\left(i+1\right)$, ${\mathbf{ipiv}}\left(i\right)=i$ indicating that a row interchange was not performed.
7:     $\mathbf{info}$ – IntegerOutput
On exit: ${\mathbf{info}}=0$ unless the routine detects an error (see Section 6).

## 6Error 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$
Element $〈\mathit{\text{value}}〉$ of the diagonal 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.

## 7Accuracy

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 routine, f07csf (zgttrs) can be used to solve systems of equations $AX=B$ or ${A}^{\mathrm{T}}X=B$ or ${A}^{\mathrm{H}}X=B$, and f07cuf (zgtcon) can be used to estimate the condition number of $A$.

## 8Parallelism and Performance

f07crf (zgttrf) 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.

The total number of floating-point operations required to factorize the matrix $A$ is proportional to $n$.
The real analogue of this routine is f07cdf (dgttrf).

## 10Example

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

### 10.1Program Text

Program Text (f07crfe.f90)

### 10.2Program Data

Program Data (f07crfe.d)

### 10.3Program Results

Program Results (f07crfe.r)