[SciPy-User] loadmat/savemat sparse with umfpack problem

Robin robince@gmail....
Sat Dec 12 10:18:24 CST 2009


I have a problem with sparse matrices that have been roundtripped
through savemat/loadmat and scikits.umf:
In [29]: scipy.__version__
Out[29]: '0.8.0.dev6136'

scikits.umfpack doesn't have a version but it is latest from scikits
svn (r2239).

Here is the simplest way I could recreate the problem:

from scikits.umfpack import UmfpackContext
import scipy.sparse as sparse
from scipy.io import loadmat, savemat

a = sparse.eye(3,3,format='csc')

umf = UmfpackContext()
print 'Original sparse matrix:'
print a.__repr__()
# works fine
print 'savemat/loadmat ...'
a2 = loadmat('test')['a']
print 'Loaded sparse matrix:'
print a2.__repr__()
# doesnt work

which outputs:

Original sparse matrix:
<3x3 sparse matrix of type '<type 'numpy.float64'>'
        with 3 stored elements in Compressed Sparse Column format>
savemat/loadmat ...
Loaded sparse matrix:
<3x3 sparse matrix of type '<type 'numpy.float64'>'
        with 3 stored elements in Compressed Sparse Column format>
TypeError                                 Traceback (most recent call last)

/Users/robince/svn/pyentropy/pyentropy/umf.py in <module>()
     15 print 'Loaded sparse matrix:'
     16 print a2.__repr__()
---> 17 umf.numeric(a2)

in numeric(self, mtx)
    394         if self._symbolic is None:
--> 395             self.symbolic( mtx )
    397         indx = self._getIndx( mtx )

in symbolic(self, mtx)
    364                     = self.funs.symbolic( mtx.shape[0], mtx.shape[1],
    365                                           mtx.indptr, indx, mtx.data,
--> 366                                           self.control, self.info )
    367         else:
    368             real, imag = mtx.data.real.copy(), mtx.data.imag.copy()

in umfpack_di_symbolic(*args)
    435         double Control, double Info) -> int
    436     """
--> 437   return __umfpack.umfpack_di_symbolic(*args)
    439 def umfpack_dl_symbolic(*args):

TypeError: not a C array
WARNING: Failure executing file: <umf.py>

I can't figure out whats causing it - and whether its a bug in
savemat/loadmat or scikits.umfpack.

Is scikits.umfpack still supported? Is there a way to prefactor matrix
with the libraries built into scipy (I need to solve the same large
sparse matrix many times so I was prefactoring with umfpack).



More information about the SciPy-User mailing list