# qyre¶

## Purpose¶

Computes the orthogonal-triangular (QR) decomposition of a matrix x and returns $$QY$$ and $$R$$.

## Format¶

{ qy, r, e } = qyre(y, x)
Parameters
• y (NxL matrix) – data

• x (NxP matrix) – data

Returns
• qy (NxL matrix) – unitary matrix

• r (KxP matrix) – upper triangular matrix. $$K = min(N,P)$$.

• e (Px1 vector) – permutation vector

## Remarks¶

Given $$X[.,E]$$, where $$E$$ is a permutation vector that permutes the columns of $$X$$, there is an orthogonal matrix $$Q$$ such that $$Q'X[.,E]$$ is zero below its diagonal, i.e.,

$\begin{split}Q′R[ ., E ] = \begin{bmatrix} R \\ 0 \end{bmatrix}\end{split}$

where $$R$$ is upper triangular. If we partition

$Q = [Q_1 Q_2]$

where $$Q_1$$ has $$P$$ columns, then

$X[ ., E ] = Q_1R$

is the QR decomposition of $$X[., E]$$.

For most problems $$Q$$ or $$Q_1$$ is not what is required. Since $$Q$$ can be a very large matrix, qyre() has been provided for the calculation of $$QY$$, where $$Y$$ is some NxL matrix, which will be a much smaller matrix.

If either $$Q'Y$$ or $$Q_1'Y$$ are required, see qtyre().

If $$N < P$$, the factorization assumes the form:

$Q′R[ ., E ] = [R_1 R_2]$

where $$R_1$$ is a PxP upper triangular matrix and $$R_2$$ is $$P \times (N-P)$$. Thus $$Q$$ is a PxP matrix and $$R$$ is a PxN matrix containing $$R_1$$ and $$R_2$$.

qyr.src