### Works even for proper sublattices

parent 18f2ec3d
Pipeline #49901270 passed with stages
in 7 minutes and 55 seconds
 ... ... @@ -58,17 +58,31 @@ def matperms(pts): adjt = None basis = None ptsset = None origdet = None minofdet = None for t in combinations(range(n), d): t = tuple(t) absdet = abs(s[t]) if absdet == 0: continue if minofdet is None: minofdet = absdet else: minofdet = min(absdet, minofdet) for t in combinations(range(n), d): t = tuple(t) det = s[t] if abs(det) == 1: if abs(det) == minofdet: coords = [pts[i] for i in t] if adj is None: origdet = det basis = coords adj = adjugate(basis) adjt = [[a[i] * det for a in adj] for i in range(d)] adjt = [[a[i] for a in adj] for i in range(d)] # Transform by adjugate matrix: pts = [[sum([x*y for (x, y) in zip(a, m)]) for a in adjt] for m in pts] ptsset = {tuple(p): i for (i, p) in enumerate(pts)} ... ...
 ... ... @@ -28,6 +28,10 @@ class TestTreeduce(unittest.TestCase): self.assertEqual(set(map(tuple, mp)), set(map(tuple, mp2))) mp3 = automorph.matperms([[0, 0], [4, 3], [-3, 4], [-4, -3], [3, -4]]) self.assertEqual(set(map(tuple, mp)), set(map(tuple, mp3))) def test_reduce(self): ''' Tests that we can recognise an hexagonal rule embedded as a Moore CA. ... ...
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment