# qrdelete

Remove column or row from QR factorization

## Syntax

`[Q1,R1] = qrdelete(Q,R,j)[Q1,R1] = qrdelete(Q,R,j,'col')[Q1,R1] = qrdelete(Q,R,j,'row')`

## Description

`[Q1,R1] = qrdelete(Q,R,j)` returns the QR factorization of the matrix `A1`, where `A1` is `A` with the column `A(:,j)` removed and ```[Q,R] = qr(A)``` is the QR factorization of `A`.

`[Q1,R1] = qrdelete(Q,R,j,'col')` is the same as `qrdelete(Q,R,j)`.

`[Q1,R1] = qrdelete(Q,R,j,'row')` returns the QR factorization of the matrix `A1`, where `A1` is `A` with the row `A(j,:)` removed and `[Q,R] = qr(A)` is the QR factorization of `A`.

## Examples

```A = magic(5); [Q,R] = qr(A); j = 3; [Q1,R1] = qrdelete(Q,R,j,'row'); Q1 = 0.5274 -0.5197 -0.6697 -0.0578 0.7135 0.6911 0.0158 0.1142 0.3102 -0.1982 0.4675 -0.8037 0.3413 -0.4616 0.5768 0.5811 R1 = 32.2335 26.0908 19.9482 21.4063 23.3297 0 -19.7045 -10.9891 0.4318 -1.4873 0 0 22.7444 5.8357 -3.1977 0 0 0 -14.5784 3.7796```

returns a valid QR factorization, although possibly different from

```A2 = A; A2(j,:) = []; [Q2,R2] = qr(A2) Q2 = -0.5274 0.5197 0.6697 -0.0578 -0.7135 -0.6911 -0.0158 0.1142 -0.3102 0.1982 -0.4675 -0.8037 -0.3413 0.4616 -0.5768 0.5811 R2 = -32.2335 -26.0908 -19.9482 -21.4063 -23.3297 0 19.7045 10.9891 -0.4318 1.4873 0 0 -22.7444 -5.8357 3.1977 0 0 0 -14.5784 3.7796```

expand all

### Algorithms

The `qrdelete` function uses a series of Givens rotations to zero out the appropriate elements of the factorization.