[Numpy-discussion] inversion of large matrices

David david@silveregg.co...
Mon Aug 30 21:35:28 CDT 2010


On 08/31/2010 11:19 AM, Dan Elliott wrote:
> Thanks for the reply.
>
> David Warde-Farley<dwf<at>  cs.toronto.edu>  writes:
>> On 2010-08-30, at 11:28 AM, Daniel Elliott wrote:
>>> Large matrices (e.g. 10K x 10K)
>>
>>> Is there a function for performing the inverse or even the pdf of a
>>> multinomial normal in these situations as well?
>>
>> There's a function for the inverse, but you almost never want to use it,
> especially if your goal is the
>> multivariate normal density. A basic explanation of why is available here:
>> http://www.johndcook.com/blog/2010/01/19/dont-invert-that-matrix/
>>
>> In the case of the multivariate normal density the covariance is assumed to be
> positive definite, and thus a
>> Cholesky decomposition is appropriate. scipy.linalg.solve() (NOT
> numpy.linalg.solve()) with the
>> sym_pos=True argument will do this for you.
>
> You don't think this will choke on a large (e.g. 10K x 10K) covariance matrix?

It will work if you have enough memory. I have worked with slightly 
bigger matrices, but I have 12 Gb on my machine. You need some patience, 
though :)

cheers,

David


More information about the NumPy-Discussion mailing list