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
评论列表
文章目录