QiskitConfig
- class QiskitConfig(approximation_degree=1.0, native_two_qubit_params=None, optimization_level=3, native_optimization_level=1, routing_method='sabre', layout_method='trivial', native_approximation_degree=None, seed=None)
Configuration for the Qiskit-transpiler compilation strategy.
Selecting this configuration makes
quasar.gate_compiler.GateCompiler.compile()route the circuit on the gate-set topology with the Qiskit transpiler, translate it to the native two-qubit gate and lower the remaining single-qubit gates, instead of synthesizing the circuit’s unitary with thequasarcppbackend.- Variables:
approximation_degree – Approximation degree of the routing transpilation, in
[0.0, 1.0].native_two_qubit_params – Optional override for the native two-qubit gate’s parameters (e.g.
{"theta": ..., "phi": ...}for a CROT gate set). Every gate set defines its own default parameters (see e.g.two_qubit_gateonCROTGateSet); this only overrides them, and its keys are gate-set-specific.optimization_level – Qiskit optimization level of the routing stage:
0no optimization,1light,2heavy,3(the default here) even heavier – higher levels trade transpilation time for a more optimized circuit. See Qiskit’stranspile()for the full description.native_optimization_level – Qiskit optimization level of the native lowering stage; same
0-3scale asoptimization_level.routing_method – Qiskit routing method that makes the placed circuit topology-compliant, inserting
swapgates as needed. Names a routing-stage plugin; a stock Qiskit install offers"sabre"(the default),"basic","lookahead","none"and"default"."none"asserts the circuit is already mapped to the topology and raises otherwise, rather than skipping the stage. The name is checked against the installed plugins on construction. Whatever permutation the insertedswaps leave uncorrected at the end is not itself undone by a further correctionswap– it is only recorded, on the compiled circuit’s.layout.layout_method – Qiskit layout method choosing the initial virtual-to-physical qubit placement. Names a layout-stage plugin; a stock Qiskit install offers
"trivial"(the default here, identity placement),"dense","sabre"and"default"(letting the preset pass manager pick peroptimization_level). The name is checked against the installed plugins on construction. Runs before, and independently of,routing_method: this stage never insertsswapgates itself, it only picks the starting placement the routing stage then works from."trivial"relabels no qubit at either end, as it does on the synthesis path: routing may still permute them, and that permutation is realized in native gates rather than recorded, so the compiled circuit carries the identity layout and stands on its own. Every other method records the placement it chose on.layoutinstead, which costs no gates but leaves the caller to apply it.native_approximation_degree – Optional approximation degree of the native lowering stage, in
[0.0, 1.0]. Defaults to Qiskit’s own default.seed – Optional seed making transpilation and routing deterministic; Qiskit’s default routing (SABRE) is stochastic without it.
- Raises:
ConfigError – If an approximation degree is outside
[0.0, 1.0], an optimization level is not 0 to 3, a layout/routing method names no installed plugin, orseedis not a non-negative integer.