[SciPy-dev] Checking matrix dtype in umfpack.py
Pietro Berkes
berkes at gatsby.ucl.ac.uk
Fri Mar 20 14:26:15 EDT 2009
Dear all,
on a Mac OS X 10.5, with the latest scipy SVN version I get a few
errors from the sparse package when running scipy.test() . They all
look more or less like this:
======================================================================
ERROR: Prefactorize (with UMFPACK) matrix for solving with multiple rhs
----------------------------------------------------------------------
Traceback (most recent call last):
File "numpy/testing/decorators.py", line 82, in skipper
File "/Users/berkes/local/python_libs/lib/python2.5/site-packages/scipy/sparse/linalg/dsolve/umfpack/tests/test_umfpack.py",
line 90, in test_factorized_umfpack
solve = linsolve.factorized( a )
File "/Users/berkes/local/python_libs//lib/python2.5/site-packages/scipy/sparse/linalg/dsolve/linsolve.py",
line 160, in factorized
umf.numeric( A )
File "umfpack/umfpack.py", line 395, in numeric
File "umfpack/umfpack.py", line 356, in symbolic
File "umfpack/umfpack.py", line 341, in _getIndx
ValueError: matrix must have float64 values
This is due to a non-robust type checking in umfpack.py in the
function _getIndx. I suggest to replace this code
if self.isReal:
if mtx.data.dtype != nm.dtype('<f8'):
raise ValueError, 'matrix must have float64 values'
else:
if mtx.data.dtype != nm.dtype('<c16'):
raise ValueError, 'matrix must have complex128 values'
with the more robust
if self.isReal:
if mtx.data.dtype.type != nm.float64:
raise ValueError, 'matrix must have float64 values'
else:
if mtx.data.dtype.type != nm.complex128:
raise ValueError, 'matrix must have complex128 values'
At least, this solved the problem for me...
Cheers,
Pietro
More information about the SciPy-Dev
mailing list