qrep#

Purpose#

Computes the orthogonal-triangular (QR) decomposition of a matrix \(X\), such that: \(X[.,E] = Q_1R\)

Format#

{ r, e } = qrep(X, pvt)#
Parameters:
  • 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:
  • r (KxP upper triangular matrix) – \(K = min(N,P)\).

  • e (Px1 permutation vector)

Remarks#

qrep() is the same as qqrep() but doesn’t return the \(Q\ 1\) matrix. If \(Q\ 1\) is not wanted, qrep() will save a significant amount of time and memory usage, especially for large problems.

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′X[ ., E ] = \begin{bmatrix} R \\ 0 \end{bmatrix}\end{split}\]

where \(R\) is upper triangular. If we partition

\[Q⁢ = \begin{bmatrix} Q_1 & Q_2 \end{bmatrix}\]

where \(Q_1\) has \(P\) columns, then

\[X[., E] = Q_1R\]

is the QR decomposition of \(X[.,E]\).

qrep() does not return the \(Q_1\) matrix because in most cases it is not required and can be very large. If you need the \(Q_1\) matrix, see the function qqrep(). If you need the entire \(Q\) matrix, call qyrep() with \(Y\) set to a conformable identity matrix. For most problems \(Q'Y\), \(Q_1'Y\), or \(QY\), \(Q_1Y\), for some \(Y\), are required. For these cases see qtyrep() and qyrep().

qrep() 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.

Source#

qr.src

See also

Functions qr(), qre(), qqrep()