kdtree: refactoring to allow for different point storage schemes, namely tensor vs. sparse vector