-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ BackendV2 migration of MQT DDSIM Qiskit backends (#267)
Migrating all MQT simulators from BackendV1 to BackendV2. Besides different access patterns I also eliminated some intermediate steps that involved dealing with QasmQobj and QasmQobjExperiment classes, since those are deprecated. Now we will be dealing with QuantumCircuit objects only. --------- Signed-off-by: burgholzer <[email protected]> Co-authored-by: burgholzer <[email protected]> Co-authored-by: Stefan Hillmich <[email protected]>
- Loading branch information
1 parent
cd2b8e1
commit 0e27408
Showing
24 changed files
with
951 additions
and
1,152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
"""Utilities for constructing a Qiskit experiment header for DDSIM backends.""" | ||
from __future__ import annotations | ||
|
||
from dataclasses import dataclass | ||
from typing import TYPE_CHECKING | ||
|
||
from qiskit.result.models import QobjExperimentHeader | ||
|
||
if TYPE_CHECKING: | ||
from qiskit import QuantumCircuit | ||
|
||
|
||
@dataclass | ||
class DDSIMHeader(QobjExperimentHeader): | ||
name: str | ||
n_qubits: int | ||
memory_slots: int | ||
global_phase: float | ||
creg_sizes: list[tuple[str, int]] | ||
clbit_labels: list[tuple[str, int]] | ||
qreg_sizes: list[tuple[str, int]] | ||
qubit_labels: list[tuple[str, int]] | ||
|
||
def __init__(self, qc: QuantumCircuit): | ||
super().__init__() | ||
self.name = qc.name | ||
self.n_qubits = qc.num_qubits | ||
self.memory_slots = qc.num_clbits | ||
self.global_phase = qc.global_phase | ||
self.creg_sizes = [(creg.name, creg.size) for creg in qc.cregs] | ||
self.clbit_labels = [(creg.name, j) for creg in qc.cregs for j in range(creg.size)] | ||
self.qreg_sizes = [(qreg.name, qreg.size) for qreg in qc.qregs] | ||
self.qubit_labels = [(qreg.name, j) for qreg in qc.qregs for j in range(qreg.size)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.