# NAG Library Routine Document

## 1Purpose

f08bqf (ztpmqrt) multiplies an arbitrary complex matrix $C$ by the complex unitary matrix $Q$ from a $QR$ factorization computed by f08bpf (ztpqrt).

## 2Specification

Fortran Interface
 Subroutine f08bqf ( side, m, n, k, l, nb, v, ldv, t, ldt, c1, ldc1, c2, ldc2, work, info)
 Integer, Intent (In) :: m, n, k, l, nb, ldv, ldt, ldc1, ldc2 Integer, Intent (Out) :: info Complex (Kind=nag_wp), Intent (In) :: v(ldv,*), t(ldt,*) Complex (Kind=nag_wp), Intent (Inout) :: c1(ldc1,*), c2(ldc2,*), work(*) Character (1), Intent (In) :: side, trans
#include nagmk26.h
 void f08bqf_ (const char *side, const char *trans, const Integer *m, const Integer *n, const Integer *k, const Integer *l, const Integer *nb, const Complex v[], const Integer *ldv, const Complex t[], const Integer *ldt, Complex c1[], const Integer *ldc1, Complex c2[], const Integer *ldc2, Complex work[], Integer *info, const Charlen length_side, const Charlen length_trans)
The routine may be called by its LAPACK name ztpmqrt.

## 3Description

f08bqf (ztpmqrt) is intended to be used after a call to f08bpf (ztpqrt) which performs a $QR$ factorization of a triangular-pentagonal matrix containing an upper triangular matrix $A$ over a pentagonal matrix $B$. The unitary matrix $Q$ is represented as a product of elementary reflectors.
This routine may be used to form the matrix products
 $QC , QHC , CQ ​ or ​ CQH ,$
where the complex rectangular ${m}_{c}$ by ${n}_{c}$ matrix $C$ is split into component matrices ${C}_{1}$ and ${C}_{2}$.
If $Q$ is being applied from the left ($QC$ or ${Q}^{\mathrm{H}}C$) then
 $C = C1 C2$
where ${C}_{1}$ is $k$ by ${n}_{c}$, ${C}_{2}$ is ${m}_{v}$ by ${n}_{c}$, ${m}_{c}=k+{m}_{v}$ is fixed and ${m}_{v}$ is the number of rows of the matrix $V$ containing the elementary reflectors (i.e., m as passed to f08bpf (ztpqrt)); the number of columns of $V$ is ${n}_{v}$ (i.e., n as passed to f08bpf (ztpqrt)).
If $Q$ is being applied from the right ($CQ$ or $C{Q}^{\mathrm{H}}$) then
 $C = C1 C2$
where ${C}_{1}$ is ${m}_{c}$ by $k$, and ${C}_{2}$ is ${m}_{c}$ by ${m}_{v}$ and ${n}_{c}=k+{m}_{v}$ is fixed.
The matrices ${C}_{1}$ and ${C}_{2}$ are overwriten by the result of the matrix product.
A common application of this routine is in updating the solution of a linear least squares problem as illustrated in Section 10 in f08bpf (ztpqrt).
Golub G H and Van Loan C F (2012) Matrix Computations (4th Edition) Johns Hopkins University Press, Baltimore

## 5Arguments

