NAG FL Interface
f08bpf (ztpqrt)
1
Purpose
f08bpf computes the $QR$ factorization of a complex $\left(m+n\right)$ by $n$ triangularpentagonal matrix.
2
Specification
Fortran Interface
Subroutine f08bpf ( 
m, n, l, nb, a, lda, b, ldb, t, ldt, work, info) 
Integer, Intent (In) 
:: 
m, n, l, nb, lda, ldb, ldt 
Integer, Intent (Out) 
:: 
info 
Complex (Kind=nag_wp), Intent (Inout) 
:: 
a(lda,*), b(ldb,*), t(ldt,*), work(*) 

C Header Interface
#include <nag.h>
void 
f08bpf_ (const Integer *m, const Integer *n, const Integer *l, const Integer *nb, Complex a[], const Integer *lda, Complex b[], const Integer *ldb, Complex t[], const Integer *ldt, Complex work[], Integer *info) 

C++ Header Interface
#include <nag.h> extern "C" {
void 
f08bpf_ (const Integer &m, const Integer &n, const Integer &l, const Integer &nb, Complex a[], const Integer &lda, Complex b[], const Integer &ldb, Complex t[], const Integer &ldt, Complex work[], Integer &info) 
}

The routine may be called by the names f08bpf, nagf_lapackeig_ztpqrt or its LAPACK name ztpqrt.
3
Description
f08bpf forms the
$QR$ factorization of a complex
$\left(m+n\right)$ by
$n$ triangularpentagonal matrix
$C$,
where
$A$ is an upper triangular
$n$ by
$n$ matrix and
$B$ is an
$m$ by
$n$ pentagonal matrix consisting of an
$\left(ml\right)$ by
$n$ rectangular matrix
${B}_{1}$ on top of an
$l$ by
$n$ upper trapezoidal matrix
${B}_{2}$:
The upper trapezoidal matrix ${B}_{2}$ consists of the first $l$ rows of an $n$ by $n$ upper triangular matrix, where $0\le l\le \mathrm{min}\phantom{\rule{0.125em}{0ex}}\left(m,n\right)$. If $l=0$, $B$ is $m$ by $n$ rectangular; if $l=n$ and $m=n$, $B$ is upper triangular.
A recursive, explicitly blocked,
$QR$ factorization (see
f08apf) is performed on the matrix
$C$. The upper triangular matrix
$R$, details of the unitary matrix
$Q$, and further details (the block reflector factors) of
$Q$ are returned.
Typically the matrix $A$ or ${B}_{2}$ contains the matrix $R$ from the $QR$ factorization of a subproblem and f08bpf performs the $QR$ update operation from the inclusion of matrix ${B}_{1}$.
For example, consider the
$QR$ factorization of an
$l$ by
$n$ matrix
$\hat{B}$ with
$l<n$:
$\hat{B}=\hat{Q}\hat{R}$,
$\hat{R}=\left(\begin{array}{cc}\hat{{R}_{1}}& \hat{{R}_{2}}\end{array}\right)$, where
$\hat{{R}_{1}}$ is
$l$ by
$l$ upper triangular and
$\hat{{R}_{2}}$ is
$\left(nl\right)$ by
$n$ rectangular (this can be performed by
f08apf). Given an initial least squares problem
$\hat{B}\hat{X}=\hat{Y}$ where
$X$ and
$Y$ are
$l$ by
$\mathit{nrhs}$ matrices, we have
$\hat{R}\hat{X}={\hat{Q}}^{\mathrm{H}}\hat{Y}$.
Now, adding an additional
$ml$ rows to the original system gives the augmented least squares problem
where
$B$ is an
$m$ by
$n$ matrix formed by adding
$ml$ rows on top of
$\hat{R}$ and
$Y$ is an
$m$ by
$\mathit{nrhs}$ matrix formed by adding
$ml$ rows on top of
${\hat{Q}}^{\mathrm{H}}\hat{Y}$.
f08bpf can then be used to perform the $QR$ factorization of the pentagonal matrix $B$; the $n$ by $n$ matrix $A$ will be zero on input and contain $R$ on output.
In the case where $\hat{B}$ is $r$ by $n$, $r\ge n$, $\hat{R}$ is $n$ by $n$ upper triangular (forming $A$) on top of $rn$ rows of zeros (forming first $rn$ rows of $B$). Augmentation is then performed by adding rows to the bottom of $B$ with $l=0$.
4
References
Elmroth E and Gustavson F (2000) Applying Recursion to Serial and Parallel $QR$ Factorization Leads to Better Performance IBM Journal of Research and Development. (Volume 44) 4 605–624
Golub G H and Van Loan C F (2012) Matrix Computations (4th Edition) Johns Hopkins University Press, Baltimore
5
Arguments

1:
$\mathbf{m}$ – Integer
Input

On entry: $m$, the number of rows of the matrix $B$.
Constraint:
${\mathbf{m}}\ge 0$.

2:
$\mathbf{n}$ – Integer
Input

On entry: $n$, the number of columns of the matrix $B$ and the order of the upper triangular matrix $A$.
Constraint:
${\mathbf{n}}\ge 0$.

3:
$\mathbf{l}$ – Integer
Input

On entry: $l$, the number of rows of the trapezoidal part of $B$ (i.e., ${B}_{2}$).
Constraint:
$0\le {\mathbf{l}}\le \mathrm{min}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{m}},{\mathbf{n}}\right)$.

