Re: [R] Extract an invertible submatrix

2016-10-02 Thread Richard M. Heiberger
Use qr tmp <- cbind(matrix(rnorm(30), 5, 6), 0)[, c(1,2,3,4,7,5,6)] tmp tmp.qr <- qr(tmp) tmp.qr tmp.qr$pivot tmp.subset <- tmp[, tmp.qr$pivot[1:tmp.qr$rank]] solve(tmp.subset) On Sun, Oct 2, 2016 at 2:19 PM, Bertrand Marc wrote: > Dear R helpers, > > I am looking for an efficient way to extrac

[R] Extract an invertible submatrix

2016-10-02 Thread Bertrand Marc
Dear R helpers, I am looking for an efficient way to extract (any) one of the biggest invertible submatrix. I have a rectangular matrix A (p x n), with rank k <= min(p, n). I would like to get a submatrix (k x k) invertible, or even better, the list of rows and columns of A which would form th