[SciPy-user] Sparse Boolean matrix

Lukas Michelbacher michells@ims.uni-stuttgart...
Tue Jun 10 12:21:14 CDT 2008


As the title says I'd like to use a matrix with Boolean values in some
sparse format.
My problem is that even though initialization seems to works fine, the
matrix doesn't
contain Boolean values but the default float type.

In [18]: A = sparse.csr_matrix((1000,1000), dtype=bool)

In [19]: A
Out[19]:
<1000x1000 sparse matrix of type '<type 'numpy.float64'>'
        with 0 stored elements (space for 100)
        in Compressed Sparse Row format>

The same happens for CSC, LIL and COO formats.

I use SciPy 0.6.0


More information about the SciPy-user mailing list