# twist.py # Checks for the twisting operation C -> C^sigma, for the group Gamma = Z_2^N, # with the basis vector e_i having as degree the i-th generator, and with the # bicharacter sigma(i,j) = -1 for i < j, and 1 otherwise. # (1) The diagonal unitaries Omega_k satisfy Omega_l^* T_pi Omega_k = T'_pi, for any # partition pi with even blocks, where T'_pi is the Schur-Weyl twist of T_pi, # defined with the signature of the kernels. # (2) The twisting is compatible with the tensor products and the compositions. import itertools import numpy as np from partitions import set_partitions, kernel, is_even, coarser, signature, T, number def omega(word): # sign of a multi-index: one factor -1 for each pair of positions r < s with i_r < i_s c = sum(1 for r in range(len(word)) for s in range(r + 1, len(word)) if word[r] < word[s]) return (-1) ** c def Omega(k, N): return np.diag([omega(w) for w in itertools.product(range(N), repeat=k)]) def T_twisted(pi, k, N): # the Schur-Weyl twist of T_pi, with the signs coming from the signature of the kernels l = len(pi) - k M = np.zeros((N ** l, N ** k)) cache = {} for idx in itertools.product(range(N), repeat=k + l): tau = kernel(idx) if coarser(tau, pi): if tau not in cache: cache[tau] = signature(tau, k) M[number(idx[k:], N), number(idx[:k], N)] = cache[tau] return M def main(): good = True N = 3 for n in (2, 4, 6): even = [p for p in set_partitions(n) if is_even(p)] for k in range(n + 1): l = n - k ok = all(np.array_equal(Omega(l, N) @ T(p, k, N) @ Omega(k, N), T_twisted(p, k, N)) for p in even) print('N = %d , k = %d , l = %d , partitions %3d , Omega T Omega = twisted T: %s' % (N, k, l, len(even), ok)) good = good and ok # tensor products and compositions, on the pairings of 4 points, split as 2 + 2 N = 2 pairs = [p for p in set_partitions(4) if is_even(p)] tw = lambda M, k, l: Omega(l, N) @ M @ Omega(k, N) ok1 = all(np.array_equal(tw(np.kron(T(p, 2, N), T(q, 2, N)), 4, 4), np.kron(tw(T(p, 2, N), 2, 2), tw(T(q, 2, N), 2, 2))) for p in pairs for q in pairs) ok2 = all(np.array_equal(tw(T(p, 2, N) @ T(q, 2, N), 2, 2), tw(T(p, 2, N), 2, 2) @ tw(T(q, 2, N), 2, 2)) for p in pairs for q in pairs) print('tensor products are compatible with the twisting:', ok1) print('compositions are compatible with the twisting:', ok2) good = good and ok1 and ok2 print('all checks passed' if good else 'some checks failed') if __name__ == "__main__": main()