You are very right, indeed about the `out=`, although this does work:

```
out[mask] = min_or_max.reduceat(mat.data, indptr[mask])
...
out[mask] = min_or_max(out[mask], zero)
```

Anyway, it's your PR, so do as you wish: the speed-up is going to be great either way.