1:     $\mathbf{side}$ – Character(1)Input
On entry: indicates how $Q$ or ${Q}^{\mathrm{H}}$ is to be applied to $C$.
${\mathbf{side}}=\text{'L'}$
$Q$ or ${Q}^{\mathrm{H}}$ is applied to $C$ from the left.
${\mathbf{side}}=\text{'R'}$
$Q$ or ${Q}^{\mathrm{H}}$ is applied to $C$ from the right.
Constraint: ${\mathbf{side}}=\text{'L'}$ or $\text{'R'}$.
2:     $\mathbf{trans}$ – Character(1)Input
On entry: indicates whether $Q$ or ${Q}^{\mathrm{H}}$ is to be applied to $C$.
${\mathbf{trans}}=\text{'N'}$
$Q$ is applied to $C$.
${\mathbf{trans}}=\text{'C'}$
${Q}^{\mathrm{H}}$ is applied to $C$.
Constraint: ${\mathbf{trans}}=\text{'N'}$ or $\text{'C'}$.
3:     $\mathbf{m}$ – IntegerInput
On entry: the number of rows of the matrix ${C}_{2}$, that is,
if ${\mathbf{side}}=\text{'L'}$
then ${m}_{v}$, the number of rows of the matrix $V$;
if ${\mathbf{side}}=\text{'R'}$
then ${m}_{c}$, the number of rows of the matrix $C$.
Constraint: ${\mathbf{m}}\ge 0$.
4:     $\mathbf{n}$ – IntegerInput
On entry: the number of columns of the matrix ${C}_{2}$, that is,
if ${\mathbf{side}}=\text{'L'}$
then ${n}_{c}$, the number of columns of the matrix $C$;
if ${\mathbf{side}}=\text{'R'}$
then ${n}_{v}$, the number of columns of the matrix $V$.
Constraint: ${\mathbf{n}}\ge 0$.
5:     $\mathbf{k}$ – IntegerInput
On entry: $k$, the number of elementary reflectors whose product defines the matrix $Q$.
Constraint: ${\mathbf{k}}\ge 0$.
6:     $\mathbf{l}$ – IntegerInput
On entry: $l$, the number of rows of the upper trapezoidal part of the pentagonal composite matrix $V$, passed (as b) in a previous call to f08bpf (ztpqrt). This must be the same value used in the previous call to f08bpf (ztpqrt) (see l in f08bpf (ztpqrt)).
Constraint: $0\le {\mathbf{l}}\le {\mathbf{k}}$.
7:     $\mathbf{nb}$ – IntegerInput
On entry: $\mathit{nb}$, the blocking factor used in a previous call to f08bpf (ztpqrt) to compute the $QR$ factorization of a triangular-pentagonal matrix containing composite matrices $A$ and $B$.
Constraints:
• ${\mathbf{nb}}\ge 1$;
• if ${\mathbf{k}}>0$, ${\mathbf{nb}}\le {\mathbf{k}}$.
8:     $\mathbf{v}\left({\mathbf{ldv}},*\right)$ – Complex (Kind=nag_wp) arrayInput
Note: the second dimension of the array v must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{k}}\right)$.
On entry: the ${m}_{v}$ by ${n}_{v}$ matrix $V$; this should remain unchanged from the array b returned by a previous call to f08bpf (ztpqrt).
9:     $\mathbf{ldv}$ – IntegerInput
On entry: the first dimension of the array v as declared in the (sub)program from which f08bqf (ztpmqrt) is called.
Constraints:
• if ${\mathbf{side}}=\text{'L'}$, ${\mathbf{ldv}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}\right)$;
• if ${\mathbf{side}}=\text{'R'}$, ${\mathbf{ldv}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
10:   $\mathbf{t}\left({\mathbf{ldt}},*\right)$ – Complex (Kind=nag_wp) arrayInput
Note: the second dimension of the array t must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{k}}\right)$.
On entry: this must remain unchanged from a previous call to f08bpf (ztpqrt) (see t in f08bpf (ztpqrt)).
11:   $\mathbf{ldt}$ – IntegerInput
On entry: the first dimension of the array t as declared in the (sub)program from which f08bqf (ztpmqrt) is called.
Constraint: ${\mathbf{ldt}}\ge {\mathbf{nb}}$.
12:   $\mathbf{c1}\left({\mathbf{ldc1}},*\right)$ – Complex (Kind=nag_wp) arrayInput/Output
Note: the second dimension of the array c1 must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$ if ${\mathbf{side}}=\text{'L'}$ and at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{k}}\right)$ if ${\mathbf{side}}=\text{'R'}$.
On entry: ${C}_{1}$, the first part of the composite matrix $C$:
if ${\mathbf{side}}=\text{'L'}$
then c1 contains the first $k$ rows of $C$;
if ${\mathbf{side}}=\text{'R'}$
then c1 contains the first $k$ columns of $C$.
On exit: c1 is overwritten by the corresponding block of $QC$ or ${Q}^{\mathrm{H}}C$ or $CQ$ or $C{Q}^{\mathrm{H}}$.
13:   $\mathbf{ldc1}$ – IntegerInput
On entry: the first dimension of the array c1 as declared in the (sub)program from which f08bqf (ztpmqrt) is called.
Constraints:
• if ${\mathbf{side}}=\text{'L'}$, ${\mathbf{ldc1}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{k}}\right)$;
• if ${\mathbf{side}}=\text{'R'}$, ${\mathbf{ldc1}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}\right)$.
14:   $\mathbf{c2}\left({\mathbf{ldc2}},*\right)$ – Complex (Kind=nag_wp) arrayInput/Output
Note: the second dimension of the array c2 must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
On entry: ${C}_{2}$, the second part of the composite matrix $C$.
if ${\mathbf{side}}=\text{'L'}$
then c2 contains the remaining ${m}_{v}$ rows of $C$;
if ${\mathbf{side}}=\text{'R'}$
then c2 contains the remaining ${m}_{v}$ columns of $C$;
On exit: c2 is overwritten by the corresponding block of $QC$ or ${Q}^{\mathrm{H}}C$ or $CQ$ or $C{Q}^{\mathrm{H}}$.
15:   $\mathbf{ldc2}$ – IntegerInput
On entry: the first dimension of the array c2 as declared in the (sub)program from which f08bqf (ztpmqrt) is called.
Constraint: ${\mathbf{ldc2}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}\right)$.
16:   $\mathbf{work}\left(*\right)$ – Complex (Kind=nag_wp) arrayWorkspace
Note: the dimension of the array work must be at least ${\mathbf{n}}×{\mathbf{nb}}$ if ${\mathbf{side}}=\text{'L'}$ and at least ${\mathbf{m}}×{\mathbf{nb}}$ if ${\mathbf{side}}=\text{'R'}$.
17:   $\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 result differs from the exact result by a matrix $E$ such that
 $E2 = Oε C2 ,$
where $\epsilon$ is the machine precision.

## 8Parallelism and Performance

f08bqf (ztpmqrt) 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 floating-point operations is approximately $2nk\left(2m-k\right)$ if ${\mathbf{side}}=\text{'L'}$ and $2mk\left(2n-k\right)$ if ${\mathbf{side}}=\text{'R'}$.