f08 Chapter Contents
f08 Chapter Introduction
NAG Library Manual

NAG Library Function Documentnag_ztpmqrt (f08bqc)

1  Purpose

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

2  Specification

 #include #include
 void nag_ztpmqrt (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)

3  Description

nag_ztpmqrt (f08bqc) is intended to be used after a call to nag_ztpqrt (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}$ 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 nag_ztpqrt (f08bpc)); the number of columns of $V$ is ${n}_{v}$ (i.e., n as passed to nag_ztpqrt (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}$ 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 nag_ztpqrt (f08bpc).

4  References

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

5  Arguments

1:     orderNag_OrderTypeInput
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.2.1.3 in the Essential Introduction for a more detailed explanation of the use of this argument.
Constraint: ${\mathbf{order}}=\mathrm{Nag_RowMajor}$ or $\mathrm{Nag_ColMajor}$.
2:     sideNag_SideTypeInput
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:     transNag_TransTypeInput
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:     mIntegerInput
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:     nIntegerInput
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:     kIntegerInput
On entry: $k$, the number of elementary reflectors whose product defines the matrix $Q$.
Constraint: ${\mathbf{k}}\ge 0$.
7:     lIntegerInput
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 nag_ztpqrt (f08bpc). This must be the same value used in the previous call to nag_ztpqrt (f08bpc) (see l in nag_ztpqrt (f08bpc)).
Constraint: $0\le {\mathbf{l}}\le {\mathbf{k}}$.
8:     nbIntegerInput
On entry: $\mathit{nb}$, the blocking factor used in a previous call to nag_ztpqrt (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:     v[$\mathit{dim}$]const ComplexInput
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}$ by ${n}_{v}$ matrix $V$; this should remain unchanged from the array b returned by a previous call to nag_ztpqrt (f08bpc).
10:   pdvIntegerInput
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:   t[$\mathit{dim}$]const ComplexInput
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 nag_ztpqrt (f08bpc) (see t in nag_ztpqrt (f08bpc)).
12:   pdtIntegerInput
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:   c1[$\mathit{dim}$]ComplexInput/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:   pdc1IntegerInput
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:   c2[$\mathit{dim}$]ComplexInput/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:   pdc2IntegerInput
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:   failNagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

6  Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
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.

7  Accuracy

The computed result differs from the exact result by a matrix $E$ such that
 $E2 = Oε C2 ,$
where $\epsilon$ is the machine precision.

8  Parallelism and Performance

nag_ztpmqrt (f08bqc) is not threaded by NAG in any implementation.
nag_ztpmqrt (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.

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