F08 Chapter Contents
F08 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentF08LEF (DGBBRD)

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

F08LEF (DGBBRD) reduces a real $m$ by $n$ band matrix to upper bidiagonal form.

## 2  Specification

 SUBROUTINE F08LEF ( VECT, M, N, NCC, KL, KU, AB, LDAB, D, E, Q, LDQ, PT, LDPT, C, LDC, WORK, INFO)
 INTEGER M, N, NCC, KL, KU, LDAB, LDQ, LDPT, LDC, INFO REAL (KIND=nag_wp) AB(LDAB,*), D(min(M,N)), E(min(M,N)-1), Q(LDQ,*), PT(LDPT,*), C(LDC,*), WORK(2*max(M,N)) CHARACTER(1) VECT
The routine may be called by its LAPACK name dgbbrd.

## 3  Description

F08LEF (DGBBRD) reduces a real $m$ by $n$ band matrix to upper bidiagonal form $B$ by an orthogonal transformation: $A=QB{P}^{\mathrm{T}}$. The orthogonal matrices $Q$ and ${P}^{\mathrm{T}}$, of order $m$ and $n$ respectively, are determined as a product of Givens rotation matrices, and may be formed explicitly by the routine if required. A matrix $C$ may also be updated to give $\stackrel{~}{C}={Q}^{\mathrm{T}}C$.
The routine uses a vectorizable form of the reduction.

None.

## 5  Parameters

1:     VECT – CHARACTER(1)Input
On entry: indicates whether the matrices $Q$ and/or ${P}^{\mathrm{T}}$ are generated.
${\mathbf{VECT}}=\text{'N'}$
Neither $Q$ nor ${P}^{\mathrm{T}}$ is generated.
${\mathbf{VECT}}=\text{'Q'}$
$Q$ is generated.
${\mathbf{VECT}}=\text{'P'}$
${P}^{\mathrm{T}}$ is generated.
${\mathbf{VECT}}=\text{'B'}$
Both $Q$ and ${P}^{\mathrm{T}}$ are generated.
Constraint: ${\mathbf{VECT}}=\text{'N'}$, $\text{'Q'}$, $\text{'P'}$ or $\text{'B'}$.
2:     M – INTEGERInput
On entry: $m$, the number of rows of the matrix $A$.
Constraint: ${\mathbf{M}}\ge 0$.
3:     N – INTEGERInput
On entry: $n$, the number of columns of the matrix $A$.
Constraint: ${\mathbf{N}}\ge 0$.
4:     NCC – INTEGERInput
On entry: ${n}_{C}$, the number of columns of the matrix $C$.
Constraint: ${\mathbf{NCC}}\ge 0$.
5:     KL – INTEGERInput
On entry: the number of subdiagonals, ${k}_{l}$, within the band of $A$.
Constraint: ${\mathbf{KL}}\ge 0$.
6:     KU – INTEGERInput
On entry: the number of superdiagonals, ${k}_{u}$, within the band of $A$.
Constraint: ${\mathbf{KU}}\ge 0$.
7:     AB(LDAB,$*$) – REAL (KIND=nag_wp) arrayInput/Output
Note: the second dimension of the array AB must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{N}}\right)$.
On entry: the original $m$ by $n$ band matrix $A$.
The matrix is stored in rows $1$ to ${k}_{l}+{k}_{u}+1$, more precisely, the element ${A}_{ij}$ must be stored in
 $ABku+1+i-jj for ​max1,j-ku≤i≤minm,j+kl.$
