def __iadd__(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 add, mod
if isinstance(other, PyPtxt):
self = PyPtxt([mod(elt, self.__pyfhel.getModulus())
for elt in
list(map(add, 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(add, self.getPtxt(), constPtxt))],
self.getPyfhel())
del constPtxt
return self
# SUBSTRACT:
# '-' operator
评论列表
文章目录