# qyr¶

## Purpose¶

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

## Format¶

{ qy, r } = qyr(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)$$.

## Remarks¶

Given $$X$$, there is an orthogonal matrix $$Q$$ such that $$Q'X$$ is zero below its diagonal, i.e.,

$\begin{split}Q′X = \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 = Q_1R$

is the QR decomposition of $$X$$. If $$X$$ has linearly independent columns, $$R$$ is also the Cholesky factorization of the moment matrix of $$X$$, i.e., of $$X'X$$.

For most problems $$Q$$ or $$Q_1$$ is not what is required. Since $$Q$$ can be a very large matrix, qyr() 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 qtyr().

qyr.src