Refactor local maxima

I was getting an error in local_maxima which I tracked down to the fact that numpy.take returns values of type ``intp``, whereas we were using ``long``.  Change type to ``intp``, rewrite ``local_maxima`` using numpy for memory allocation, and make a benchmark to check we are not going too slow.