# NAG Library Routine Document

## 1Purpose

f08bcf (dtpmqrt) multiplies an arbitrary real matrix $C$ by the real orthogonal matrix $Q$ from a $QR$ factorization computed by f08bbf (dtpqrt).

## 2Specification

Fortran Interface
 Subroutine f08bcf ( 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 Real (Kind=nag_wp), Intent (In) :: v(ldv,*), t(ldt,*) Real (Kind=nag_wp), Intent (Inout) :: c1(ldc1,*), c2(ldc2,*), work(*) Character (1), Intent (In) :: side, trans
#include nagmk26.h
 void f08bcf_ (const char *side, const char *trans, const Integer *m, const Integer *n, const Integer *k, const Integer *l, const Integer *nb, const double v[], const Integer *ldv, const double t[], const Integer *ldt, double c1[], const Integer *ldc1, double c2[], const Integer *ldc2, double work[], Integer *info, const Charlen length_side, const Charlen length_trans)
The routine may be called by its LAPACK name dtpmqrt.

## 3Description

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).
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{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:     $\mathbf{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:     $\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 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:     $\mathbf{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:     $\mathbf{v}\left({\mathbf{ldv}},*\right)$ – Real (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 f08bbf (dtpqrt).
9:     $\mathbf{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:   $\mathbf{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:   $\mathbf{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:   $\mathbf{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:   $\mathbf{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:   $\mathbf{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:   $\mathbf{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:   $\mathbf{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:   $\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

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