menpo/menpo — pull request #345 by jabooth (2014-05-16 23:13:49+00:00)
Title: Optimise true_indices on all true boolean mask

It's twice as fast to check for if every element of a boolean mask is true and then use `np.indicies` than it is to use `np.nonzero`.

```python

%%timeit
if self.all_true:
np.indices(self.shape).reshape([self.n_dims, -1]).T
# 10000 loops, best of 3: 57.3 µs per loop
```
```python
%%timeit
np.vstack(np.nonzero(self.pixels[..., 0])).T
# 10000 loops, best of 3: 140 µs per loop
```

note that the check for `all_true` is relatively fast:

```python
%timeit self.all_true
# 100000 loops, best of 3: 5.22 µs per loop
```