Gridrank: Implement for K-d trees, hierarchical