[SciPy-user] NotImplementedError in sparse submatrix

Robin robince@gmail....
Mon Oct 15 19:08:09 CDT 2007


Hi,

I am using sparse matrices from scipy.sparse. I create the matrix as a lil,
then convert it to csc (or csr, the problem is the same).

The first time I try to access a slice in the form A[:16,:] I get the
following error (stack trace below). The funny thing is my code has a
facility to save a reload the matrix with savemat/loadmat and if the matrix
is loaded from a file instead of generated everything works fine without the
error.

<type 'exceptions.NotImplementedError'>: Wrong number of arguments for
overloaded function 'get_csr_submatrix'.

This happens with dev3434 on Windows/Cygwin/gcc 3.4.4 and on dev3437 on Mac
OS.

Here is the full trace, if anymore debug info from my code would be helpful
please let me know.

/Users/robince/phd/maxent/python/amari.py in solve_single(self, Pr, k)
    208         sf      = self._solvefunc
    209
--> 210         Asmall = self.A[:l,:]
    211         Bsmall = Asmall.T
    212         eta_sampled = Asmall.matvec(Pr)

/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/scipy/sparse/sparse.py
in __getitem__(self, key)
   1045             if isinstance(col, slice):
   1046                 # Returns a new matrix!
-> 1047                 return self.get_submatrix( row, col )
   1048             elif isinstance(row, slice):
   1049                 return self._getslice(row, col)

/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/scipy/sparse/sparse.py
in get_submatrix(self, slice0, slice1)
   1178         or scalars."""
   1179         aux = _cs_matrix._get_submatrix( self, self.shape[1],
self.shape[0],
-> 1180                                          slice1, slice0 )
   1181         nr, nc = aux[3:]
   1182         return self.__class__( aux[:3], dims = (nc, nr) )

/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/scipy/sparse/sparse.py
in _get_submatrix(self, shape0, shape1, slice0, slice1)
    806                                              self.indptr,
self.indices,
    807                                              self.data,
--> 808                                              i0, i1, j0, j1 )
    809         data, indices, indptr = aux[2], aux[1], aux[0]
    810         return data, indices, indptr, i1 - i0, j1 - j0

/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/scipy/sparse/sparsetools.py
in get_csr_submatrix(*args)
    603         std::vector<(npy_cdouble_wrapper)> Bx)
    604     """
--> 605   return _sparsetools.get_csr_submatrix(*args)
    606
    607

<type 'exceptions.NotImplementedError'>: Wrong number of arguments for
overloaded function 'get_csr_submatrix'.
  Possible C/C++ prototypes are:
    get_csr_submatrix<(int,int)>(int const,int const,int const [],int const
[],int const [],int const,int const,int const,int const,std::vector<int >
*,std::vector<int > *,std::vector<int > *)
    get_csr_submatrix<(int,long)>(int const,int const,int const [],int const
[],long const [],int const,int const,int const,int const,std::vector<int >
*,std::vector<int > *,std::vector<long > *)
    get_csr_submatrix<(int,float)>(int const,int const,int const [],int
const [],float const [],int const,int const,int const,int
const,std::vector<int > *,std::vector<int > *,std::vector<float > *)
    get_csr_submatrix<(int,double)>(int const,int const,int const [],int
const [],double const [],int const,int const,int const,int
const,std::vector<int > *,std::vector<int > *,std::vector<double > *)
    get_csr_submatrix<(int,npy_cfloat_wrapper)>(int const,int const,int
const [],int const [],npy_cfloat_wrapper const [],int const,int const,int
const,int const,std::vector<int > *,std::vector<int >
*,std::vector<npy_cfloat_wrapper > *)
    get_csr_submatrix<(int,npy_cdouble_wrapper)>(int const,int const,int
const [],int const [],npy_cdouble_wrapper const [],int const,int const,int
const,int const,std::vector<int > *,std::vector<int >
*,std::vector<npy_cdouble_wrapper > *)

>
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/scipy/sparse/sparsetools.py(605)get_csr_submatrix()
    604     """
--> 605   return _sparsetools.get_csr_submatrix(*args)
    606

ipdb>
WARNING: Failure executing file: <artex.py>

Thanks

Robin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20071016/9b56870d/attachment-0001.html 


More information about the SciPy-user mailing list