diff --git a/src/sage/combinat/matrices/hadamard_matrix.py b/src/sage/combinat/matrices/hadamard_matrix.py index bec5e98bcda..c11c1cb479e 100644 --- a/src/sage/combinat/matrices/hadamard_matrix.py +++ b/src/sage/combinat/matrices/hadamard_matrix.py @@ -987,7 +987,7 @@ def GS_skew_hadamard_smallcases(n, existence=False, check=True): williamson_goethals_seidel_skew_hadamard_matrix as WGS def pmtoZ(s): - return [1 if x == '+' else -1 for x in s] + return [1 if x == '+' else -1 for x in s] if existence: return n in [36, 52, 92] @@ -1209,6 +1209,7 @@ def symmetric_conference_matrix(n, check=True): assert (C==C.T and C**2==(n-1)*I(n)) return C + def szekeres_difference_set_pair(m, check=True): r""" Construct Szekeres `(2m+1,m,1)`-cyclic difference family @@ -1248,16 +1249,18 @@ def szekeres_difference_set_pair(m, check=True): t = F.multiplicative_generator()**2 G = F.cyclotomic_cosets(t, cosets=[F.one()])[0] sG = set(G) - A = filter(lambda a: a-F.one() in sG, G) - B = filter(lambda b: b+F.one() in sG, G) + A = [a for a in G if a - F.one() in sG] + B = [b for b in G if b + F.one() in sG] if check: from itertools import product, chain - assert(len(list(A)) == len(list(B)) == m) - if m>1: - assert(sG==set([xy[0]/xy[1] for xy in chain(product(A,A), product(B,B))])) - assert(all(F.one()/b+F.one() in sG for b in B)) - assert(not any(F.one()/a-F.one() in sG for a in A)) - return G,A,B + assert(len(A) == len(B) == m) + if m > 1: + assert(sG == set([xy[0] / xy[1] + for xy in chain(product(A, A), product(B, B))])) + assert(all(F.one() / b + F.one() in sG for b in B)) + assert(not any(F.one() / a - F.one() in sG for a in A)) + return G, A, B + def typeI_matrix_difference_set(G,A): r"""