[Numpy-discussion] Determining the condition number of matrix

Piotr Luszczek luszczek at cs.utk.edu
Tue Sep 27 11:54:59 EDT 2005


Neilen Marais wrote:
> Hi
> 
> Does numeric have a facility to estimate the condition number of a matrix?
> 
> Thanks
> Neilen

The only way I can think of is through SVD:

import RandomArray as RA
import LinearAlgebra as LA

n = 100
a = RA.random((n, n))
vt, s, u = LA.singular_value_decomposition(a)

cond2 = s[0] / s[-1]
print cond2

The above code computes 2-norm condition number.

Since Numeric has only limited binding to LAPACK you should
probably look into SciPy that might have bindings to LAPACK's
condition number estimators.

Piotr




More information about the NumPy-Discussion mailing list