[SciPy-user] Sparse Boolean matrix

Lukas Michelbacher michells at ims.uni-stuttgart.de
Tue Jun 10 13:21:14 EDT 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