F08 Chapter Contents
F08 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentF08LSF (ZGBBRD)

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

F08LSF (ZGBBRD) reduces a complex $m$ by $n$ band matrix to real upper bidiagonal form.

## 2  Specification

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

## 3  Description

F08LSF (ZGBBRD) reduces a complex $m$ by $n$ band matrix to real upper bidiagonal form $B$ by a unitary transformation: $A=QB{P}^{\mathrm{H}}$. The unitary matrices $Q$ and ${P}^{\mathrm{H}}$, 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{H}}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{H}}$ are generated.
${\mathbf{VECT}}=\text{'N'}$
Neither $Q$ nor ${P}^{\mathrm{H}}$ is generated.
${\mathbf{VECT}}=\text{'Q'}$
$Q$ is generated.
${\mathbf{VECT}}=\text{'P'}$
${P}^{\mathrm{H}}$ is generated.
${\mathbf{VECT}}=\text{'B'}$
Both $Q$ and ${P}^{\mathrm{H}}$ 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,$*$) – COMPLEX (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 F08LSF (ZGBBRD) 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,$*$) – COMPLEX (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$ unitary 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 F08LSF (ZGBBRD) 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,$*$) – COMPLEX (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$ unitary matrix ${P}^{\mathrm{H}}$, 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 F08LSF (ZGBBRD) 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,$*$) – COMPLEX (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{H}}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 F08LSF (ZGBBRD) 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($\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{M}},{\mathbf{N}}\right)$) – COMPLEX (KIND=nag_wp) arrayWorkspace
18:   RWORK($\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{M}},{\mathbf{N}}\right)$) – REAL (KIND=nag_wp) arrayWorkspace
19:   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{H}}=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 unitary matrix by a matrix $F$ such that
 $F2 = Oε .$
A similar statement holds for the computed matrix ${P}^{\mathrm{H}}$.

The total number of real floating point operations is approximately the sum of:
• $20{n}^{2}k$, if ${\mathbf{VECT}}=\text{'N'}$ and ${\mathbf{NCC}}=0$, and
• $10{n}^{2}{n}_{C}\left(k-1\right)/k$, if $C$ is updated, and
• $10{n}^{3}\left(k-1\right)/k$, if either $Q$ or ${P}^{\mathrm{H}}$ 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 real analogue of this routine is F08LEF (DGBBRD).

## 9  Example

This example reduces the matrix $A$ to upper bidiagonal form, where
 $A = 0.96-0.81i -0.03+0.96i 0.00+0.00i 0.00+0.00i -0.98+1.98i -1.20+0.19i -0.66+0.42i 0.00+0.00i 0.62-0.46i 1.01+0.02i 0.63-0.17i -1.11+0.60i 0.00+0.00i 0.19-0.54i -0.98-0.36i 0.22-0.20i 0.00+0.00i 0.00+0.00i -0.17-0.46i 1.47+1.59i 0.00+0.00i 0.00+0.00i 0.00+0.00i 0.26+0.26i .$

### 9.1  Program Text

Program Text (f08lsfe.f90)

### 9.2  Program Data

Program Data (f08lsfe.d)

### 9.3  Program Results

Program Results (f08lsfe.r)