qrupdate

Updates a QR factorization after a rank-1 change of the matrix.

Category: Mathematics > Linear Algebra

Syntax

[Q1, R1] = qrupdate(Q, R, u, v)

Returns the factorization of A + u*v', where A = Q*R.

Description

A rank-1 change u*v' can be absorbed into an existing factorization with a sequence of Givens rotations, in order n^2 operations instead of n^3 for a fresh factorization.

The result is a valid QR factorization of the new matrix, but its signs may differ from qr(A + u*v').

Input arguments

Q, R
Factors of a QR factorization A = Q*R.
u, v
Column vectors; u has as many rows as A and v as many entries as A has columns.

Output arguments

Q1, R1
Factors of the modified matrix A + u*v'.

Example

Rank-1 update

A = magic(3);
[Q, R] = qr(A);
u = [1; 0; 0];
v = [0; 1; 0];
[Q1, R1] = qrupdate(Q, R, u, v);
norm(Q1*R1 - (A + u*v')) < 1e-10
Output
ans = logical
   1

See also

qr qrinsert qrdelete cholupdate