How to compute large condition number of a matrix in Python?

I have a matrix that is extremely singular, but I am still interested in computing the exact condition number, which is the ratio between the largest and smallest singular values.

Is it possible to do it in Python? I am curious because if we stick with machine precision 10^-16, then any condition number beyond 10^16 could be inaccurate.

• Can you please give a sample input? It's difficult to discern the exact condition.
– kokeen
Dec 14, 2018 at 4:17
• The usual way to compute the condition number is via the SVD. The computed singular values will almost certainly be somewhat inaccurate. How much precision do you really need? If the true condition number was say 10^17+1 but it was computed asd 10^17 would that really matter to you?
– dmuir
Dec 15, 2018 at 14:54
• Is this an matrix of integers?
– James K Polk
Dec 18, 2018 at 20:10
• You seem to understand that you'll need to compute the singular values of your matrix in a higher precision than standard double precision. The "what library does extended precision singular value computations" question isn't really suitable for Computational Science stackexchange. However, you might look at the mpmath library to see if it does what you need. Jan 20, 2019 at 17:19