Re: [R] Matrix Problem

From: Douglas Bates <>
Date: Sat 10 Dec 2005 - 00:41:14 EST

On 12/9/05, Nicola Salvati <> 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. mailing list PLEASE do read the posting guide! Received on Sat Dec 10 01:01:29 2005

This archive was generated by hypermail 2.1.8 : Sat 10 Dec 2005 - 02:26:12 EST