Use np.vectorize rather than np.nditer, for Numpy 1.5 support