A simple example is given below:
mat <- diag(1:6) qr.R(qr(as(mat,"Matrix"))) qr.R(qr(dd))
the diagnal values are of opposite signs. There is a warning message when doing sparse QR decomposition:
Warning message: In qr.R(qr(as(dd, "Matrix"))) : qr.R(<sparse>) may differ from qr.R(<dense>) because of permutations
However, if I check
qr.R(qr(as(mat,"Matrix")))@q, it is
0 1 2 3 4 5, it seems that there is no permutations being done.
Moreover, in Matlab, if I want to do a sparse matrix decomposition:
mat=sparse(1:6,1:6,1:6) p = colamd(mat) R = qr(mat(:,p))
p) should be equal to the R output
@q, am I right?