Allow creation of sparse matrix with bool dtype
@@ -399,9 +399,9 @@ class _compressed_sparse_matrix(sparse_data._data_matrix,
else:
dtype = numpy.dtype(dtype)
- if dtype != 'f' and dtype != 'd' and dtype != 'F' and dtype != 'D':
+ if dtype.char not in '?fdFD':
raise ValueError(
- 'Only float32, float64, complex64 and complex128 '
+ 'Only bool, float32, float64, complex64 and complex128 '
'are supported')
data = data.astype(dtype, copy=copy)
