# Is there any rapid way to calculate the determinant of NXN covariance matrix?

I searched the web and found some C code for calculating the determinant of a $n\times n$ matrix. This code however seems timing complexity, and run pretty slow especially when handling a larger matrix, for instance, $1000\times1000$ matrix. I need calculate the determinant of a covariance matrix of a multivariate normal distribution, I want to know is there any rapid way, or code for this purpose, thanks for your help.

• What are you trying to do with the determinant? There is probably a different (better) way to achieve that without going through the determinant explicitly. – Tyler Olsen Mar 3 '16 at 21:07
• For calculating the information gain for a continous signal, however, based on Wolfgang's comments, I think it's better to finger out some alternative way to do this. – J.Doe Mar 3 '16 at 21:22
• @J.Doe do you need to calculate the determinant or just the log-determinant? the latter can be calculated from the Cholesky factor of your covariance matrix without running into problems with numerical overflow. – GoHokies Mar 3 '16 at 21:30

To see why this is so, consider a $1000\times 1000$ matrix whose eigenvalues happen to all be around 10. The first problem is that the determinant would be $10^{1000}$, too large to be represented by double precision, even though each individual eigenvalue is moderately sized. Secondly, if you multiply many numbers, each with their own finite accuracy, you'll amplify these inaccuracies to the point where you don't have much accuracy left in the end result.