Circuit machinery#
Turns a Yao-style gate list into a program and applies it to an image one gate at a time; every basis with the same program shares one compiled applier. Every basis uses it.
Circuit machinery shared by every basis: gates, programs and the applier.
A family emits a Yao-style gate list; compile_program turns it into a
Program and the tensors in stored order (Hadamard-first, Yao little-endian
qubits); CircuitCode applies the program one gate at a time.
Contents
The structure of a circuit: which gate acts on which qubits, in what order. |
|
The program of a gate sequence on |
|
|
|
The applier of a gate sequence and its initial tensors. |
|
Apply a program to an image, or to a stack of images. |
|
Apply |
|
Run |
|
Refuse an image that is not |
|
|
|
The number of qubits of a register that holds |
|
One gate of a circuit program. |
|
Built-in immutable sequence. |
|
Built-in immutable sequence. |
|
A Hadamard on qubit |
|
The constructor |
|
A separable 2-D circuit: |
|
A Hadamard on every qubit, then one layer of phase gates on each register. |
|
Every 2-D circuit needs at least one qubit per register. |
|
|
|
2x2 compact representation of a 4x4 controlled-phase gate. |
|
Return the 2-qubit (2, 2, 2, 2)-shaped tensor matching the 4×4 controlled- phase gate diag(1, 1, 1, exp(iφ)). |
|
The dense two-qubit tensor that applies the one-qubit |
|
The tensor with which a gate of |
|
Extract |
|
The phase of each compact CP tensor at |
|
True if |
|
Return indices of the LAST |