qyrep

Purpose

Computes the orthogonal-triangular (QR) decomposition of a matrix \(X\) using a pivot vector and returns \(QY\) and \(R\).

Format

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

  • x (NxP matrix) – data

  • pvt (Px1 vector) –

    controls the selection of the pivot columns:

    if \(pvt[i] > 0\), \(x[i]\) is an initial column.

    if \(pvt[i] = 0\), \(x[i]\) is a free column.

    if \(pvt[i] < 0\), \(x[i]\) is a final column.

    The initial columns are placed at the beginning of the matrix and the final columns are placed at the end. Only the free columns will be moved during the decomposition.

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]\).

qyrep() allows you to control the pivoting. For example, suppose that \(X\) is a dataset with a column of ones in the first column. If there are linear dependencies among the columns of \(X\), the column of ones for the constant may get pivoted away. This column can be forced to be included among the linearly independent columns using pvt.

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

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 Px(N-P). Thus \(Q\) is a PxP matrix and \(R\) is a PxN matrix containing \(R_1\) and \(R_2\).

Source

qyr.src

See also

Functions qr(), qqrep(), qrep(), qtyrep()