答案 0 :(得分:1)
所以我明白了。我需要取消ring.gens()
,以便我可以将它们用作变量
def build(alpha, beta, gamma):
ring = PolynomialRing(GF(q, 'a'), 'x', 6)
poly = alpha
x = ring.gens()
for j in range(0, self.v):
for k in range(0, self.n):
if j is k:
poly += gamma[j, k] * x[j]
else:
poly += gamma[j, k] * x[j] * x[k]
for k in range(0, self.n):
poly += beta[k] * x[k]
return poly