replace adj_update with numpy.pad in discretize