See a quantum circuit become a tensor network — and contract it step by step.

Load an OpenQASM circuit and it is drawn as a Penrose tensor-network diagram: states, gates, COPY and XOR tensors connected by indices. Click tensors or edges to contract them, watch the intermediate tensors grow, and compare the cost of different contraction orders.

Every contraction is carried out numerically (complex128), and the final result is checked against a direct state-vector simulation.

GHZ state on 4 qubits, contracted greedily (live demo)

📄 QASM in, diagram out

OpenQASM 2.0 (plus common 3.0 syntax): qelib1 gates, custom gate definitions, register broadcasting and expressions such as pi/4. Paste the code, pick a file, or drop it onto the canvas.

🖱 Click to contract

Select two tensors, or click the edge between them. The merged tensor appears at the centroid of the region it replaces, sized and coloured by its rank. Undo works at any time.

🔍 Hover for detail

Every tensor and index has a tooltip with its shape, rank, memory, gate matrix, QASM line and connected legs, plus a preview of the cost of the next contraction.

⚡ Contraction strategies

Greedy (size or cost), Schrödinger time sweep, qubit-by-qubit sweep and random. Each run reports total MACs, peak memory and a per-step cost profile.

⚖ Three boundary conditions

Open output legs give |ψ⟩, a capped bitstring gives the amplitude ⟨b|ψ⟩, and the doubled network U P U† gives the expectation value ⟨ψ|P|ψ⟩ of any Pauli string.

🧪 Starter circuits

GHZ, a 10-term Pauli-sum Trotter step, a transverse-field Ising chain and the QFT. All are parametrised by the number of qubits.