# NAG FL Interfacef08lef (dgbbrd)

## ▸▿ Contents

Settings help

FL Name Style:

FL Specification Language:

## 1Purpose

f08lef reduces a real $m×n$ band matrix to upper bidiagonal form.

## 2Specification

Fortran Interface
 Subroutine f08lef ( 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 (Inout) :: ab(ldab,*), q(ldq,*), pt(ldpt,*), c(ldc,*) Real (Kind=nag_wp), Intent (Out) :: d(min(m,n)), e(min(m,n)-1), work(2*max(m,n)) Character (1), Intent (In) :: vect
#include <nag.h>
 void f08lef_ (const char *vect, const Integer *m, const Integer *n, const Integer *ncc, const Integer *kl, const Integer *ku, double ab[], const Integer *ldab, double d[], double e[], double q[], const Integer *ldq, double pt[], const Integer *ldpt, double c[], const Integer *ldc, double work[], Integer *info, const Charlen length_vect)
The routine may be called by the names f08lef, nagf_lapackeig_dgbbrd or its LAPACK name dgbbrd.

## 3Description

f08lef reduces a real $m×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.

## 5Arguments

1: $\mathbf{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: $\mathbf{m}$Integer Input
On entry: $m$, the number of rows of the matrix $A$.
Constraint: ${\mathbf{m}}\ge 0$.
3: $\mathbf{n}$Integer Input
On entry: $n$, the number of columns of the matrix $A$.
Constraint: ${\mathbf{n}}\ge 0$.
4: $\mathbf{ncc}$Integer Input
On entry: ${n}_{C}$, the number of columns of the matrix $C$.
Constraint: ${\mathbf{ncc}}\ge 0$.
5: $\mathbf{kl}$Integer Input
On entry: the number of subdiagonals, ${k}_{l}$, within the band of $A$.
Constraint: ${\mathbf{kl}}\ge 0$.
6: $\mathbf{ku}$Integer Input
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)$Real (Kind=nag_wp) array Input/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×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
 $ab(ku+1+i-j,j) for ​max(1,j-ku)≤i≤min(m,j+kl).$
On exit: ab is overwritten by values generated during the reduction.
8: $\mathbf{ldab}$Integer Input
On entry: the first dimension of the array ab as declared in the (sub)program from which f08lef 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) array Output
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) array Output
On exit: the superdiagonal elements of the bidiagonal matrix $B$.
11: $\mathbf{q}\left({\mathbf{ldq}},*\right)$Real (Kind=nag_wp) array Output
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×m$ orthogonal matrix $Q$.
If ${\mathbf{vect}}=\text{'N'}$ or $\text{'P'}$, q is not referenced.
12: $\mathbf{ldq}$Integer Input
On entry: the first dimension of the array q as declared in the (sub)program from which f08lef 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)$Real (Kind=nag_wp) array Output
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×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: $\mathbf{ldpt}$Integer Input
On entry: the first dimension of the array pt as declared in the (sub)program from which f08lef 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)$Real (Kind=nag_wp) array Input/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×{n}_{C}$ matrix $C$.
On exit: c is overwritten by ${Q}^{\mathrm{T}}C$. If ${\mathbf{ncc}}=0$, c is not referenced.
16: $\mathbf{ldc}$Integer Input
On entry: the first dimension of the array c as declared in the (sub)program from which f08lef 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(2×\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{m}},{\mathbf{n}}\right)\right)$Real (Kind=nag_wp) array Workspace
18: $\mathbf{info}$Integer Output
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{T}}=A+E$, where
 $‖E‖2 ≤ c (n) ε ‖A‖2 ,$
$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
 $‖F‖2 = O(ε) .$
A similar statement holds for the computed matrix ${P}^{\mathrm{T}}$.

## 8Parallelism and Performance

f08lef 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:
• $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.

## 10Example

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

### 10.1Program Text

Program Text (f08lefe.f90)

### 10.2Program Data

Program Data (f08lefe.d)

### 10.3Program Results

Program Results (f08lefe.r)