# [Numpy-discussion] inversion of large matrices

Charles R Harris charlesr.harris@gmail....
Mon Aug 30 21:36:12 CDT 2010

```On Mon, Aug 30, 2010 at 8:19 PM, Dan Elliott <danelliottster@gmail.com>wrote:

>
> 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?
>
>
Should work, give it a shot. It's an n^3 problem, so might take a bit.

> Given what you know about how it computes the log determinant and how the
> Cholesky decomposition, do you suppose I would be better off using eigen-
> decomposition to do this since I will also get the determinant from the sum
> of
> the logs of the eigenvalues?
>
>
I don't see what the connection with the determinant is. The log determinant
will be calculated using the ordinary LU decomposition as that works for
more general matrices.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100830/8aed5d8a/attachment.html
```