f08 Chapter Contents
f08 Chapter Introduction
NAG C Library Manual

# NAG Library Function Documentnag_dormrz (f08bkc)

## 1  Purpose

nag_dormrz (f08bkc) multiplies a general real $m$ by $n$ matrix $C$ by the real orthogonal matrix $Z$ from an $RZ$ factorization computed by nag_dtzrzf (f08bhc).

## 2  Specification

 #include #include
 void nag_dormrz (Nag_OrderType order, Nag_SideType side, Nag_TransType trans, Integer m, Integer n, Integer k, Integer l, const double a[], Integer pda, const double tau[], double c[], Integer pdc, NagError *fail)

## 3  Description

nag_dormrz (f08bkc) is intended to be used following a call to nag_dtzrzf (f08bhc), which performs an $RZ$ factorization of a real upper trapezoidal matrix $A$ and represents the orthogonal matrix $Z$ as a product of elementary reflectors.
This function may be used to form one of the matrix products
 $ZC , ZTC , CZ , CZT ,$
overwriting the result on $C$, which may be any real rectangular $m$ by $n$ matrix.

## 4  References

Anderson E, Bai Z, Bischof C, Blackford S, Demmel J, Dongarra J J, Du Croz J J, Greenbaum A, Hammarling S, McKenney A and Sorensen D (1999) LAPACK Users' Guide (3rd Edition) SIAM, Philadelphia http://www.netlib.org/lapack/lug

