Checking matrix condition number
![](https://secure.gravatar.com/avatar/584c61df4f30e12406766bcc3bbd33ad.jpg?s=120&d=mm&r=g)
What is the best way to make sure that a matrix inversion makes any sense before preforming it? I am currently struggling to understand some results from matrix inversions in my work, and I would like to see if I am dealing with an ill-conditioned problem. It is probably user error, but I don't like having the possibility hanging over my head. I naively put a call to np.linalg.cond into my code; all of my cores went to 100% and a few minutes later I got a number. To be fair A is 6400 elements square, but this takes ~20x more time than the inversion. This is not really practical for what I am doing, is there a better way? This is partly in response to Ilhan Polat's post about introducing the A\b operator to numpy. I also couldn't check the Numpy mailing list archives to see if this has been asked before, the numpy-discussion gmane link isn't working for me at all. Thanks for your time, Ned
![](https://secure.gravatar.com/avatar/81e62cb212edf2a8402c842b120d9f31.jpg?s=120&d=mm&r=g)
I've indeed opened an issue for this : https://github.com/numpy/numpy/issues/8090 . Recently, I've included the LAPACK routines into SciPy dev version that will come with version 0.19. Then you can use ?GECON, ?POCON and other ?XXCON routines for yourself or wait a bit more until I have time to implement it on the SciPy side. @rkern told me that for NumPy, C translations are involved but I couldn't find an entrance point to contribute for yet. It's a bit above my abilities to fully grasp the way of working in NumPy. You can read more in https://github.com/numpy/numpy/issues/3755 Best, ilhan On Wed, Jan 25, 2017 at 9:14 PM, Edward Richards <edwardlrichards@gmail.com> wrote:
What is the best way to make sure that a matrix inversion makes any sense before preforming it? I am currently struggling to understand some results from matrix inversions in my work, and I would like to see if I am dealing with an ill-conditioned problem. It is probably user error, but I don't like having the possibility hanging over my head.
I naively put a call to np.linalg.cond into my code; all of my cores went to 100% and a few minutes later I got a number. To be fair A is 6400 elements square, but this takes ~20x more time than the inversion. This is not really practical for what I am doing, is there a better way?
This is partly in response to Ilhan Polat's post about introducing the A\b operator to numpy. I also couldn't check the Numpy mailing list archives to see if this has been asked before, the numpy-discussion gmane link isn't working for me at all.
Thanks for your time, Ned _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org https://mail.scipy.org/mailman/listinfo/numpy-discussion
participants (2)
-
Edward Richards
-
Ilhan Polat