On exit: AB is overwritten by values generated during the reduction.
8:     LDAB – INTEGERInput
On entry: the first dimension of the array AB as declared in the (sub)program from which F08LEF (DGBBRD) is called.
Constraint: ${\mathbf{LDAB}}\ge {\mathbf{KL}}+{\mathbf{KU}}+1$.
9:     D($\mathrm{min}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{M}},{\mathbf{N}}\right)$) – REAL (KIND=nag_wp) arrayOutput
On exit: the diagonal elements of the bidiagonal matrix $B$.
10:   E($\mathrm{min}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{M}},{\mathbf{N}}\right)-1$) – REAL (KIND=nag_wp) arrayOutput
On exit: the superdiagonal elements of the bidiagonal matrix $B$.
11:   Q(LDQ,$*$) – REAL (KIND=nag_wp) arrayOutput
Note: the second dimension of the array Q must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{M}}\right)$ if ${\mathbf{VECT}}=\text{'Q'}$ or $\text{'B'}$, and at least $1$ otherwise.
On exit: if ${\mathbf{VECT}}=\text{'Q'}$ or $\text{'B'}$, contains the $m$ by $m$ orthogonal matrix $Q$.
If ${\mathbf{VECT}}=\text{'N'}$ or $\text{'P'}$, Q is not referenced.
12:   LDQ – INTEGERInput
On entry: the first dimension of the array Q as declared in the (sub)program from which F08LEF (DGBBRD) is called.
Constraints:
• if ${\mathbf{VECT}}=\text{'Q'}$ or $\text{'B'}$, ${\mathbf{LDQ}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{M}}\right)$;
• otherwise ${\mathbf{LDQ}}\ge 1$.
13:   PT(LDPT,$*$) – REAL (KIND=nag_wp) arrayOutput
Note: the second dimension of the array PT must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{N}}\right)$ if ${\mathbf{VECT}}=\text{'P'}$ or $\text{'B'}$, and at least $1$ otherwise.
On exit: the $n$ by $n$ orthogonal matrix ${P}^{\mathrm{T}}$, if ${\mathbf{VECT}}=\text{'P'}$ or $\text{'B'}$. If ${\mathbf{VECT}}=\text{'N'}$ or $\text{'Q'}$, PT is not referenced.
14:   LDPT – INTEGERInput
On entry: the first dimension of the array PT as declared in the (sub)program from which F08LEF (DGBBRD) is called.
Constraints:
• if ${\mathbf{VECT}}=\text{'P'}$ or $\text{'B'}$, ${\mathbf{LDPT}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{N}}\right)$;
• otherwise ${\mathbf{LDPT}}\ge 1$.
15:   C(LDC,$*$) – REAL (KIND=nag_wp) arrayInput/Output
Note: the second dimension of the array C must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{NCC}}\right)$.
On entry: an $m$ by ${n}_{C}$ matrix $C$.
On exit: C is overwritten by ${Q}^{\mathrm{T}}C$. If ${\mathbf{NCC}}=0$, C is not referenced.
16:   LDC – INTEGERInput
On entry: the first dimension of the array C as declared in the (sub)program from which F08LEF (DGBBRD) is called.
Constraints:
• if ${\mathbf{NCC}}>0$, ${\mathbf{LDC}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{M}}\right)$;
• if ${\mathbf{NCC}}=0$, ${\mathbf{LDC}}\ge 1$.
17:   WORK($2×\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{M}},{\mathbf{N}}\right)$) – REAL (KIND=nag_wp) arrayWorkspace
18:   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.

## 7  Accuracy

The computed bidiagonal form $B$ satisfies $QB{P}^{\mathrm{T}}=A+E$, where
 $E2 ≤ c n ε A2 ,$
$c\left(n\right)$ is a modestly increasing function of $n$, and $\epsilon$ is the machine precision.
The elements of $B$ themselves may be sensitive to small perturbations in $A$ or to rounding errors in the computation, but this does not affect the stability of the singular values and vectors.
The computed matrix $Q$ differs from an exactly orthogonal matrix by a matrix $F$ such that
 $F2 = Oε .$
A similar statement holds for the computed matrix ${P}^{\mathrm{T}}$.

## 8  Further Comments

The total number of real floating point operations is approximately the sum of:
• $6{n}^{2}k$, if ${\mathbf{VECT}}=\text{'N'}$ and ${\mathbf{NCC}}=0$, and
• $3{n}^{2}{n}_{C}\left(k-1\right)/k$, if $C$ is updated, and
• $3{n}^{3}\left(k-1\right)/k$, if either $Q$ or ${P}^{\mathrm{T}}$ is generated (double this if both),
where $k={k}_{l}+{k}_{u}$, assuming $n\gg k$. For this section we assume that $m=n$.
The complex analogue of this routine is F08LSF (ZGBBRD).

## 9  Example

This example reduces the matrix $A$ to upper bidiagonal form, where
 $A = -0.57 -1.28 0.00 0.00 -1.93 1.08 -0.31 0.00 2.30 0.24 0.40 -0.35 0.00 0.64 -0.66 0.08 0.00 0.00 0.15 -2.13 -0.00 0.00 0.00 0.50 .$

### 9.1  Program Text

Program Text (f08lefe.f90)

### 9.2  Program Data

Program Data (f08lefe.d)

### 9.3  Program Results

Program Results (f08lefe.r)