Atelier des rouesLab FR
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:

Read in context

Comments

Comments from both language editions appear here.

The discussion is open for reading. I’ll enable submissions once spam protection is configured.