`(Q, R, E)=qr(a)`

`(Q, R)=qr(a)`

Inputs | |

`a` |
Any matrix. |

Outputs | |

`Q` |
A unitary matrix (satisfying `Q'Q=I` , where `I` is the identity matrix. |

`R` |
An upper triangualr matrix. |

`E` |
A matrix in which each column or each row has a single nonzero entry, which is one. |

The outputs satisfy

`Q*R=a`

or, when three outputs are used, `Q*R=a*E'`

. In the
latter case column exchanges are used to compute the `Q-R`

decomposition, and the information on the exchanges is output in the matrix `E`

.
>>a=[1 2 3 4;5 6 7 8; 9 0 11 12];>>(q,r)=qr(a)>>q-0.0967 -0.3083 0.9463 -0.4834 -0.8166 -0.3154 -0.8701 0.4879 0.0701>>r-10.3441 -3.0936 -13.2443 -14.6944 0 -5.5163 -1.2740 -1.9111 0 0 1.4020 2.1030>>q'*q1.0000 0 0 0 1.0000 0 0 0 1.0000>>norm(q*r-a)6.2172e-015