Retrieving X from QR decomposition of X

71 views Asked by At

Just puzzled by that : I'm computing the QR decomposition of the following matrix X and I expected to get back to X by calculating the product QR. Well, the product gives "almost" X, but with columns 1 and 2 inverted... How can it be ?

> X
     [,1]  [,2] [,3]
[1,] 1-0i -1+1i 1-1i
[2,] 1-1i -1+2i 1-1i
[3,] 1-1i -1+1i 1+0i
> 
> QRX <- qr(X)
> X <- qr.X(QRX)
> Q <- qr.Q(QRX)
> R <- qr.R(QRX)
> 
> Q%*%R
      [,1] [,2] [,3]
[1,] -1+1i 1-0i 1-1i
[2,] -1+2i 1-1i 1-1i
[3,] -1+1i 1-1i 1+0i
0

There are 0 answers