Use np.intp type for indices