_kdtree.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:hienoi 作者: christophercrouzet 项目源码 文件源码
def __init__(self, data, bucket_size=128):
        if bucket_size < 1:
            raise ValueError("A minimum bucket size of 1 is expected.")

        self._data = data
        self._n, self._k = self._data.shape
        self._nodes = None
        self._buckets = []
        self._bucket_size = bucket_size

        self._node_dtype = numpy.dtype([
            ('size', numpy.intp),
            ('bucket', numpy.intp),
            ('lower_bounds', (numpy.float_, self._k)),
            ('upper_bounds', (numpy.float_, self._k)),
        ])
        self._neighbour_dtype = numpy.dtype([
            ('squared_distance', numpy.float_),
            ('index', numpy.intp),
        ])

        self._build()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号