qrdelete
Updates a QR factorization after a column or row is removed from the matrix.
Category: Mathematics > Linear Algebra
Syntax
[Q1, R1] = qrdelete(Q, R, j)
Returns the factorization of A with column j deleted, where A = Q*R.
[Q1, R1] = qrdelete(Q, R, j, 'row')
Returns the factorization of A with row j deleted.
Description
Recomputing a factorization from scratch costs on the order of n^3 operations. Deleting one column only disturbs the triangular shape of R near that column, so Givens rotations restore it at a much lower cost.
This matters in algorithms that add and remove variables repeatedly, such as active-set methods and stepwise regression.
Input arguments
Q, R- Factors of a QR factorization
A = Q*R. j- Index of the column (default) or row to delete.
Output arguments
Q1, R1- Factors of the reduced matrix.
Example
Delete the second column
A = magic(3);
[Q, R] = qr(A);
[Q1, R1] = qrdelete(Q, R, 2);
norm(Q1*R1 - A(:, [1 3])) < 1e-10
Output
ans = logical
1