PyPtxt.py 文件源码

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

项目:Pyfhel 作者: ibarrond 项目源码 文件源码
def __imul__(self, other):
        if not isinstance(other, (PyPtxt, int)):
            raise TypeError("PyPtxt '*=' error: lhs must be of type PyPtxt or int instead of type " + str(type(other)))
        from operator import mul, mod
        if isinstance(other, PyPtxt):
            self = PyPtxt([mod(elt, self.__pyfhel.getModulus())
                           for elt in
                           list(map(mul, self.getPtxt(), other.getPtxt()))],
                          self.getPyfhel())
        else:
            constPtxt = [other for _ in range(self.__length)]
            self = PyPtxt([mod(elt, self.__pyfhel.getModulus())
                           for elt in
                           list(map(mul, self.getPtxt(), constPtxt))],
                          self.getPyfhel())
            del constPtxt
        return self



    # SCALAR PRODUCT:
    # '%' operator
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号