Implemented the reallocation procedure of a ndarray. And it actually seems to work.