# [R] invert 160000x160000 matrix

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Aug 14 09:23:05 CEST 2007

```On Tue, 14 Aug 2007, Patnaik, Tirthankar  wrote:

> A variety of tricks would need to be used to invert a matrix of this
> size. If there are any other properties of the matrix that you know
> (symmetric, positive definite, etc, sparse) then they could be useful
> too. You could partition the matrix first, then use an in-place inverse
> technique for each block to individually calculate the blocks-inverses,
> then combine to get the inverse of the initial matrix. Again, if the
> implementation is actually solving an Ax-B = 0 system of equations, then
> there are specific methods for these too, like an LU decomp, for
> instance. You might also want to check out some texts for this, like the
> Numerical Recipes.

> How's the matrix stored right now?

Well, not in R as a matrix: see ?"Memory-limits".  It is about 12x larger
than the largest possible matrix in R.

>
> Best,
> -Tir
>
> Tirthankar Patnaik
> India Strategy
> Citigroup Investment Research
> +91-22-6631 9887
>
>> -----Original Message-----
>> From: r-help-bounces at stat.math.ethz.ch
>> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Moshe Olshansky
>> Sent: Tuesday, August 14, 2007 6:40 AM
>> To: Paul Gilbert; Jiao Yang
>> Cc: r-help at stat.math.ethz.ch
>> Subject: Re: [R] invert 160000x160000 matrix
>>
>> While inverting the matrix may be a problem, if you need to
>> solve an equation A*x = b you do not need to invert A, there
>> exist iterative methods which do need A or inv(A) - all you
>> need to provide is a function that computes A*x for an
>> arbitrary vector x.
>> For such a large matrix this may be slow but possible.
>>
>> --- Paul Gilbert <pgilbert at bank-banque-canada.ca>
>> wrote:
>>
>>> I don't think you can define a matrix this large in R, even if you
>>> have the memory. Then, of course, inverting it there may be other
>>> programs that have limitations.
>>>
>>> Paul
>>>
>>> Jiao Yang wrote:

>>>> Can R invert a 160000x160000 matrix with all
>>> positive numbers?  Thanks a lot!

>

--
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

```