Haiqu.clifford_t_synthesis(circuit, total_t_gate_budget=None, gate_t_gate_budget=None, total_precision_tolerance=None, gate_precision_tolerance=None, max_trasyn_budget=13, exact_spectral_norm=False)
Synthesizes a circuit into a Clifford+T approximation. The synthesis can be given either a target T-gate budget for the entire circuit, a T-gate budget per gate, a minimum precision tolerance for the entire circuit, or a per gate minimum precision tolerance. Precision tolerance for a gate U_i with approximation V_i is defined using the spectral norm distance minimized over global phase ψ, ε_i = min_ψ ||U_i - V_i e^||_2. Precision tolerance for the total circuit is taken as the sum of spectral norm distances for each gate, Σ_i ε_i. The two methods used are: : 1. GridSynth - Approximates a general Z-rotation by mapping the angle and a given precision tolerance onto a : two-dimensional grid where exact factorization is possible. See https://arxiv.org/pdf/1403.2975. The current implementation uses GridSynth if a target precision tolerance is given or if the per gate T-gate budget exceeds ‘max_trasyn_budget’. 2. TRASYN - Uses tensor networks to probabilistically find the best approximation to a general U3 gate available : given a specific T-gate budget. See https://arxiv.org/pdf/2503.15843. TRASYN often leads to a circuit with fewer T-gates than GridSynth. However, computing times are proportional to the per-gate budget. TRASYN is used when the gate T-gate budget is less than or equal to ‘max_trasyn_budget’. If both a target T-gate budget and a target precision tolerance are given, the T-gate budget is used and tolerance is ignored. If both a total and gate budget/tolerance are given, the total is used instead of the gate budget/tolerance. If no variables are given, the synthesis proceeds with total_precision_tolerance = 1e-8. NOTE: A minimum precision tolerance (1e-13) before numerical inaccuracies become considerable leads to a cap on the maximum number of T-gates possible in the output circuit. The synthesis runs in the Haiqu cloud as a hybrid job (seeflow()), and this method waits for it to finish.
The job’s program is an InputLayer followed by a
CliffordTSynthesisLayer with the options given here, which ends the program. The
synthesized circuit is logged to the current experiment and linked to the input circuit.
- Parameters:
- circuit (QuantumCircuit | CircuitModel) — The circuit to synthesize. All of its parameters must be bound.
- total_t_gate_budget (int , optional) — The target T-gate budget for the entire circuit.
- gate_t_gate_budget (int , optional) — The target T-gate budget for each non-Clifford rotation.
- total_precision_tolerance (float , optional) — The precision tolerance for the entire circuit. Must be greater or equal to 1e-13.
- gate_precision_tolerance (float , optional) — The precision tolerance to use for GridSynth for each Rz gate. Must be greater than or equal to 1e-13.
- max_trasyn_budget (int , optional) — The maximum T-gate budget we allow before switching from TRASYN to GridSynth.
Must be between 0 and 65 (inclusive). Defaults to 13.
Noneuses the synthesis default, which is also 13. - exact_spectral_norm (bool , optional) — Whether to also compute the exact spectral norm distance between the whole circuit and its approximation, from their full unitaries. Its cost grows exponentially with the width, so it is only available for circuits with 10 or fewer qubits. Defaults to False.
- Returns:
The synthesized Clifford+T circuit, logged to the current experiment.
info (dict): Information dictionary about the synthesis process, with keys:
- full_synthesis_time: Time required for the entire Clifford+T synthesis process.
- input_circuit_properties (dict): Properties of the input circuit, with keys:
- num_t_gates: Number of T-gates that don’t require synthesis.
- num_gates_to_synthesize: Number of non-Clifford gates to synthesize.
- total_num_non_clifford_gates: Total number of non-Clifford gates.
- output_circuit_properties (dict): Properties of the output circuit, with keys:
- t_gate_count: Total number of T-gates in the synthesized circuit.
- t_gate_depth: T-gate depth of the synthesized circuit.
- overall_spectral_norm: Spectral norm of the difference between the unitary matrices of the
original and synthesized circuits. Only calculated when
exact_spectral_normis set, with None returned otherwise. - overall_spectral_norm_upper_bound: Upper bound to the circuit’s spectral norm distance, found by summing the spectral norm distances for each synthesized gate. This is also 1/2 an upper bound to the diamond norm distance for noiseless channels.
- budget_allocation_for_synthesis: List of budget allocation to each synthesized gate.
- t_gate_count_for_synthesized_gates: List of the T-gate counts for each individual synthesized gate.
- spectral_norms_for_synthesized_gates: List of the spectral norm distances for each individual synthesized gate.
- Return type: circuit (CircuitModel)