﻿ f08ag Method
f08ag multiplies an arbitrary real matrix $C$ by the real orthogonal matrix $Q$ from a $QR$ factorization computed by (F08AEF not in this release) f08be f08bf.

Syntax

C#
```public static void f08ag(
string side,
string trans,
int m,
int n,
int k,
double[,] a,
double[] tau,
double[,] c,
out int info
)```
Visual Basic
```Public Shared Sub f08ag ( _
side As String, _
trans As String, _
m As Integer, _
n As Integer, _
k As Integer, _
a As Double(,), _
tau As Double(), _
c As Double(,), _
<OutAttribute> ByRef info As Integer _
)```
Visual C++
```public:
static void f08ag(
String^ side,
String^ trans,
int m,
int n,
int k,
array<double,2>^ a,
array<double>^ tau,
array<double,2>^ c,
[OutAttribute] int% info
)```
F#
```static member f08ag :
side : string *
trans : string *
m : int *
n : int *
k : int *
a : float[,] *
tau : float[] *
c : float[,] *
info : int byref -> unit
```

Parameters

side
Type: System..::..String
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"}$.
trans
Type: System..::..String
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"}$.
m
Type: System..::..Int32
On entry: $m$, the number of rows of the matrix $C$.
Constraint: ${\mathbf{m}}\ge 0$.
n
Type: System..::..Int32
On entry: $n$, the number of columns of the matrix $C$.
Constraint: ${\mathbf{n}}\ge 0$.
k
Type: System..::..Int32
On entry: $k$, the number of elementary reflectors whose product defines the matrix $Q$.
Constraints:
• if ${\mathbf{side}}=\text{"L"}$, ${\mathbf{m}}\ge {\mathbf{k}}\ge 0$;
• if ${\mathbf{side}}=\text{"R"}$, ${\mathbf{n}}\ge {\mathbf{k}}\ge 0$.
a
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [dim1, dim2]
Note: dim1 must satisfy the constraint:
• if ${\mathbf{side}}=\text{"L"}$, $\mathrm{dim1}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}\right)$;
• if ${\mathbf{side}}=\text{"R"}$, $\mathrm{dim1}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
Note: the second dimension of the array a must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{k}}\right)$.
On entry: details of the vectors which define the elementary reflectors, as returned by f08aef08be or f08bf.
tau
Type: array<System..::..Double>[]()[][]
An array of size [dim1]
Note: the dimension of the array tau must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{k}}\right)$.
On entry: further details of the elementary reflectors, as returned by f08aef08be or f08bf.
c
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [dim1, dim2]
Note: dim1 must satisfy the constraint: $\mathrm{dim1}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}\right)$
Note: the second dimension of the array c must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
On entry: the $m$ by $n$ matrix $C$.
On exit: c is overwritten by $QC$ or ${Q}^{\mathrm{T}}C$ or $CQ$ or $C{Q}^{\mathrm{T}}$ as specified by side and trans.
info
Type: System..::..Int32%
On exit: ${\mathbf{info}}=0$ unless the method detects an error (see [Error Indicators and Warnings]).

Description

f08ag is intended to be used after a call to (F08AEF not in this release) f08be f08bf which perform a $QR$ factorization of a real matrix $A$. The orthogonal matrix $Q$ is represented as a product of elementary reflectors.
This method may be used to form one of the matrix products
 $QC,QTC,CQ​ or ​CQT,$
overwriting the result on ${\mathbf{c}}$ (which may be any real rectangular matrix).
A common application of this method is in solving linear least squares problems, as described in the F08 class and illustrated in [Example] in f08ae.

References

Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore

Error Indicators and Warnings

Some error messages may refer to parameters that are dropped from this interface (LDA, LDC) In these cases, an error in another parameter has usually caused an incorrect value to be inferred.
${\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.
${\mathbf{ifail}}=-9000$
An error occured, see message report.
${\mathbf{ifail}}=-6000$
Invalid Parameters $〈\mathit{\text{value}}〉$
${\mathbf{ifail}}=-4000$
Invalid dimension for array $〈\mathit{\text{value}}〉$
${\mathbf{ifail}}=-8000$
Negative dimension for array $〈\mathit{\text{value}}〉$
${\mathbf{ifail}}=-6000$
Invalid Parameters $〈\mathit{\text{value}}〉$
${\mathbf{ifail}}=-6000$
Invalid Parameters $〈\mathit{\text{value}}〉$

Accuracy

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

Parallelism and Performance

None.

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