[SciPy-dev] CS* constructor error

Robert Cimrman cimrman3 at ntc.zcu.cz
Thu Oct 20 06:43:39 CDT 2005


I have stumbled on a possible sparsetools problem - an array of shape 
[1,N] passed to the CSC matrix constructor leads to the error below, as 
well as [N,1] for the CSR format. ([N,1] for CSC, [1,N] for CSR and 
general [M,N], M > 1, N > 1, are ok...)

I have looked at sparsetools.pyf.src and could not see any reason for 
this... Could it be a f2py problem?

--
import scipy
import scipy.sparse as sparse

ar = scipy.array( [[1,2], [3,4]] )
a = sparse.csc_matrix( ar )
print 'a from array:', a

#ar = scipy.array( [[1],[2]] )
ar = scipy.array( [[1,2,3,4,5],] )
a = sparse.csc_matrix( ar )
print 'a from array:', a

-->

0-th dimension must be fixed to 2 but got 6 (real index=0)
Traceback (most recent call last):
   File "test.py", line 28, in ?
     a = sparse.csc_matrix( ar )
   File "/usr/lib/python2.4/site-packages/scipy/sparse/Sparse.py", line 
317, in __init__
sparsetools.error: failed in converting 4th argument `ptra' of 
sparsetools.dfulltocsc to C/Fortran array

r.




More information about the Scipy-dev mailing list