"""Ternary weight counts for the binary readout at (10, 10).""" import numpy as np def diagonal_weights(): """Return W[y,t], the multiplicity of weight (100-y-t,y,t) for 0 <= t <= 10.""" weights = np.zeros((11, 101, 11), dtype=np.int64) weights[0, 0, 0] = 1 for y in range(11): for t in range(11 - y): for d in range(1, 11): weights[d, y:, t:] += weights[d - 1, :101 - y, :11 - t] return weights[-1]