Hi, Somebody gave me this little problem about QR decomposition and Choleski Decomposition. The column names of the matrix (if the user choose to name them explicitly with dimname or it was composed from named vectors) remains the same after the operation, although the content has been swapped during pivoting in the LAPACK/LINPACK C/fortran routines. Is this wrong, or at least, dubious? Here are two patches against the two files in "R-2.2.0/src/library/base/R" - I have tested them both myself, to obtain what I believe to be "sensible" behavior. Feedbacks? Hin-Tak Leung ================================================--- chol.R.orig 2005-04-18 11:19:15.000000000 +0100 +++ chol.R 2005-10-27 13:44:12.245692000 +0100 @@ -33,6 +33,7 @@ DUP = FALSE, PACKAGE = "base") if (!pivot && z$rank < n) stop("matrix not positive definite") + colnames(z$x) <- colnames(z$x)[z$piv] robj <- z$x if (pivot) { attr(robj, "pivot") <- z$piv --- qr.R.orig 2005-04-18 11:19:14.000000000 +0100 +++ qr.R 2005-10-27 12:41:12.204974000 +0100 @@ -217,6 +217,7 @@ if (!complete) R <- R[seq(min(dim(R))), , drop = FALSE] R[row(R) > col(R)] <- 0 + colnames(R)= colnames(R)[qr$pivot] R } ================================================-------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: chol.R.patch Url: https://stat.ethz.ch/pipermail/r-devel/attachments/20051027/8375976a/chol.R.pl -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: qr.R.patch Url: https://stat.ethz.ch/pipermail/r-devel/attachments/20051027/8375976a/qr.R.pl