Sync with numpy's feature: partition

First version of partition method, waiting to verify its correctness.
`ex` in line 485 should be aligned with `new_ul` in line 484.