# assign a[r] goes out-of-bounds.
a.append(1) # corresponds to x^r
- return sum( a[k]*(t**k) for k in range(len(a)) )
+ return sum( a[k]*(t**k) for k in xrange(len(a)) )
def inner_product(self, x, y):
"""
M = list(self._multiplication_table) # copy
- for i in range(len(M)):
+ for i in xrange(len(M)):
# M had better be "square"
M[i] = [self.monomial(i)] + M[i]
M = [["*"] + list(self.gens())] + M
"""
def __init__(self, n, field=QQ, **kwargs):
V = VectorSpace(field, n)
- mult_table = [ [ V.gen(i)*(i == j) for j in range(n) ]
- for i in range(n) ]
+ mult_table = [ [ V.gen(i)*(i == j) for j in xrange(n) ]
+ for i in xrange(n) ]
fdeja = super(RealCartesianProductEJA, self)
return fdeja.__init__(field, mult_table, rank=n, **kwargs)
V = VectorSpace(field, dimension**2)
W = V.span_of_basis( _mat2vec(s) for s in basis )
n = len(basis)
- mult_table = [[W.zero() for j in range(n)] for i in range(n)]
- for i in range(n):
- for j in range(n):
+ mult_table = [[W.zero() for j in xrange(n)] for i in xrange(n)]
+ for i in xrange(n):
+ for j in xrange(n):
mat_entry = (basis[i]*basis[j] + basis[j]*basis[i])/2
mult_table[i][j] = W.coordinate_vector(_mat2vec(mat_entry))
"""
def __init__(self, n, field=QQ, **kwargs):
V = VectorSpace(field, n)
- mult_table = [[V.zero() for j in range(n)] for i in range(n)]
- for i in range(n):
- for j in range(n):
+ mult_table = [[V.zero() for j in xrange(n)] for i in xrange(n)]
+ for i in xrange(n):
+ for j in xrange(n):
x = V.gen(i)
y = V.gen(j)
x0 = x[0]