F08 Chapter Contents
F08 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentF08BCF (DTPMQRT)

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

## 1  Purpose

F08BCF (DTPMQRT) multiplies an arbitrary real matrix $C$ by the real orthogonal matrix $Q$ from a $QR$ factorization computed by F08BBF (DTPQRT).

## 2  Specification

 SUBROUTINE F08BCF ( SIDE, TRANS, M, N, K, L, NB, V, LDV, T, LDT, C1, LDC1, C2, LDC2, WORK, INFO)
 INTEGER M, N, K, L, NB, LDV, LDT, LDC1, LDC2, INFO REAL (KIND=nag_wp) V(LDV,*), T(LDT,*), C1(LDC1,*), C2(LDC2,*), WORK(*) CHARACTER(1) SIDE, TRANS
The routine may be called by its LAPACK name dtpmqrt.

## 3  Description

F08BCF (DTPMQRT) is intended to be used after a call to F08BBF (DTPQRT) which performs a $QR$ factorization of a triangular-pentagonal matrix containing an upper triangular matrix $A$ over a pentagonal matrix $B$. The orthogonal matrix $Q$ is represented as a product of elementary reflectors.
This routine may be used to form the matrix products
 $QC , QTC , CQ ​ or ​ CQT ,$
where the real 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{T}}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 F08BBF (DTPQRT)); the number of columns of $V$ is ${n}_{v}$ (i.e., N as passed to F08BBF (DTPQRT)).
If $Q$ is being applied from the right ($CQ$ or $C{Q}^{\mathrm{T}}$) 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 F08BBF (DTPQRT).

## 4  References

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

## 5  Parameters

1:     $\mathrm{SIDE}$ – CHARACTER(1)Input
On entry: indicates how $Q$ or ${Q}^{\mathrm{T}}$ is to be applied to $C$.
${\mathbf{SIDE}}=\text{'L'}$
$Q$ or ${Q}^{\mathrm{T}}$ is applied to $C$ from the left.
${\mathbf{SIDE}}=\text{'R'}$
$Q$ or ${Q}^{\mathrm{T}}$ is applied to $C$ from the right.
Constraint: ${\mathbf{SIDE}}=\text{'L'}$ or $\text{'R'}$.
2:     $\mathrm{TRANS}$ – CHARACTER(1)Input
On entry: indicates whether $Q$ or ${Q}^{\mathrm{T}}$ is to be applied to $C$.
${\mathbf{TRANS}}=\text{'N'}$
$Q$ is applied to $C$.
${\mathbf{TRANS}}=\text{'T'}$
${Q}^{\mathrm{T}}$ is applied to $C$.
Constraint: ${\mathbf{TRANS}}=\text{'N'}$ or $\text{'T'}$.
3:     $\mathrm{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:     $\mathrm{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:     $\mathrm{K}$ – INTEGERInput
On entry: $k$, the number of elementary reflectors whose product defines the matrix $Q$.
Constraint: ${\mathbf{K}}\ge 0$.
6:     $\mathrm{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 F08BBF (DTPQRT). This must be the same value used in the previous call to F08BBF (DTPQRT) (see L in F08BBF (DTPQRT)).
Constraint: $0\le {\mathbf{L}}\le {\mathbf{K}}$.
7:     $\mathrm{NB}$ – INTEGERInput
On entry: $\mathit{nb}$, the blocking factor used in a previous call to F08BBF (DTPQRT) 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:     $\mathrm{V}\left({\mathbf{LDV}},*\right)$ – REAL (KIND=nag_wp) arrayInput
Note: the second dimension of the array LDV 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 F08BBF (DTPQRT).
9:     $\mathrm{LDV}$ – INTEGERInput
On entry: the first dimension of the array V as declared in the (sub)program from which F08BCF (DTPMQRT) 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:   $\mathrm{T}\left({\mathbf{LDT}},*\right)$ – REAL (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 F08BBF (DTPQRT) (see T in F08BBF (DTPQRT)).
11:   $\mathrm{LDT}$ – INTEGERInput
On entry: the first dimension of the array T as declared in the (sub)program from which F08BCF (DTPMQRT) is called.
Constraint: ${\mathbf{LDT}}\ge {\mathbf{NB}}$.
12:   $\mathrm{C1}\left({\mathbf{LDC1}},*\right)$ – REAL (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{T}}C$ or $CQ$ or $C{Q}^{\mathrm{T}}$.
13:   $\mathrm{LDC1}$ – INTEGERInput
On entry: the first dimension of the array C1 as declared in the (sub)program from which F08BCF (DTPMQRT) 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:   $\mathrm{C2}\left({\mathbf{LDC2}},*\right)$ – REAL (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{T}}C$ or $CQ$ or $C{Q}^{\mathrm{T}}$.
15:   $\mathrm{LDC2}$ – INTEGERInput
On entry: the first dimension of the array C2 as declared in the (sub)program from which F08BCF (DTPMQRT) is called.
Constraint: ${\mathbf{LDC2}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{M}}\right)$.
16:   $\mathrm{WORK}\left(*\right)$ – REAL (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:   $\mathrm{INFO}$ – INTEGEROutput
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 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

F08BCF (DTPMQRT) is not threaded by NAG in any implementation.
F08BCF (DTPMQRT) 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'}$.