[Scipy-tickets] [SciPy] #365: Outer product for sparse vectors

SciPy scipy-tickets at scipy.net
Wed Jan 31 03:40:50 CST 2007


#365: Outer product for sparse vectors
--------------------------+-------------------------------------------------
 Reporter:  nils          |       Owner:  somebody     
     Type:  task          |      Status:  new          
 Priority:  normal        |   Milestone:  0.5.3 Release
Component:  scipy.sparse  |     Version:  devel        
 Severity:  normal        |    Keywords:               
--------------------------+-------------------------------------------------
 Is there a way to support the outer product of sparse vectors ?

 {{{
 >>> f
 array(<71987x1 sparse matrix of type '<type 'numpy.float64'>'
         with 52 stored elements (space for 52)
         in Compressed Sparse Column format>, dtype=object)
 >>> outer(f,f)
 Traceback (most recent call last):
   File "<stdin>", line 1, in ?
   File "/usr/lib64/python2.4/site-packages/numpy/core/numeric.py", line
 238, in outer
     return a.ravel()[:,newaxis]*b.ravel()[newaxis,:]
   File "/usr/lib64/python2.4/site-packages/scipy/sparse/sparse.py", line
 522, in __mul__
     return self.dot(other)
   File "/usr/lib64/python2.4/site-packages/scipy/sparse/sparse.py", line
 323, in dot
     result = self.matmat(other)
   File "/usr/lib64/python2.4/site-packages/scipy/sparse/sparse.py", line
 957, in matmat
     return _cs_matrix._matmat(self, other, cscmucsc)
   File "/usr/lib64/python2.4/site-packages/scipy/sparse/sparse.py", line
 574, in _matmat
     raise ValueError, "shape mismatch error"
 ValueError: shape mismatch error
 }}}

-- 
Ticket URL: <http://projects.scipy.org/scipy/scipy/ticket/365>
SciPy <http://www.scipy.org/>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list