uniqc.calibration.xeb.circuits module¶
Random circuit generators for cross-entropy benchmarking (XEB).
Generates 1-qubit and 2-qubit XEB circuits in OriginIR format using the Circuit builder API.
- uniqc.calibration.xeb.circuits.generate_1q_xeb_circuits(qubit, depths, n_circuits=50, seed=None)[source]¶
Generate random 1-qubit XEB circuits.
Each circuit consists of
depthrandom single-qubit layers, followed by measurement. The circuits are designed to measure the per-layer depolarizing fidelity by fitting the exponential decay of the normalized linear XEB estimator as depth increases.- Parameters:
qubit – Qubit index to operate on.
depths – List of circuit depths to generate (one circuit per depth is generated
n_circuitstimes).n_circuits – Number of circuits to generate per depth.
seed – Random seed for reproducibility.
- Returns:
List of
Circuitobjects, one per (depth, circuit_index) pair. The total number of circuits islen(depths) * n_circuits.
- uniqc.calibration.xeb.circuits.generate_2q_xeb_circuit(qubit_u, qubit_v, depth, entangler_gate='CNOT', seed=None)[source]¶
Generate a single random 2-qubit XEB circuit.
- Each layer consists of:
Random single-qubit gate on each qubit
The specified entangling gate on the pair
- Parameters:
qubit_u – First qubit index.
qubit_v – Second qubit index.
depth – Number of random layers (>= 1).
entangler_gate – 2-qubit gate name (e.g. “CNOT”, “CZ”, “ISWAP”).
seed – Random seed for reproducibility.
- Returns:
A single
Circuitobject.
- uniqc.calibration.xeb.circuits.generate_2q_xeb_circuits(qubit_u, qubit_v, depths, n_circuits=50, entangler_gate='CNOT', seed=None)[source]¶
Generate random 2-qubit XEB circuits for a single qubit pair.
- Parameters:
qubit_u – First qubit index.
qubit_v – Second qubit index.
depths – List of circuit depths.
n_circuits – Number of circuits per depth.
entangler_gate – 2-qubit gate name.
seed – Random seed.
- Returns:
List of
Circuitobjects.
- uniqc.calibration.xeb.circuits.generate_parallel_2q_xeb_circuits(pairs, depth, entangler_gates, n_circuits=50, seed=None)[source]¶
Generate parallel 2-qubit XEB circuits.
All pairs are executed in parallel (within a single multi-qubit circuit) at each layer. This simulates full-chip parallel execution where disjoint pairs of qubits execute 2-qubit gates simultaneously.
- Parameters:
pairs – List of qubit pairs to include in parallel.
depth – Number of random layers per pair.
entangler_gates – Mapping from pair to entangler gate name. Falls back to “CNOT” for any pair not in the dict.
n_circuits – Number of parallel circuits to generate.
seed – Random seed.
- Returns:
one circuit per
n_circuits. Inner list: oneCircuitper pair (all measured in the same circuit object — a single multi-qubit circuit). Actually returns a list of Circuits where each Circuit operates on all qubits in the union of all pairs.- Return type:
List of lists of
Circuitobjects. Outer list