## 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 Nag_ColMajor.
2:     sideNag_SideTypeInput
On entry: indicates how $Z$ or ${Z}^{\mathrm{T}}$ is to be applied to $C$.
${\mathbf{side}}=\mathrm{Nag_LeftSide}$
$Z$ or ${Z}^{\mathrm{T}}$ is applied to $C$ from the left.
${\mathbf{side}}=\mathrm{Nag_RightSide}$
$Z$ or ${Z}^{\mathrm{T}}$ is applied to $C$ from the right.
Constraint: ${\mathbf{side}}=\mathrm{Nag_LeftSide}$ or $\mathrm{Nag_RightSide}$.
3:     transNag_TransTypeInput
On entry: indicates whether $Z$ or ${Z}^{\mathrm{T}}$ is to be applied to $C$.
${\mathbf{trans}}=\mathrm{Nag_NoTrans}$
$Z$ is applied to $C$.
${\mathbf{trans}}=\mathrm{Nag_Trans}$
${Z}^{\mathrm{T}}$ is applied to $C$.
Constraint: ${\mathbf{trans}}=\mathrm{Nag_NoTrans}$ or $\mathrm{Nag_Trans}$.
4:     mIntegerInput
On entry: $m$, the number of rows of the matrix $C$.
Constraint: ${\mathbf{m}}\ge 0$.
5:     nIntegerInput
On entry: $n$, the number of columns of the matrix $C$.
Constraint: ${\mathbf{n}}\ge 0$.
6:     kIntegerInput
On entry: $k$, the number of elementary reflectors whose product defines the matrix $Z$.
Constraints:
• if ${\mathbf{side}}=\mathrm{Nag_LeftSide}$, ${\mathbf{m}}\ge {\mathbf{k}}\ge 0$;
• if ${\mathbf{side}}=\mathrm{Nag_RightSide}$, ${\mathbf{n}}\ge {\mathbf{k}}\ge 0$.
7:     lIntegerInput
On entry: $l$, the number of columns of the matrix $A$ containing the meaningful part of the Householder reflectors.
Constraints:
• if ${\mathbf{side}}=\mathrm{Nag_LeftSide}$, ${\mathbf{m}}\ge {\mathbf{l}}\ge 0$;
• if ${\mathbf{side}}=\mathrm{Nag_RightSide}$, ${\mathbf{n}}\ge {\mathbf{l}}\ge 0$.
8:     a[$\mathit{dim}$]const doubleInput
Note: the dimension, dim, of the array a must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pda}}×{\mathbf{m}}\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{pda}}\right)$ when ${\mathbf{side}}=\mathrm{Nag_LeftSide}$ and ${\mathbf{order}}=\mathrm{Nag_RowMajor}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pda}}×{\mathbf{n}}\right)$ when ${\mathbf{side}}=\mathrm{Nag_RightSide}$ and ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{k}}×{\mathbf{pda}}\right)$ when ${\mathbf{side}}=\mathrm{Nag_RightSide}$ and ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
The $\left(i,j\right)$th element of the matrix $A$ is stored in
• ${\mathbf{a}}\left[\left(j-1\right)×{\mathbf{pda}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{a}}\left[\left(i-1\right)×{\mathbf{pda}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On entry: the $\mathit{i}$th row of a must contain the vector which defines the elementary reflector ${H}_{\mathit{i}}$, for $\mathit{i}=1,2,\dots ,k$, as returned by nag_dtzrzf (f08bhc).
9:     pdaIntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array a.
Constraints:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$, ${\mathbf{pda}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{k}}\right)$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$,
• if ${\mathbf{side}}=\mathrm{Nag_LeftSide}$, ${\mathbf{pda}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}\right)$;
• if ${\mathbf{side}}=\mathrm{Nag_RightSide}$, ${\mathbf{pda}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
10:   tau[$\mathit{dim}$]const doubleInput
Note: the dimension, dim, of the array tau must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{k}}\right)$.
On entry: ${\mathbf{tau}}\left[i-1\right]$ must contain the scalar factor of the elementary reflector ${H}_{i}$, as returned by nag_dtzrzf (f08bhc).
11:   c[$\mathit{dim}$]doubleInput/Output
Note: the dimension, dim, of the array c must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdc}}×{\mathbf{n}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}×{\mathbf{pdc}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
The $\left(i,j\right)$th element of the matrix $C$ is stored in
• ${\mathbf{c}}\left[\left(j-1\right)×{\mathbf{pdc}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{c}}\left[\left(i-1\right)×{\mathbf{pdc}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On entry: the $m$ by $n$ matrix $C$.
On exit: c is overwritten by $ZC$ or ${Z}^{\mathrm{T}}C$ or $CZ$ or ${Z}^{\mathrm{T}}C$ as specified by side and trans.
12:   pdcIntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array c.
Constraints:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$, ${\mathbf{pdc}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}\right)$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$, ${\mathbf{pdc}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
13:   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{m}}=〈\mathit{\text{value}}〉$, ${\mathbf{n}}=〈\mathit{\text{value}}〉$ and ${\mathbf{k}}=〈\mathit{\text{value}}〉$.
Constraint: if ${\mathbf{side}}=\mathrm{Nag_LeftSide}$, ${\mathbf{m}}\ge {\mathbf{k}}\ge 0$;
if ${\mathbf{side}}=\mathrm{Nag_RightSide}$, ${\mathbf{n}}\ge {\mathbf{k}}\ge 0$.
On entry, ${\mathbf{side}}=〈\mathit{\text{value}}〉$, ${\mathbf{m}}=〈\mathit{\text{value}}〉$, ${\mathbf{n}}=〈\mathit{\text{value}}〉$ and ${\mathbf{l}}=〈\mathit{\text{value}}〉$.
Constraint: if ${\mathbf{side}}=\mathrm{Nag_LeftSide}$, ${\mathbf{m}}\ge {\mathbf{l}}\ge 0$;
if ${\mathbf{side}}=\mathrm{Nag_RightSide}$, ${\mathbf{n}}\ge {\mathbf{l}}\ge 0$.
On entry, ${\mathbf{side}}=〈\mathit{\text{value}}〉$, ${\mathbf{pda}}=〈\mathit{\text{value}}〉$, ${\mathbf{m}}=〈\mathit{\text{value}}〉$ and ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: if ${\mathbf{side}}=\mathrm{Nag_LeftSide}$, ${\mathbf{pda}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}\right)$;
if ${\mathbf{side}}=\mathrm{Nag_RightSide}$, ${\mathbf{pda}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
NE_INT
On entry, ${\mathbf{m}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{m}}\ge 0$.
On entry, ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{n}}\ge 0$.
On entry, ${\mathbf{pda}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pda}}>0$.
On entry, ${\mathbf{pdc}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdc}}>0$.
NE_INT_2
On entry, ${\mathbf{pda}}=〈\mathit{\text{value}}〉$ and ${\mathbf{k}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pda}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{k}}\right)$.
On entry, ${\mathbf{pdc}}=〈\mathit{\text{value}}〉$ and ${\mathbf{m}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdc}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}\right)$.
On entry, ${\mathbf{pdc}}=〈\mathit{\text{value}}〉$ and ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdc}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\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  Further Comments

The total number of floating point operations is approximately $4nlk$ if ${\mathbf{side}}=\mathrm{Nag_LeftSide}$ and $4mlk$ if ${\mathbf{side}}=\mathrm{Nag_RightSide}$.
The complex analogue of this function is nag_zunmrz (f08bxc).

## 9  Example

See Section 9 in nag_dtzrzf (f08bhc).