# NAG CL Interfacef08bqc (ztpmqrt)

Settings help

CL Name Style:

## 1Purpose

f08bqc multiplies an arbitrary complex matrix $C$ by the complex unitary matrix $Q$ from a $QR$ factorization computed by f08bpc.

## 2Specification

 #include
 void f08bqc (Nag_OrderType order, Nag_SideType side, Nag_TransType trans, Integer m, Integer n, Integer k, Integer l, Integer nb, const Complex v[], Integer pdv, const Complex t[], Integer pdt, Complex c1[], Integer pdc1, Complex c2[], Integer pdc2, NagError *fail)
The function may be called by the names: f08bqc, nag_lapackeig_ztpmqrt or nag_ztpmqrt.

## 3Description

f08bqc is intended to be used after a call to f08bpc 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 function may be used to form the matrix products
 $QC , QHC , CQ ​ or ​ CQH ,$
where the complex rectangular ${m}_{c}×{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×{n}_{c}$, ${C}_{2}$ is ${m}_{v}×{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 f08bpc); the number of columns of $V$ is ${n}_{v}$ (i.e., n as passed to f08bpc).
If $Q$ is being applied from the right ($CQ$ or $C{Q}^{\mathrm{H}}$) then
 $C = ( C1 C2 )$
where ${C}_{1}$ is ${m}_{c}×k$, and ${C}_{2}$ is ${m}_{c}×{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 f08bpc.

## 4References

Golub G H and Van Loan C F (2012) Matrix Computations (4th Edition) Johns Hopkins University Press, Baltimore

## 5Arguments

1: $\mathbf{order}$Nag_OrderType Input
On entry: the order argument specifies the two-dimensional storage scheme being used, i.e., row-major ordering or column-major ordering. C language defined storage is specified by ${\mathbf{order}}=\mathrm{Nag_RowMajor}$. See Section 3.1.3 in the Introduction to the NAG Library CL Interface for a more detailed explanation of the use of this argument.
Constraint: ${\mathbf{order}}=\mathrm{Nag_RowMajor}$ or $\mathrm{Nag_ColMajor}$.
2: $\mathbf{side}$Nag_SideType Input
On entry: indicates how $Q$ or ${Q}^{\mathrm{H}}$ is to be applied to $C$.
${\mathbf{side}}=\mathrm{Nag_LeftSide}$
$Q$ or ${Q}^{\mathrm{H}}$ is applied to $C$ from the left.
${\mathbf{side}}=\mathrm{Nag_RightSide}$
$Q$ or ${Q}^{\mathrm{H}}$ is applied to $C$ from the right.
Constraint: ${\mathbf{side}}=\mathrm{Nag_LeftSide}$ or $\mathrm{Nag_RightSide}$.
3: $\mathbf{trans}$Nag_TransType Input
On entry: indicates whether $Q$ or ${Q}^{\mathrm{H}}$ is to be applied to $C$.
${\mathbf{trans}}=\mathrm{Nag_NoTrans}$
$Q$ is applied to $C$.
${\mathbf{trans}}=\mathrm{Nag_ConjTrans}$
${Q}^{\mathrm{H}}$ is applied to $C$.
Constraint: ${\mathbf{trans}}=\mathrm{Nag_NoTrans}$ or $\mathrm{Nag_ConjTrans}$.
4: $\mathbf{m}$Integer Input
On entry: the number of rows of the matrix ${C}_{2}$, that is,
if ${\mathbf{side}}=\mathrm{Nag_LeftSide}$
then ${m}_{v}$, the number of rows of the matrix $V$;
if ${\mathbf{side}}=\mathrm{Nag_RightSide}$
then ${m}_{c}$, the number of rows of the matrix $C$.
Constraint: ${\mathbf{m}}\ge 0$.
5: $\mathbf{n}$Integer Input
On entry: the number of columns of the matrix ${C}_{2}$, that is,
if ${\mathbf{side}}=\mathrm{Nag_LeftSide}$
then ${n}_{c}$, the number of columns of the matrix $C$;
if ${\mathbf{side}}=\mathrm{Nag_RightSide}$
then ${n}_{v}$, the number of columns of the matrix $V$.
Constraint: ${\mathbf{n}}\ge 0$.
6: $\mathbf{k}$Integer Input
On entry: $k$, the number of elementary reflectors whose product defines the matrix $Q$.
Constraint: ${\mathbf{k}}\ge 0$.
7: $\mathbf{l}$Integer Input
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 f08bpc. This must be the same value used in the previous call to f08bpc (see l in f08bpc).
Constraint: $0\le {\mathbf{l}}\le {\mathbf{k}}$.
8: $\mathbf{nb}$Integer Input
On entry: $\mathit{nb}$, the blocking factor used in a previous call to f08bpc 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}}$.
9: $\mathbf{v}\left[\mathit{dim}\right]$const Complex Input
Note: the dimension, dim, of the array v must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdv}}×{\mathbf{k}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}×{\mathbf{pdv}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$ and ${\mathbf{side}}=\mathrm{Nag_LeftSide}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}×{\mathbf{pdv}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$ and ${\mathbf{side}}=\mathrm{Nag_RightSide}$.
The $\left(i,j\right)$th element of the matrix $V$ is stored in
• ${\mathbf{v}}\left[\left(j-1\right)×{\mathbf{pdv}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{v}}\left[\left(i-1\right)×{\mathbf{pdv}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On entry: the ${m}_{v}×{n}_{v}$ matrix $V$; this should remain unchanged from the array b returned by a previous call to f08bpc.
10: $\mathbf{pdv}$Integer Input
On entry: the stride separating row or column elements (depending on the value of order) in the array v.
Constraints:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$,
• if ${\mathbf{side}}=\mathrm{Nag_LeftSide}$, ${\mathbf{pdv}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}\right)$;
• if ${\mathbf{side}}=\mathrm{Nag_RightSide}$, ${\mathbf{pdv}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$, ${\mathbf{pdv}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{k}}\right)$.
11: $\mathbf{t}\left[\mathit{dim}\right]$const Complex Input
Note: the dimension, dim, of the array t must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdt}}×{\mathbf{k}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{nb}}×{\mathbf{pdt}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
The $\left(i,j\right)$th element of the matrix $T$ is stored in
• ${\mathbf{t}}\left[\left(j-1\right)×{\mathbf{pdt}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{t}}\left[\left(i-1\right)×{\mathbf{pdt}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On entry: this must remain unchanged from a previous call to f08bpc (see t in f08bpc).
12: $\mathbf{pdt}$Integer Input
On entry: the stride separating row or column elements (depending on the value of order) in the array t.
Constraints:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$, ${\mathbf{pdt}}\ge {\mathbf{nb}}$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$, ${\mathbf{pdt}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{k}}\right)$.
13: $\mathbf{c1}\left[\mathit{dim}\right]$Complex Input/Output
Note: the dimension, dim, of the array c1 must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdc1}}×{\mathbf{n}}\right)$ when ${\mathbf{side}}=\mathrm{Nag_LeftSide}$ and ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{k}}×{\mathbf{pdc1}}\right)$ when ${\mathbf{side}}=\mathrm{Nag_LeftSide}$ and ${\mathbf{order}}=\mathrm{Nag_RowMajor}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdc1}}×{\mathbf{k}}\right)$ when ${\mathbf{side}}=\mathrm{Nag_RightSide}$ and ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}×{\mathbf{pdc1}}\right)$ when ${\mathbf{side}}=\mathrm{Nag_RightSide}$ and ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On entry: ${C}_{1}$, the first part of the composite matrix $C$:
if ${\mathbf{side}}=\mathrm{Nag_LeftSide}$
then c1 contains the first $k$ rows of $C$;
if ${\mathbf{side}}=\mathrm{Nag_RightSide}$
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}}$.
14: $\mathbf{pdc1}$Integer Input
On entry: the stride separating row or column elements (depending on the value of order) in the array c1.
Constraints:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$,
• if ${\mathbf{side}}=\mathrm{Nag_LeftSide}$, ${\mathbf{pdc1}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{k}}\right)$;
• if ${\mathbf{side}}=\mathrm{Nag_RightSide}$, ${\mathbf{pdc1}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}\right)$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$,
• if ${\mathbf{side}}=\mathrm{Nag_LeftSide}$, ${\mathbf{pdc1}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$;
• if ${\mathbf{side}}=\mathrm{Nag_RightSide}$, ${\mathbf{pdc1}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{k}}\right)$.
15: $\mathbf{c2}\left[\mathit{dim}\right]$Complex Input/Output
Note: the dimension, dim, of the array c2 must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdc2}}×{\mathbf{n}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}×{\mathbf{pdc2}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On entry: ${C}_{2}$, the second part of the composite matrix $C$.
if ${\mathbf{side}}=\mathrm{Nag_LeftSide}$
then c2 contains the remaining ${m}_{v}$ rows of $C$;
if ${\mathbf{side}}=\mathrm{Nag_RightSide}$
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}}$.
16: $\mathbf{pdc2}$Integer Input
On entry: the stride separating row or column elements (depending on the value of order) in the array c2.
Constraints:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$, ${\mathbf{pdc2}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}\right)$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$, ${\mathbf{pdc2}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
17: $\mathbf{fail}$NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

## 6Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
On entry, argument $⟨\mathit{\text{value}}⟩$ had an illegal value.
NE_ENUM_INT_3
On entry, ${\mathbf{side}}=⟨\mathit{\text{value}}⟩$, ${\mathbf{k}}=⟨\mathit{\text{value}}⟩$, ${\mathbf{m}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{pdc1}}=⟨\mathit{\text{value}}⟩$.
Constraint: if ${\mathbf{side}}=\mathrm{Nag_LeftSide}$, ${\mathbf{pdc1}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{k}}\right)$;
if ${\mathbf{side}}=\mathrm{Nag_RightSide}$, ${\mathbf{pdc1}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}\right)$.
On entry, ${\mathbf{side}}=⟨\mathit{\text{value}}⟩$, ${\mathbf{m}}=⟨\mathit{\text{value}}⟩$, ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{pdv}}=⟨\mathit{\text{value}}⟩$.
Constraint: if ${\mathbf{side}}=\mathrm{Nag_LeftSide}$, ${\mathbf{pdv}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}\right)$;
if ${\mathbf{side}}=\mathrm{Nag_RightSide}$, ${\mathbf{pdv}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
On entry, ${\mathbf{side}}=⟨\mathit{\text{value}}⟩$, ${\mathbf{pdc1}}=⟨\mathit{\text{value}}⟩$, ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{k}}=⟨\mathit{\text{value}}⟩$.
Constraint: if ${\mathbf{side}}=\mathrm{Nag_LeftSide}$, ${\mathbf{pdc1}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$;
if ${\mathbf{side}}=\mathrm{Nag_RightSide}$, ${\mathbf{pdc1}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{k}}\right)$.
NE_INT
On entry, ${\mathbf{k}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{k}}\ge 0$.
On entry, ${\mathbf{m}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{m}}\ge 0$.
On entry, ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{n}}\ge 0$.
NE_INT_2
On entry, ${\mathbf{l}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{k}}=⟨\mathit{\text{value}}⟩$.
Constraint: $0\le {\mathbf{l}}\le {\mathbf{k}}$.
On entry, ${\mathbf{m}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{pdc2}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{pdc2}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}\right)$.
On entry, ${\mathbf{nb}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{k}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{nb}}\ge 1$ and
if ${\mathbf{k}}>0$, ${\mathbf{nb}}\le {\mathbf{k}}$.
On entry, ${\mathbf{pdc2}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{pdc2}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
On entry, ${\mathbf{pdt}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{k}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{pdt}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{k}}\right)$.
On entry, ${\mathbf{pdt}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{nb}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{pdt}}\ge {\mathbf{nb}}$.
On entry, ${\mathbf{pdv}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{k}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{pdv}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{k}}\right)$.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.

## 7Accuracy

The computed result differs from the exact result by a matrix $E$ such that
 $‖E‖2 = O(ε) ‖C‖2 ,$
where $\epsilon$ is the machine precision.

## 8Parallelism and Performance

f08bqc 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 function. 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}}=\mathrm{Nag_LeftSide}$ and $2mk\left(2n-k\right)$ if ${\mathbf{side}}=\mathrm{Nag_RightSide}$.