scipy/scipy — pull request #3941 by fredludlow (2014-08-31 14:49:44+00:00)
Title: Sparse bitwise operations

This partially fixes #3590, implementing bitwise &,| and ^ for sparse arrays. It provides __and__, __rand__, etc methods similar to the __add__, __radd__, etc methods which convert to csr and dispatch to the appropriate C++ std::bit_and, std::bit_or std::bit_xor method, with some checking that the datatype is appropriate for bitwise operations. The additional tests check functionality on valid types, but I might not have handled appropriate return types for impossible operations (e.g. float64 & complex).

I've not implemented negation for various reasons, many discussed in #1166

First PR so let me know if I'm doing it wrong!