# NAG Library Routine Document

## 1Purpose

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

## 2Specification

Fortran Interface
 Subroutine f08lsf ( vect, m, n, ncc, kl, ku, ab, ldab, d, e, q, ldq, pt, ldpt, c, ldc, work, info)
 Integer, Intent (In) :: m, n, ncc, kl, ku, ldab, ldq, ldpt, ldc Integer, Intent (Out) :: info Real (Kind=nag_wp), Intent (Out) :: d(min(m,n)), e(min(m,n)-1), rwork(max(m,n)) Complex (Kind=nag_wp), Intent (Inout) :: ab(ldab,*), q(ldq,*), pt(ldpt,*), c(ldc,*) Complex (Kind=nag_wp), Intent (Out) :: work(max(m,n)) Character (1), Intent (In) :: vect
#include nagmk26.h
 void f08lsf_ (const char *vect, const Integer *m, const Integer *n, const Integer *ncc, const Integer *kl, const Integer *ku, Complex ab[], const Integer *ldab, double d[], double e[], Complex q[], const Integer *ldq, Complex pt[], const Integer *ldpt, Complex c[], const Integer *ldc, Complex work[], double rwork[], Integer *info, const Charlen length_vect)
The routine may be called by its LAPACK name zgbbrd.

## 3Description

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.

## 5Arguments

1:     $\mathbf{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:     $\mathbf{m}$ – IntegerInput
On entry: $m$, the number of rows of the matrix $A$.
Constraint: ${\mathbf{m}}\ge 0$.
3:     $\mathbf{n}$ – IntegerInput
On entry: $n$, the number of columns of the matrix $A$.
Constraint: ${\mathbf{n}}\ge 0$.
4:     $\mathbf{ncc}$ – IntegerInput
On entry: ${n}_{C}$, the number of columns of the matrix $C$.
Constraint: ${\mathbf{ncc}}\ge 0$.
5:     $\mathbf{kl}$ – IntegerInput
On entry: the number of subdiagonals, ${k}_{l}$, within the band of $A$.
Constraint: ${\mathbf{kl}}\ge 0$.
6:     $\mathbf{ku}$ – IntegerInput
On entry: the number of superdiagonals, ${k}_{u}$, within the band of $A$.
Constraint: ${\mathbf{ku}}\ge 0$.
7:     $\mathbf{ab}\left({\mathbf{ldab}},*\right)$ – 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:     $\mathbf{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:     $\mathbf{d}\left(\mathrm{min}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{m}},{\mathbf{n}}\right)\right)$ – Real (Kind=nag_wp) arrayOutput
On exit: the diagonal elements of the bidiagonal matrix $B$.
10:   $\mathbf{e}\left(\mathrm{min}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{m}},{\mathbf{n}}\right)-1\right)$ – Real (Kind=nag_wp) arrayOutput
On exit: the superdiagonal elements of the bidiagonal matrix $B$.
11:   $\mathbf{q}\left({\mathbf{ldq}},*\right)$ – 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:   $\mathbf{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:   $\mathbf{pt}\left({\mathbf{ldpt}},*\right)$ – 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:   $\mathbf{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:   $\mathbf{c}\left({\mathbf{ldc}},*\right)$ – 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:   $\mathbf{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:   $\mathbf{work}\left(\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{m}},{\mathbf{n}}\right)\right)$ – Complex (Kind=nag_wp) arrayWorkspace
18:   $\mathbf{rwork}\left(\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{m}},{\mathbf{n}}\right)\right)$ – Real (Kind=nag_wp) arrayWorkspace
19:   $\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.

## 7Accuracy

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

## 8Parallelism and Performance

f08lsf (zgbbrd) 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 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).

## 10Example

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

### 10.1Program Text

Program Text (f08lsfe.f90)

### 10.2Program Data

Program Data (f08lsfe.d)

### 10.3Program Results

Program Results (f08lsfe.r)

© The Numerical Algorithms Group Ltd, Oxford, UK. 2017