F07 Chapter Contents
F07 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentF07CDF (DGTTRF)

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

F07CDF (DGTTRF) computes the $LU$ factorization of a real $n$ by $n$ tridiagonal matrix $A$.

## 2  Specification

 SUBROUTINE F07CDF ( N, DL, D, DU, DU2, IPIV, INFO)
 INTEGER N, IPIV(N), INFO REAL (KIND=nag_wp) DL(*), D(*), DU(*), DU2(N-2)
The routine may be called by its LAPACK name dgttrf.

## 3  Description

F07CDF (DGTTRF) 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  Parameters

1:     N – INTEGERInput
On entry: $n$, the order of the matrix $A$.
Constraint: ${\mathbf{N}}\ge 0$.
2:     DL($*$) – REAL (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:     D($*$) – REAL (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:     DU($*$) – REAL (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:     DU2(${\mathbf{N}}-2$) – REAL (KIND=nag_wp) arrayOutput
On exit: contains the $\left(n-2\right)$ elements of the second superdiagonal of $U$.
6:     IPIV(N) – 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:     INFO – INTEGEROutput
On exit: ${\mathbf{INFO}}=0$ unless the routine detects an error (see Section 6).

## 6  Error Indicators and Warnings

Errors or warnings detected by the routine:
${\mathbf{INFO}}<0$
If ${\mathbf{INFO}}=-i$, the $i$th argument had an illegal value. An explanatory message is output, and execution of the program is terminated.
${\mathbf{INFO}}>0$
If ${\mathbf{INFO}}=i$, $U\left(i,i\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 routine, F07CEF (DGTTRS) can be used to solve systems of equations $AX=B$ or ${A}^{\mathrm{T}}X=B$, and F07CGF (DGTCON) 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 complex analogue of this routine is F07CRF (ZGTTRF).

## 9  Example

This example factorizes the tridiagonal matrix $A$ given by
 $A = 3.0 2.1 0.0 0.0 0.0 3.4 2.3 -1.0 0.0 0.0 0.0 3.6 -5.0 1.9 0.0 0.0 0.0 7.0 -0.9 8.0 0.0 0.0 0.0 -6.0 7.1 .$

### 9.1  Program Text

Program Text (f07cdfe.f90)

### 9.2  Program Data

Program Data (f07cdfe.d)

### 9.3  Program Results

Program Results (f07cdfe.r)