[Numpy-svn] r3019 - trunk/numpy/linalg

numpy-svn at scipy.org numpy-svn at scipy.org
Mon Aug 14 15:27:42 CDT 2006


Author: oliphant
Date: 2006-08-14 15:27:39 -0500 (Mon, 14 Aug 2006)
New Revision: 3019

Modified:
   trunk/numpy/linalg/linalg.py
Log:
Check for return value in linalg.det

Modified: trunk/numpy/linalg/linalg.py
===================================================================
--- trunk/numpy/linalg/linalg.py	2006-08-14 20:20:56 UTC (rev 3018)
+++ trunk/numpy/linalg/linalg.py	2006-08-14 20:27:39 UTC (rev 3019)
@@ -582,6 +582,11 @@
         lapack_routine = lapack_lite.dgetrf
     pivots = zeros((n,), fortran_int)
     results = lapack_routine(n, n, a, n, pivots, 0)
+    info = results['info']
+    if (info < 0):
+        raise TypeError, "Illegal input to Fortran routine"
+    elif (info > 0):
+        return 0.0
     sign = add.reduce(pivots != arange(1, n+1)) % 2
     return (1.-2.*sign)*multiply.reduce(diagonal(a),axis=-1)
 



More information about the Numpy-svn mailing list