Discussion:
[Numpy-discussion] Checking matrix condition number
Edward Richards
2017-01-25 20:14:50 UTC
Permalink
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
Ilhan Polat
2017-01-26 09:29:45 UTC
Permalink
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
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
https://mail.scipy.org/mailman/listinfo/numpy-discussion
Loading...