diff options
author | Travis Oliphant <oliphant@enthought.com> | 2006-08-14 20:27:39 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2006-08-14 20:27:39 +0000 |
commit | c3fc219b92e76a169b84824a7f56287208e0deb1 (patch) | |
tree | e578472674881c6540795c6d398946f59a90b9e3 /numpy | |
parent | 583673340f922a616812a88db27e44358f338b70 (diff) | |
download | numpy-c3fc219b92e76a169b84824a7f56287208e0deb1.tar.gz |
Check for return value in linalg.det
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/linalg/linalg.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/numpy/linalg/linalg.py b/numpy/linalg/linalg.py index 4937b6244..8dec67318 100644 --- a/numpy/linalg/linalg.py +++ b/numpy/linalg/linalg.py @@ -582,6 +582,11 @@ def det(a): 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) |