Skip to content

transpilation Module ​

The pyqpanda3.transpilation module provides circuit transpilation, topology generation, and gate decomposition utilities. It maps logical quantum circuits onto physical hardware topologies, optimizes gate sequences, and decomposes high-level operations into native gate sets.

Overview ​

Transpilation is the process of transforming an abstract quantum program so that it can be executed on a specific quantum device. This module provides three core capabilities:

  • Topology generation -- Create connectivity graphs that describe the physical coupling map of a quantum chip.
  • Transpilation -- Map virtual qubits to physical qubits, insert SWAP gates for routing, translate gates into the device's native gate set, and apply circuit optimizations.
  • Decomposition -- Break down composite quantum operations (QProg, QCircuit, or unitary matrices) into a target set of basic gates.

A typical workflow first generates or obtains a chip topology, then constructs a Transpiler and calls transpile() to produce a hardware-compatible program. The decompose() function can be used independently to rewrite a circuit in terms of a specific gate basis.

This module also exports ChipBackend, a data class that encapsulates chip topology, supported gates, timing information, and other hardware properties for use with the transpile() backend overload.

Transpiler also exposes two hardware-workflow helpers: virtual_z() folds a program decomposed to X1/RZ/CZ/RPhi into RPhi/CZ form (the virtual-Z phase bridge); fidelity_layout() computes an initial layout from the backend topology and fidelity maps. ChipBackend can carry single_gate_fidelity, readout_fidelity, double_gate_fidelity, and gate_fidelity calibration data that drives fidelity-aware layout and approximate decomposition. See Transpiler.

When you need to explicitly choose layout / routing / optimization strategies, enable LightSABRE routing, or recover compile metrics, use the 0.4.1 strongly-typed entry points TranspilationOptions / TranspilationResult / transpilation_metrics(). See Transpilation Options & Metrics.

Sub-topics ​

TopicDescription
TranspilerTranspiler class with transpile() overloads, plus virtual_z(), fidelity_layout(), and the ChipBackend fidelity fields
Transpilation Options & MetricsTranspilationOptions, TranspilationResult, TranspilationExecutionConfig, the method enums, and transpilation_metrics()
Topologygenerate_topology() function for creating chip connectivity graphs
Decomposedecompose() overloads for QProg, QCircuit, and matrix decomposition

Released under the MIT License.