scipy/scipy — pull request #2607 by cowlicks (2013-06-28 15:32:03+00:00)
Title: Fix the sparse bool wrapper.

The bool dtype for sparse matrices is implemented as a typedef for int8, so True rolls over to False when the underlying int reaches 256. Like this:

```
In [2]: a = sp.csr_matrix([True, False])

In [3]: for _ in range(8):
...: a = a + a
...: print(a.todense())
...:
[[ True False]]
[[ True False]]
[[ True False]]
[[ True False]]
[[ True False]]
[[ True False]]
[[ True False]]
[[False False]] # <----- !
```

This PR creates a class for the bool dtype with the boolean arithmetic properly implemented so this does not happen.

However, this currently needs 2 things:
* An `assert(sizeof(char) == sizeof(npy_bool_wrapper))`
* Compiler parameters that guarantee this.

But as of now this corrects the problem with boolean arithmetic.