Closed
Description
Seems like this needs to be special-cased somewhere:
import sparse as sp
x = sp.COO.from_numpy(np.arange(10))
y = sp.COO.from_numpy(np.arange(10))
sp.dot(x, y)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-7-3dbcf0587ccb> in <module>()
2 x = sp.COO.from_numpy(np.arange(10))
3 y = sp.COO.from_numpy(np.arange(10))
----> 4 sp.dot(x, y)
/Users/jakevdp/github/mrocklin/sparse/sparse/core.py in dot(a, b)
429
430 def dot(a, b):
--> 431 return tensordot(a, b, axes=((a.ndim - 1,), (b.ndim - 2,)))
432
433
/Users/jakevdp/github/mrocklin/sparse/sparse/core.py in tensordot(a, b, axes)
425 res = _dot(at, bt)
426 res = COO.from_scipy_sparse(res) # <--- modified
--> 427 return res.reshape(olda + oldb)
428
429
/Users/jakevdp/github/mrocklin/sparse/sparse/core.py in reshape(self, shape)
239 strides *= d
240
--> 241 return COO(coords, self.data, shape, has_duplicates=self.has_duplicates)
242
243 def to_scipy_sparse(self):
/Users/jakevdp/github/mrocklin/sparse/sparse/core.py in __init__(self, coords, data, shape, has_duplicates)
69 self.data = np.asarray(data)
70 self.coords = np.asarray(coords)
---> 71 self.coords = self.coords.astype(np.min_scalar_type(max(self.shape)))
72 assert len(data) == self.coords.shape[1]
73 self.has_duplicates = has_duplicates
ValueError: max() arg is an empty sequence