SDM.py 文件源码

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

项目:KanervaCoding 作者: JadenTravnik 项目源码 文件源码
def isNear(self, address):

        difference = 0
        # a logically anded array ([true, false, ..]) multiplied by an integer is promoted to an int array.
        # Which then can be sent to packbits, that here returns an array of 1 element, so now z is an integer
        z = np.packbits(np.logical_and(self.address, address)*1)[0]
        while z:
            difference += 1
            z &= z-1 # magic!
        return 1 if difference < self.radius else 0
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号