Skip to main content

Haiqu.transpile(circuits, device, job_name=None, job_description=None, *, seed_transpiler=None, **transpilation_options)

Transpile a quantum circuit for a specific device.

NOTE

Transpilation runs in the Haiqu cloud. Circuits containing HaiquCircuitGate instances (for example, from data-loading job results or to_gate()) should be transpiled with this method because the gate definitions live server-side. The returned CircuitModel carries cloud-computed metrics on .analytics (for example .analytics.depth, .analytics.depth_2q, .analytics.gates_2q) or via .core_metrics().
  • Parameters:
    • circuits (QuantumCircuit | list *[*QuantumCircuit ] | CircuitModel | list *[*CircuitModel ]) — The circuit(s) to transpile.
    • device (DeviceModel) — The target device for execution. If obtained with use_fractional_gates=True via get_device(), fractional gates are used.
    • job_name (str | None) — The name for the job. If None (default), a name will be automatically generated.
    • job_description (str | None) — The description for the job.
    • seed_transpiler (int | list *[*int ] | None) — Accepts either a single integer (standard Qiskit behaviour) or a list of integers. When a list is provided, transpilation is run once per seed in parallel and the result with the lowest multi-qubit gate count is selected for each circuit.
    • **transpilation_options — Additional arguments passed to the Qiskit transpiler. Most parameters follow the Qiskit transpile() interface, but the default optimization_level is 3.
  • Returns: The transpiled quantum circuit, logged to the current experiment. : The returned CircuitModel will be linked to the original circuit.
  • Return type: CircuitModel | list[CircuitModel]

Examples

Haiqu SDK uses the Qiskit Transpiler for transpilation of your circuits. Transpiling a circuit is as easy as follows:
Every circuit stores the information about its transpiled versions, that can be viewed using:
It may sometimes be useful to compare the circuits resulting from transpilation with different parameters.
Pass a list of seeds to run multiple transpilations and automatically keep the best result (fewest two-qubit gates) for each circuit:
Enable IBM fractional gates when targeting a real IBM QPU: