Hello R-Users, I have to invert a matrix 3000X3000 and the solve method doesn't work or it is too slow. Are there any methods to invert a big matrix? Regards Stefan --------------------------------- [[alternative HTML version deleted]]
Beyond asking why, and not letting R do work for you, let me just note that inverting the full matrix is often computationally wasteful. You can take the Cholesky decomposition M = L'L where M is your matrix and then only work with L. Other than that, there are two packages for dealing with sparse matrices, one is SparseM and the other is in the Matrix package (assuming you have a sparse matrix). -----Original Message----- From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Nicola Salvati Sent: Friday, December 09, 2005 8:26 AM To: r-help at stat.math.ethz.ch Subject: [R] Matrix Problem Hello R-Users, I have to invert a matrix 3000X3000 and the solve method doesn't work or it is too slow. Are there any methods to invert a big matrix? Regards Stefan --------------------------------- [[alternative HTML version deleted]] ______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
On 12/9/05, Nicola Salvati <hac6 at yahoo.it> wrote:> Hello R-Users, > I have to invert a matrix 3000X3000 and the solve method doesn't work or it is too slow. > Are there any methods to invert a big matrix?Well, first you figure out what you really need to do. Although we often write formulas involving a matrix inverse it is rarely necessary to invert a matrix. If you are simply going to solve a linear system of equations you decompose the matrix appropriately then solve the system or systems. Inverting a 3000x3000 matrix is equivalent to solving 3000 systems of equations involving the matrix. The overhead of creating the decomposition will be present in both cases but the process of determining the solution for 1 system is much faster than determining the solution of 3000 systems. When you have a 3x3 matrix or even a 30x30 matrix the distinction between solving a system and inverting a matrix is not that important. When you have a 3000x3000 matrix it is important. Also, is the matrix symmetric? Positive definite? Sparse? Any of these characteristics can affect the choice of how to perform the calculation efficiently.