Objects/Documentation
blocs.py
Reproducible check of XIII, included in the circuits dossier.
Download ↓"""Selected computational core from XIII, with a standalone exact control."""
from itertools import product
import json
def mcx(controls, target, anc):
controls = list(controls)
neg = [i for (i, v) in controls if not v]
c = [i for (i, v) in controls]
m = len(c)
gates = [(0, 1 << i) for i in neg]
def gate(xs, t):
return (sum((1 << i for i in xs)), 1 << t)
if m <= 2:
gates.append(gate(c, target))
else: