update

Change the time consuming part to c++. Use cython to wrap it into
python module.
1

1