This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# count 4x4 mazes (spanning trees) using Kirchoff's theorem | |
import numpy as np | |
# Vertices: | |
# 0 1 2 3 | |
# 4 5 6 7 | |
# 8 9 10 11 | |
# 12 13 14 15 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def quantize(w, x, y, z, n) : | |
if z == None : | |
z = 1.0 - w - x - y | |
n = int(n) | |
v = [w, x, y, z] | |
vn = [a * n for a in v] | |
vni = [int(a) for a in vn] | |
vnf = [a - ai for a, ai in zip(vn, vni)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# n is an integer, the number of quantization steps of the 4-tuple [w, x, y, z] | |
def quantize(w, x, y, z, n) : | |
if z == None : | |
z = 1.0 - w - x - y | |
#assert w + x + y + z == 1 | |
n = int(n) | |
v = [w, x, y, z] | |
vn = [a * n for a in v] | |
vni = [int(a) for a in vn] |
NewerOlder