qlass.compiler package
The compiler module provides functionality to convert Qiskit quantum circuits to Perceval photonic processors and analyze their resource requirements. It bridges the gap between the gate-based model and the specific constraints of Linear Optical Quantum Computing (LOQC) [KMN+07].
Key Features
Circuit Compilation
compile: Convert Qiskit circuits to Perceval processors. This relies on the backend conversions provided by the Perceval platform [HFdG+23].
Resource-Aware Analysis
In photonic hardware, ideal gates are often probabilistic or resource-intensive. The Resource Aware Compiler models physical imperfections unique to photonics, such as Hong-Ou-Mandel (HOM) interference visibility and fusion gate probabilities [KMN+07].
ResourceAwareCompiler: Compile circuits with hardware resource analysisHardwareConfig: Define photonic hardware specifications including:Photon loss per component (dB)
Fusion gate success probability (critical for probabilistic entangling gates)
Hong-Ou-Mandel (HOM) visibility (measure of photon indistinguishability)
generate_report: Display compilation analysis reports with:Component counts (beam splitters, phase shifters, fusion gates)
Estimated photon loss
Overall success probability
Submodules
- class qlass.compiler.HardwareConfig(brightness: float = 1.0, indistinguishability: float = 1.0, g2: float = 0.0, g2_distinguishable: bool = False, transmittance: float = 0.9, phase_imprecision: float = 0.0, phase_error: float = 0.0, photon_loss_component_db: float = 0.05, photon_loss_waveguide_db_per_cm: float = 0.3, source_efficiency: float = 0.9, detector_efficiency: float = 0.95, fusion_success_prob: float = 0.11, hom_visibility: float = 0.97, avg_path_length_per_component_cm: float = 0.1)[source]
Bases:
objectA data structure to hold the physical properties of a photonic hardware backend.
- avg_path_length_per_component_cm: float = 0.1
- brightness: float = 1.0
- detector_efficiency: float = 0.95
- fusion_success_prob: float = 0.11
- g2: float = 0.0
- g2_distinguishable: bool = False
- hom_visibility: float = 0.97
- indistinguishability: float = 1.0
- phase_error: float = 0.0
- phase_imprecision: float = 0.0
- photon_loss_component_db: float = 0.05
- photon_loss_waveguide_db_per_cm: float = 0.3
- source_efficiency: float = 0.9
- transmittance: float = 0.9
- class qlass.compiler.ResourceAwareCompiler(config: HardwareConfig)[source]
Bases:
objectA compiler that analyzes a quantum circuit against a hardware configuration to estimate its real-world performance and resource requirements.
- qlass.compiler.compile(circuit: QuantumCircuit, backend_name: str = 'Naive', use_postselection: bool = True, input_state: StateVector | FockState | None = None, noise_model: NoiseModel = None) Processor[source]
Convert a Qiskit quantum circuit to a Perceval processor.
- Parameters:
circuit (QuantumCircuit) – The Qiskit quantum circuit to convert
backend_name (str) – The backend to use for the Perceval processor Options are: “Naive”, “SLOS”
use_postselection (bool) – Whether to use postselection for the processor
input_state (Optional[Union[pcvl.StateVector, pcvl.BasicState]]) – The input state for the processor. If None, the |0…0> state is used.
noise_model (NoiseModel) – A perceval NoiseModel object representing the noise model for the processor.
- Returns:
The quantum circuit as a Perceval processor
- Return type:
pcvl.Processor
- qlass.compiler.generate_report(analysis_report: dict[str, Any]) None[source]
Prints the analysis report in a human-readable format.
Nicolas Heurtel, Andreas Fyrillas, Grégoire de Gliniasty, Raphaël Le Bihan, Sébastien Malherbe, Marceau Prawer, Edouard Solal, Benoît Valiron, Peter Yeh, and Shane Mansfield. Perceval: a software platform for discrete variable photonic quantum computing. Quantum, 7:931, 2023.