scipy/scipy — pull request #3792 by richardtsai (2014-07-13 10:28:19+00:00)
Title: WIP: cluster: rewrite hierarchy in Cython

`_hierarchy.so` was rewritten in Cython. The API is compatible with the original C implementation.
All tests pass but there may be still some bugs now. And documentations and comments have yet to be completed.

The original C implementation accesses the arrays directly with pointers and it is really fast. I use Typed Memoryview to make it more maintainable but it is a bit slower than the original version (about 20%). However, most of the functions in this module is O(n) and `n` would not be so large in hierarchical clustering, so I think it is not a big problem. But some functions are O(n^2) or O(n^3) and they need optimization.

`cluster_maxclust_monocrit_wrap` and `linkage_wrap` are optimized and they run several times faster than the original version.