4:
$\mathbf{nb}$ – Integer
Input

On entry: the explicitly chosen blocksize to be used in the algorithm for computing the
$QR$ factorization. See
Section 9 for details.
Constraints:
 ${\mathbf{nb}}\ge 1$;
 if ${\mathbf{n}}>0$, ${\mathbf{nb}}\le {\mathbf{n}}$.

5:
$\mathbf{a}\left({\mathbf{lda}},*\right)$ – Complex (Kind=nag_wp) array
Input/Output

Note: the second dimension of the array
a
must be at least
$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
On entry: the $n$ by $n$ upper triangular matrix $A$.
On exit: the upper triangle is overwritten by the corresponding elements of the $n$ by $n$ upper triangular matrix $R$.

6:
$\mathbf{lda}$ – Integer
Input

On entry: the first dimension of the array
a as declared in the (sub)program from which
f08bpf is called.
Constraint:
${\mathbf{lda}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.

7:
$\mathbf{b}\left({\mathbf{ldb}},*\right)$ – Complex (Kind=nag_wp) array
Input/Output

Note: the second dimension of the array
b
must be at least
$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
On entry: the $m$ by $n$ pentagonal matrix $B$ composed of an $\left(ml\right)$ by $n$ rectangular matrix ${B}_{1}$ above an $l$ by $n$ upper trapezoidal matrix ${B}_{2}$.
On exit: details of the unitary matrix $Q$.

8:
$\mathbf{ldb}$ – Integer
Input

On entry: the first dimension of the array
b as declared in the (sub)program from which
f08bpf is called.
Constraint:
${\mathbf{ldb}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}\right)$.

9:
$\mathbf{t}\left({\mathbf{ldt}},*\right)$ – Complex (Kind=nag_wp) array
Output

Note: the second dimension of the array
t
must be at least
${\mathbf{n}}$.
On exit: further details of the unitary matrix
$Q$. The number of blocks is
$b=\u2308\frac{k}{{\mathbf{nb}}}\u2309$, where
$k=\mathrm{min}\phantom{\rule{0.125em}{0ex}}\left(m,n\right)$ and each block is of order
nb except for the last block, which is of order
$k\left(b1\right)\times {\mathbf{nb}}$. For each of the blocks, an upper triangular block reflector factor is computed:
${\mathit{T}}_{1},{\mathit{T}}_{2},\dots ,{\mathit{T}}_{b}$. These are stored in the
${\mathbf{nb}}$ by
$n$ matrix
$T$ as
$\mathit{T}=\left[{\mathit{T}}_{1}\left{\mathit{T}}_{2}\right\cdots {\mathit{T}}_{b}\right]$.

10:
$\mathbf{ldt}$ – Integer
Input

On entry: the first dimension of the array
t as declared in the (sub)program from which
f08bpf is called.
Constraint:
${\mathbf{ldt}}\ge {\mathbf{nb}}$.

11:
$\mathbf{work}\left(*\right)$ – Complex (Kind=nag_wp) array
Workspace

Note: the dimension of the array
work
must be at least
${\mathbf{nb}}\times {\mathbf{n}}$.

12:
$\mathbf{info}$ – Integer
Output
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 factorization is the exact factorization of a nearby matrix
$\left(A+E\right)$, where
and
$\epsilon $ is the
machine precision.
8
Parallelism and Performance
f08bpf 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 implementationspecific information.
The total number of floatingpoint operations is approximately $\frac{2}{3}{n}^{2}\left(3mn\right)$ if $m\ge n$ or $\frac{2}{3}{m}^{2}\left(3nm\right)$ if $m<n$.
The block size,
nb, used by
f08bpf is supplied explicitly through the interface. For moderate and large sizes of matrix, the block size can have a marked effect on the efficiency of the algorithm with the optimal value being dependent on problem size and platform. A value of
${\mathbf{nb}}=64\ll \mathrm{min}\phantom{\rule{0.125em}{0ex}}\left(m,n\right)$ is likely to achieve good efficiency and it is unlikely that an optimal value would exceed
$340$.
To apply
$Q$ to an arbitrary complex rectangular matrix
$C$,
f08bpf may be followed by a call to
f08bqf. For example,
Call ztpmqrt('Left','Transpose',m,p,n,l,nb,b,ldb, &
t,ldt,c,ldc,c(n+1,1),ldc,work,info)
forms
$C={Q}^{\mathrm{H}}C$, where
$C$ is
$\left(m+n\right)$ by
$p$.
To form the unitary matrix
$Q$ explicitly set
$p=m+n$, initialize
$C$ to the identity matrix and make a call to
f08bqf as above.
10
Example
This example finds the basic solutions for the linear least squares problems
where
${b}_{1}$ and
${b}_{2}$ are the columns of the matrix
$B$,
A
$QR$ factorization is performed on the first
$4$ rows of
$A$ using
f08apf after which the first
$4$ rows of
$B$ are updated by applying
${Q}^{T}$ using
f08aqf. The remaining row is added by performing a
$QR$ update using
f08bpf;
$B$ is updated by applying the new
${Q}^{T}$ using
f08bqf; the solution is finally obtained by triangular solve using
$R$ from the updated
$QR$.
10.1
Program Text
10.2
Program Data
10.3
Program Results