mqt-core 3.3.0__cp314-cp314t-win_arm64.whl → 3.3.3__cp314-cp314t-win_arm64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. mqt/core/_version.py +3 -3
  2. mqt/core/bin/mqt-core-algorithms.dll +0 -0
  3. mqt/core/bin/mqt-core-circuit-optimizer.dll +0 -0
  4. mqt/core/bin/mqt-core-dd.dll +0 -0
  5. mqt/core/bin/mqt-core-ds.dll +0 -0
  6. mqt/core/bin/mqt-core-fomac.dll +0 -0
  7. mqt/core/bin/mqt-core-ir.dll +0 -0
  8. mqt/core/bin/mqt-core-na-fomac.dll +0 -0
  9. mqt/core/bin/mqt-core-na.dll +0 -0
  10. mqt/core/bin/mqt-core-qasm.dll +0 -0
  11. mqt/core/bin/mqt-core-qdmi-ddsim-device.dll +0 -0
  12. mqt/core/bin/mqt-core-qdmi-driver.dll +0 -0
  13. mqt/core/bin/mqt-core-qdmi-na-device.dll +0 -0
  14. mqt/core/bin/mqt-core-zx.dll +0 -0
  15. mqt/core/dd.cp314t-win_arm64.pyd +0 -0
  16. mqt/core/fomac.cp314t-win_arm64.pyd +0 -0
  17. mqt/core/include/mqt-core/ir/QuantumComputation.hpp +3 -0
  18. mqt/core/include/mqt-core/ir/operations/OpType.hpp +2 -0
  19. mqt/core/include/mqt-core/ir/operations/OpType.inc +4 -2
  20. mqt/core/include/mqt-core/mqt_ddsim_qdmi/device.h +602 -0
  21. mqt/core/include/mqt-core/mqt_ddsim_qdmi/types.h +78 -0
  22. mqt/core/include/mqt-core/qasm3/StdGates.hpp +169 -60
  23. mqt/core/include/mqt-core/qdmi/Driver.hpp +1 -0
  24. mqt/core/include/mqt-core/qdmi/dd/Device.hpp +310 -0
  25. mqt/core/ir/__init__.pyi +42 -0
  26. mqt/core/ir/operations.pyi +7 -0
  27. mqt/core/ir.cp314t-win_arm64.pyd +0 -0
  28. mqt/core/lib/mqt-core-algorithms.lib +0 -0
  29. mqt/core/lib/mqt-core-circuit-optimizer.lib +0 -0
  30. mqt/core/lib/mqt-core-dd.lib +0 -0
  31. mqt/core/lib/mqt-core-ds.lib +0 -0
  32. mqt/core/lib/mqt-core-fomac.lib +0 -0
  33. mqt/core/lib/mqt-core-ir.lib +0 -0
  34. mqt/core/lib/mqt-core-na-fomac.lib +0 -0
  35. mqt/core/lib/mqt-core-na.lib +0 -0
  36. mqt/core/lib/mqt-core-qasm.lib +0 -0
  37. mqt/core/lib/mqt-core-qdmi-ddsim-device.lib +0 -0
  38. mqt/core/lib/mqt-core-qdmi-driver.lib +0 -0
  39. mqt/core/lib/mqt-core-qdmi-na-device-gen.lib +0 -0
  40. mqt/core/lib/mqt-core-qdmi-na-device.lib +0 -0
  41. mqt/core/lib/mqt-core-zx.lib +0 -0
  42. mqt/core/lib/pkgconfig/spdlog.pc +1 -1
  43. mqt/core/lib/spdlog.lib +0 -0
  44. mqt/core/na/fomac.cp314t-win_arm64.pyd +0 -0
  45. mqt/core/plugins/qiskit/mqt_to_qiskit.py +2 -0
  46. mqt/core/plugins/qiskit/qiskit_to_mqt.py +4 -0
  47. mqt/core/share/cmake/mqt-core/mqt-core-config-version.cmake +3 -3
  48. mqt/core/share/cmake/mqt-core/mqt-core-config.cmake +1 -1
  49. mqt/core/share/cmake/mqt-core/mqt-core-targets-release.cmake +12 -1
  50. mqt/core/share/cmake/mqt-core/mqt-core-targets.cmake +24 -1
  51. mqt/core/{lib → share}/cmake/spdlog/spdlogConfigTargets.cmake +2 -0
  52. mqt/core/share/pkgconfig/nlohmann_json.pc +1 -1
  53. mqt_core-3.3.3.dist-info/DELVEWHEEL +2 -0
  54. {mqt_core-3.3.0.dist-info → mqt_core-3.3.3.dist-info}/METADATA +1 -1
  55. {mqt_core-3.3.0.dist-info → mqt_core-3.3.3.dist-info}/RECORD +61 -56
  56. mqt_core-3.3.0.dist-info/DELVEWHEEL +0 -2
  57. /mqt/core/{lib → share}/cmake/spdlog/spdlogConfig.cmake +0 -0
  58. /mqt/core/{lib → share}/cmake/spdlog/spdlogConfigTargets-release.cmake +0 -0
  59. /mqt/core/{lib → share}/cmake/spdlog/spdlogConfigVersion.cmake +0 -0
  60. {mqt_core-3.3.0.dist-info → mqt_core-3.3.3.dist-info}/WHEEL +0 -0
  61. {mqt_core-3.3.0.dist-info → mqt_core-3.3.3.dist-info}/entry_points.txt +0 -0
  62. {mqt_core-3.3.0.dist-info → mqt_core-3.3.3.dist-info}/licenses/LICENSE.md +0 -0
@@ -49,75 +49,184 @@ const std::string QE1LIB = "gate rccx a, b, c {\n"
49
49
  const std::map<std::string, std::shared_ptr<Gate>> STANDARD_GATES = {
50
50
  // gates from which all other gates can be constructed.
51
51
  {"gphase",
52
- std::make_shared<StandardGate>(StandardGate({0, 0, 1, qc::GPhase}))},
53
- {"U", std::make_shared<StandardGate>(StandardGate({0, 1, 3, qc::U}))},
52
+ std::make_shared<StandardGate>(StandardGate({.nControls = 0,
53
+ .nTargets = 0,
54
+ .nParameters = 1,
55
+ .type = qc::GPhase}))},
56
+ {"U",
57
+ std::make_shared<StandardGate>(StandardGate(
58
+ {.nControls = 0, .nTargets = 1, .nParameters = 3, .type = qc::U}))},
54
59
 
55
60
  // natively supported gates
56
- {"p", std::make_shared<StandardGate>(StandardGate({0, 1, 1, qc::P}))},
57
- {"u1", std::make_shared<StandardGate>(StandardGate({0, 1, 1, qc::P}))},
58
- {"phase", std::make_shared<StandardGate>(StandardGate({0, 1, 1, qc::P}))},
59
- {"cphase", std::make_shared<StandardGate>(StandardGate({1, 1, 1, qc::P}))},
60
- {"cp", std::make_shared<StandardGate>(StandardGate({1, 1, 1, qc::P}))},
61
-
62
- {"id", std::make_shared<StandardGate>(StandardGate({0, 1, 0, qc::I}))},
63
- {"u2", std::make_shared<StandardGate>(StandardGate({0, 1, 2, qc::U2}))},
64
- {"u3", std::make_shared<StandardGate>(StandardGate({0, 1, 3, qc::U}))},
65
- {"u", std::make_shared<StandardGate>(StandardGate({0, 1, 3, qc::U}))},
66
-
67
- {"x", std::make_shared<StandardGate>(StandardGate({0, 1, 0, qc::X}))},
68
- {"cx", std::make_shared<StandardGate>(StandardGate({1, 1, 0, qc::X}))},
69
- {"CX", std::make_shared<StandardGate>(StandardGate({1, 1, 0, qc::X}))},
70
- {"ccx", std::make_shared<StandardGate>(StandardGate({2, 1, 0, qc::X}))},
71
- {"c3x", std::make_shared<StandardGate>(StandardGate({3, 1, 0, qc::X}))},
72
- {"c4x", std::make_shared<StandardGate>(StandardGate({4, 1, 0, qc::X}))},
73
-
74
- {"rx", std::make_shared<StandardGate>(StandardGate({0, 1, 1, qc::RX}))},
75
- {"crx", std::make_shared<StandardGate>(StandardGate({1, 1, 1, qc::RX}))},
76
-
77
- {"y", std::make_shared<StandardGate>(StandardGate({0, 1, 0, qc::Y}))},
78
- {"cy", std::make_shared<StandardGate>(StandardGate({1, 1, 0, qc::Y}))},
79
-
80
- {"ry", std::make_shared<StandardGate>(StandardGate({0, 1, 1, qc::RY}))},
81
- {"cry", std::make_shared<StandardGate>(StandardGate({1, 1, 1, qc::RY}))},
82
-
83
- {"z", std::make_shared<StandardGate>(StandardGate({0, 1, 0, qc::Z}))},
84
- {"cz", std::make_shared<StandardGate>(StandardGate({1, 1, 0, qc::Z}))},
85
-
86
- {"rz", std::make_shared<StandardGate>(StandardGate({0, 1, 1, qc::RZ}))},
87
- {"crz", std::make_shared<StandardGate>(StandardGate({1, 1, 1, qc::RZ}))},
88
-
89
- {"h", std::make_shared<StandardGate>(StandardGate({0, 1, 0, qc::H}))},
90
- {"ch", std::make_shared<StandardGate>(StandardGate({1, 1, 0, qc::H}))},
91
-
92
- {"s", std::make_shared<StandardGate>(StandardGate({0, 1, 0, qc::S}))},
93
- {"sdg", std::make_shared<StandardGate>(StandardGate({0, 1, 0, qc::Sdg}))},
94
-
95
- {"t", std::make_shared<StandardGate>(StandardGate({0, 1, 0, qc::T}))},
96
- {"tdg", std::make_shared<StandardGate>(StandardGate({0, 1, 0, qc::Tdg}))},
97
-
98
- {"sx", std::make_shared<StandardGate>(StandardGate({0, 1, 0, qc::SX}))},
99
- {"sxdg", std::make_shared<StandardGate>(StandardGate({0, 1, 0, qc::SXdg}))},
61
+ {"p",
62
+ std::make_shared<StandardGate>(StandardGate(
63
+ {.nControls = 0, .nTargets = 1, .nParameters = 1, .type = qc::P}))},
64
+ {"u1",
65
+ std::make_shared<StandardGate>(StandardGate(
66
+ {.nControls = 0, .nTargets = 1, .nParameters = 1, .type = qc::P}))},
67
+ {"phase",
68
+ std::make_shared<StandardGate>(StandardGate(
69
+ {.nControls = 0, .nTargets = 1, .nParameters = 1, .type = qc::P}))},
70
+ {"cphase",
71
+ std::make_shared<StandardGate>(StandardGate(
72
+ {.nControls = 1, .nTargets = 1, .nParameters = 1, .type = qc::P}))},
73
+ {"cp",
74
+ std::make_shared<StandardGate>(StandardGate(
75
+ {.nControls = 1, .nTargets = 1, .nParameters = 1, .type = qc::P}))},
76
+
77
+ {"id",
78
+ std::make_shared<StandardGate>(StandardGate(
79
+ {.nControls = 0, .nTargets = 1, .nParameters = 0, .type = qc::I}))},
80
+ {"u2",
81
+ std::make_shared<StandardGate>(StandardGate(
82
+ {.nControls = 0, .nTargets = 1, .nParameters = 2, .type = qc::U2}))},
83
+ {"u3",
84
+ std::make_shared<StandardGate>(StandardGate(
85
+ {.nControls = 0, .nTargets = 1, .nParameters = 3, .type = qc::U}))},
86
+ {"u",
87
+ std::make_shared<StandardGate>(StandardGate(
88
+ {.nControls = 0, .nTargets = 1, .nParameters = 3, .type = qc::U}))},
89
+
90
+ {"x",
91
+ std::make_shared<StandardGate>(StandardGate(
92
+ {.nControls = 0, .nTargets = 1, .nParameters = 0, .type = qc::X}))},
93
+ {"cx",
94
+ std::make_shared<StandardGate>(StandardGate(
95
+ {.nControls = 1, .nTargets = 1, .nParameters = 0, .type = qc::X}))},
96
+ {"CX",
97
+ std::make_shared<StandardGate>(StandardGate(
98
+ {.nControls = 1, .nTargets = 1, .nParameters = 0, .type = qc::X}))},
99
+ {"ccx",
100
+ std::make_shared<StandardGate>(StandardGate(
101
+ {.nControls = 2, .nTargets = 1, .nParameters = 0, .type = qc::X}))},
102
+ {"c3x",
103
+ std::make_shared<StandardGate>(StandardGate(
104
+ {.nControls = 3, .nTargets = 1, .nParameters = 0, .type = qc::X}))},
105
+ {"c4x",
106
+ std::make_shared<StandardGate>(StandardGate(
107
+ {.nControls = 4, .nTargets = 1, .nParameters = 0, .type = qc::X}))},
108
+
109
+ {"rx",
110
+ std::make_shared<StandardGate>(StandardGate(
111
+ {.nControls = 0, .nTargets = 1, .nParameters = 1, .type = qc::RX}))},
112
+ {"crx",
113
+ std::make_shared<StandardGate>(StandardGate(
114
+ {.nControls = 1, .nTargets = 1, .nParameters = 1, .type = qc::RX}))},
115
+
116
+ {"y",
117
+ std::make_shared<StandardGate>(StandardGate(
118
+ {.nControls = 0, .nTargets = 1, .nParameters = 0, .type = qc::Y}))},
119
+ {"cy",
120
+ std::make_shared<StandardGate>(StandardGate(
121
+ {.nControls = 1, .nTargets = 1, .nParameters = 0, .type = qc::Y}))},
122
+
123
+ {"ry",
124
+ std::make_shared<StandardGate>(StandardGate(
125
+ {.nControls = 0, .nTargets = 1, .nParameters = 1, .type = qc::RY}))},
126
+ {"cry",
127
+ std::make_shared<StandardGate>(StandardGate(
128
+ {.nControls = 1, .nTargets = 1, .nParameters = 1, .type = qc::RY}))},
129
+
130
+ {"z",
131
+ std::make_shared<StandardGate>(StandardGate(
132
+ {.nControls = 0, .nTargets = 1, .nParameters = 0, .type = qc::Z}))},
133
+ {"cz",
134
+ std::make_shared<StandardGate>(StandardGate(
135
+ {.nControls = 1, .nTargets = 1, .nParameters = 0, .type = qc::Z}))},
136
+
137
+ {"rz",
138
+ std::make_shared<StandardGate>(StandardGate(
139
+ {.nControls = 0, .nTargets = 1, .nParameters = 1, .type = qc::RZ}))},
140
+ {"crz",
141
+ std::make_shared<StandardGate>(StandardGate(
142
+ {.nControls = 1, .nTargets = 1, .nParameters = 1, .type = qc::RZ}))},
143
+
144
+ {"r",
145
+ std::make_shared<StandardGate>(StandardGate(
146
+ {.nControls = 0, .nTargets = 1, .nParameters = 2, .type = qc::R}))},
147
+ {"prx",
148
+ std::make_shared<StandardGate>(StandardGate(
149
+ {.nControls = 0, .nTargets = 1, .nParameters = 2, .type = qc::R}))},
150
+ {"cr",
151
+ std::make_shared<StandardGate>(StandardGate(
152
+ {.nControls = 1, .nTargets = 1, .nParameters = 2, .type = qc::R}))},
153
+
154
+ {"h",
155
+ std::make_shared<StandardGate>(StandardGate(
156
+ {.nControls = 0, .nTargets = 1, .nParameters = 0, .type = qc::H}))},
157
+ {"ch",
158
+ std::make_shared<StandardGate>(StandardGate(
159
+ {.nControls = 1, .nTargets = 1, .nParameters = 0, .type = qc::H}))},
160
+
161
+ {"s",
162
+ std::make_shared<StandardGate>(StandardGate(
163
+ {.nControls = 0, .nTargets = 1, .nParameters = 0, .type = qc::S}))},
164
+ {"sdg",
165
+ std::make_shared<StandardGate>(StandardGate(
166
+ {.nControls = 0, .nTargets = 1, .nParameters = 0, .type = qc::Sdg}))},
167
+
168
+ {"t",
169
+ std::make_shared<StandardGate>(StandardGate(
170
+ {.nControls = 0, .nTargets = 1, .nParameters = 0, .type = qc::T}))},
171
+ {"tdg",
172
+ std::make_shared<StandardGate>(StandardGate(
173
+ {.nControls = 0, .nTargets = 1, .nParameters = 0, .type = qc::Tdg}))},
174
+
175
+ {"sx",
176
+ std::make_shared<StandardGate>(StandardGate(
177
+ {.nControls = 0, .nTargets = 1, .nParameters = 0, .type = qc::SX}))},
178
+ {"sxdg",
179
+ std::make_shared<StandardGate>(StandardGate(
180
+ {.nControls = 0, .nTargets = 1, .nParameters = 0, .type = qc::SXdg}))},
100
181
  {"c3sqrtx",
101
- std::make_shared<StandardGate>(StandardGate({3, 1, 0, qc::SXdg}))},
182
+ std::make_shared<StandardGate>(StandardGate(
183
+ {.nControls = 3, .nTargets = 1, .nParameters = 0, .type = qc::SXdg}))},
102
184
 
103
- {"swap", std::make_shared<StandardGate>(StandardGate({0, 2, 0, qc::SWAP}))},
185
+ {"swap",
186
+ std::make_shared<StandardGate>(StandardGate(
187
+ {.nControls = 0, .nTargets = 2, .nParameters = 0, .type = qc::SWAP}))},
104
188
  {"cswap",
105
- std::make_shared<StandardGate>(StandardGate({1, 2, 0, qc::SWAP}))},
189
+ std::make_shared<StandardGate>(StandardGate(
190
+ {.nControls = 1, .nTargets = 2, .nParameters = 0, .type = qc::SWAP}))},
106
191
 
107
192
  {"iswap",
108
- std::make_shared<StandardGate>(StandardGate({0, 2, 0, qc::iSWAP}))},
193
+ std::make_shared<StandardGate>(StandardGate({.nControls = 0,
194
+ .nTargets = 2,
195
+ .nParameters = 0,
196
+ .type = qc::iSWAP}))},
109
197
  {"iswapdg",
110
- std::make_shared<StandardGate>(StandardGate({0, 2, 0, qc::iSWAPdg}))},
111
-
112
- {"rxx", std::make_shared<StandardGate>(StandardGate({0, 2, 1, qc::RXX}))},
113
- {"ryy", std::make_shared<StandardGate>(StandardGate({0, 2, 1, qc::RYY}))},
114
- {"rzz", std::make_shared<StandardGate>(StandardGate({0, 2, 1, qc::RZZ}))},
115
- {"rzx", std::make_shared<StandardGate>(StandardGate({0, 2, 1, qc::RZX}))},
116
- {"dcx", std::make_shared<StandardGate>(StandardGate({0, 2, 0, qc::DCX}))},
117
- {"ecr", std::make_shared<StandardGate>(StandardGate({0, 2, 0, qc::ECR}))},
198
+ std::make_shared<StandardGate>(StandardGate({.nControls = 0,
199
+ .nTargets = 2,
200
+ .nParameters = 0,
201
+ .type = qc::iSWAPdg}))},
202
+
203
+ {"rxx",
204
+ std::make_shared<StandardGate>(StandardGate(
205
+ {.nControls = 0, .nTargets = 2, .nParameters = 1, .type = qc::RXX}))},
206
+ {"ryy",
207
+ std::make_shared<StandardGate>(StandardGate(
208
+ {.nControls = 0, .nTargets = 2, .nParameters = 1, .type = qc::RYY}))},
209
+ {"rzz",
210
+ std::make_shared<StandardGate>(StandardGate(
211
+ {.nControls = 0, .nTargets = 2, .nParameters = 1, .type = qc::RZZ}))},
212
+ {"rzx",
213
+ std::make_shared<StandardGate>(StandardGate(
214
+ {.nControls = 0, .nTargets = 2, .nParameters = 1, .type = qc::RZX}))},
215
+ {"dcx",
216
+ std::make_shared<StandardGate>(StandardGate(
217
+ {.nControls = 0, .nTargets = 2, .nParameters = 0, .type = qc::DCX}))},
218
+ {"ecr",
219
+ std::make_shared<StandardGate>(StandardGate(
220
+ {.nControls = 0, .nTargets = 2, .nParameters = 0, .type = qc::ECR}))},
118
221
  {"xx_minus_yy",
119
- std::make_shared<StandardGate>(StandardGate({0, 2, 2, qc::XXminusYY}))},
222
+ std::make_shared<StandardGate>(StandardGate({.nControls = 0,
223
+ .nTargets = 2,
224
+ .nParameters = 2,
225
+ .type = qc::XXminusYY}))},
120
226
  {"xx_plus_yy",
121
- std::make_shared<StandardGate>(StandardGate({0, 2, 2, qc::XXplusYY}))},
227
+ std::make_shared<StandardGate>(StandardGate({.nControls = 0,
228
+ .nTargets = 2,
229
+ .nParameters = 2,
230
+ .type = qc::XXplusYY}))},
122
231
  };
123
232
  } // namespace qasm3
@@ -139,6 +139,7 @@ public:
139
139
 
140
140
  // Call the above macro for all static libraries that we want to support.
141
141
  DECLARE_STATIC_LIBRARY(MQT_NA)
142
+ DECLARE_STATIC_LIBRARY(MQT_DDSIM)
142
143
 
143
144
  /**
144
145
  * @brief The status of a session.
@@ -0,0 +1,310 @@
1
+ /*
2
+ * Copyright (c) 2023 - 2025 Chair for Design Automation, TUM
3
+ * Copyright (c) 2025 Munich Quantum Software Company GmbH
4
+ * All rights reserved.
5
+ *
6
+ * SPDX-License-Identifier: MIT
7
+ *
8
+ * Licensed under the MIT License
9
+ */
10
+
11
+ #pragma once
12
+
13
+ /** @file
14
+ * @brief The MQT QDMI device implementation for its DD-based simulator.
15
+ */
16
+
17
+ #include "dd/DDDefinitions.hpp"
18
+ #include "dd/Package.hpp"
19
+ #include "mqt_ddsim_qdmi/device.h"
20
+
21
+ #include <atomic>
22
+ #include <cstddef>
23
+ #include <cstdint>
24
+ #include <future>
25
+ #include <limits>
26
+ #include <map>
27
+ #include <memory>
28
+ #include <mutex>
29
+ #include <random>
30
+ #include <string>
31
+ #include <unordered_map>
32
+ #include <vector>
33
+
34
+ namespace qdmi::dd {
35
+ class Device final {
36
+ /// Provides access to the device name.
37
+ std::string name_;
38
+
39
+ /// The number of qubits supported by the simulator.
40
+ size_t qubitsNum_ = 0;
41
+
42
+ /// The status of the device.
43
+ std::atomic<QDMI_Device_Status> status_{QDMI_DEVICE_STATUS_OFFLINE};
44
+
45
+ /// The list of device sessions.
46
+ std::unordered_map<MQT_DDSIM_QDMI_Device_Session,
47
+ std::unique_ptr<MQT_DDSIM_QDMI_Device_Session_impl_d>>
48
+ sessions_;
49
+ /// Mutex protecting access to sessions_.
50
+ mutable std::mutex sessionsMutex_{};
51
+
52
+ /// RNG for generating unique IDs.
53
+ std::mt19937_64 rng_{std::random_device{}()};
54
+ /// Mutex protecting RNG usage.
55
+ mutable std::mutex rngMutex_{};
56
+
57
+ /// Distribution for generating unique IDs.
58
+ std::uniform_int_distribution<> dis_ =
59
+ std::uniform_int_distribution<>(0, std::numeric_limits<int>::max());
60
+
61
+ /// The number of running jobs.
62
+ std::atomic<size_t> runningJobs_{0};
63
+
64
+ /// @brief Private constructor to enforce the singleton pattern.
65
+ Device();
66
+
67
+ public:
68
+ // Default move constructor and move assignment operator.
69
+ Device(Device&&) = delete;
70
+ Device& operator=(Device&&) = delete;
71
+ // Delete copy constructor and assignment operator to enforce singleton.
72
+ Device(const Device&) = delete;
73
+ Device& operator=(const Device&) = delete;
74
+
75
+ /// @returns the singleton instance of the Device class.
76
+ [[nodiscard]] static Device& get() {
77
+ static Device instance;
78
+ return instance;
79
+ }
80
+
81
+ /// @brief Destructor for the Device class.
82
+ ~Device() = default;
83
+
84
+ /**
85
+ * @brief Allocates a new device session.
86
+ * @see MQT_DDSIM_QDMI_device_session_alloc
87
+ */
88
+ auto sessionAlloc(MQT_DDSIM_QDMI_Device_Session* session) -> QDMI_STATUS;
89
+
90
+ /**
91
+ * @brief Frees a device session.
92
+ * @see MQT_DDSIM_QDMI_device_session_free
93
+ */
94
+ auto sessionFree(MQT_DDSIM_QDMI_Device_Session session) -> void;
95
+
96
+ /**
97
+ * @brief Query a device property.
98
+ * @see MQT_DDSIM_QDMI_device_session_query_device_property
99
+ */
100
+ auto queryProperty(QDMI_Device_Property prop, size_t size, void* value,
101
+ size_t* sizeRet) const -> QDMI_STATUS;
102
+
103
+ /// Generates a unique ID.
104
+ auto generateUniqueID() -> int;
105
+
106
+ /// Sets the device status.
107
+ auto setStatus(QDMI_Device_Status status) -> void;
108
+
109
+ /// Bumps the number of running jobs and updates the status
110
+ auto increaseRunningJobs() -> void;
111
+
112
+ /// Decreases the number of running jobs and updates the status
113
+ auto decreaseRunningJobs() -> void;
114
+ };
115
+ } // namespace qdmi::dd
116
+
117
+ /**
118
+ * @brief Implementation of the MQT_DDSIM_QDMI_Device_Session structure.
119
+ */
120
+ struct MQT_DDSIM_QDMI_Device_Session_impl_d {
121
+ private:
122
+ /// The status of the session.
123
+ enum class Status : uint8_t {
124
+ ALLOCATED, ///< The session has been allocated but not initialized
125
+ INITIALIZED, ///< The session has been initialized and is ready for use
126
+ };
127
+ /// @brief The current status of the session.
128
+ Status status_ = Status::ALLOCATED;
129
+ /// @brief The device jobs associated with this session.
130
+ std::unordered_map<MQT_DDSIM_QDMI_Device_Job,
131
+ std::unique_ptr<MQT_DDSIM_QDMI_Device_Job_impl_d>>
132
+ jobs_;
133
+ /// @brief Mutex protecting access to jobs_.
134
+ mutable std::mutex jobsMutex_{};
135
+
136
+ public:
137
+ /**
138
+ * @brief Initializes the device session.
139
+ * @see MQT_DDSIM_QDMI_device_session_init
140
+ */
141
+ auto init() -> QDMI_STATUS;
142
+
143
+ /**
144
+ * @brief Sets a parameter for the device session.
145
+ * @see MQT_DDSIM_QDMI_device_session_set_parameter
146
+ */
147
+ auto setParameter(QDMI_Device_Session_Parameter param, size_t size,
148
+ const void* value) const -> QDMI_STATUS;
149
+
150
+ /**
151
+ * @brief Create a new device job.
152
+ * @see MQT_DDSIM_QDMI_device_session_create_device_job
153
+ */
154
+ auto createDeviceJob(MQT_DDSIM_QDMI_Device_Job* job) -> QDMI_STATUS;
155
+
156
+ /**
157
+ * @brief Frees the device job.
158
+ * @see MQT_DDSIM_QDMI_device_job_free
159
+ */
160
+ auto freeDeviceJob(MQT_DDSIM_QDMI_Device_Job job) -> void;
161
+
162
+ /**
163
+ * @brief Forwards a query of a device property to the device.
164
+ * @see MQT_DDSIM_QDMI_device_session_query_device_property
165
+ */
166
+ auto queryDeviceProperty(QDMI_Device_Property prop, size_t size, void* value,
167
+ size_t* sizeRet) const -> QDMI_STATUS;
168
+
169
+ /**
170
+ * @brief Forwards a query of a site property to the site.
171
+ * @see MQT_DDSIM_QDMI_device_session_query_site_property
172
+ */
173
+ auto querySiteProperty(MQT_DDSIM_QDMI_Site site, QDMI_Site_Property prop,
174
+ size_t size, void* value, size_t* sizeRet) const
175
+ -> QDMI_STATUS;
176
+
177
+ /**
178
+ * @brief Forwards a query of an operation property to the operation.
179
+ * @see MQT_DDSIM_QDMI_device_session_query_operation_property
180
+ */
181
+ auto queryOperationProperty(MQT_DDSIM_QDMI_Operation operation,
182
+ size_t numSites, const MQT_DDSIM_QDMI_Site* sites,
183
+ size_t numParams, const double* params,
184
+ QDMI_Operation_Property prop, size_t size,
185
+ void* value, size_t* sizeRet) const
186
+ -> QDMI_STATUS;
187
+ };
188
+
189
+ /**
190
+ * @brief Implementation of the MQT_DDSIM_QDMI_Device_Job structure.
191
+ */
192
+ struct MQT_DDSIM_QDMI_Device_Job_impl_d {
193
+ private:
194
+ /// The device session associated with the job.
195
+ MQT_DDSIM_QDMI_Device_Session_impl_d* session_;
196
+
197
+ /// The unique identifier of the job.
198
+ int id_ = 0;
199
+
200
+ /// The status of the job
201
+ std::atomic<QDMI_Job_Status> status_{QDMI_JOB_STATUS_CREATED};
202
+
203
+ /// The program format
204
+ QDMI_Program_Format format_ = QDMI_PROGRAM_FORMAT_QASM3;
205
+
206
+ /// The quantum program associated with the job
207
+ std::string program_;
208
+
209
+ /// The number of shots for the job
210
+ size_t numShots_ = 1024U;
211
+
212
+ /// Handle for the asynchronous job
213
+ std::future<void> jobHandle_;
214
+
215
+ /// The measurement counts for the job
216
+ std::map<std::string, std::size_t> counts_;
217
+
218
+ /// The DD package used for the state vector simulation
219
+ std::unique_ptr<dd::Package> dd_;
220
+
221
+ /// The final DD at the end of the state vector simulation
222
+ dd::VectorDD stateVecDD_{};
223
+
224
+ /// The state vector for the job (only available if no mid-circuit
225
+ /// measurements are used).
226
+ dd::CVec stateVec_;
227
+
228
+ /// The sparse state vector for the job (only available if no mid-circuit
229
+ /// measurements are used).
230
+ dd::SparseCVec stateVecSparse_;
231
+
232
+ /// One-time flags to lazily materialize vectors in a thread-safe way
233
+ std::once_flag stateVecOnce_;
234
+ std::once_flag stateVecSparseOnce_;
235
+
236
+ /// Translate counts to QDMI histogram
237
+ auto getHistogram(QDMI_Job_Result result, size_t size, void* data,
238
+ size_t* sizeRet) -> QDMI_STATUS;
239
+
240
+ /// Translate the state vector DD to a dense state vector for QDMI
241
+ auto getStateVector(size_t size, void* data, size_t* sizeRet) -> QDMI_STATUS;
242
+
243
+ /// Translate the state vector DD to sparse representations for QDMI
244
+ auto getSparseResults(QDMI_Job_Result result, size_t size, void* data,
245
+ size_t* sizeRet) -> QDMI_STATUS;
246
+
247
+ /// Translate the state vector DD to a dense vector of probabilities for QDMI
248
+ auto getProbabilities(size_t size, void* data, size_t* sizeRet)
249
+ -> QDMI_STATUS;
250
+
251
+ public:
252
+ /// Constructor for the MQT_DDSIM_QDMI_Device_Job_impl_d.
253
+ explicit MQT_DDSIM_QDMI_Device_Job_impl_d(
254
+ MQT_DDSIM_QDMI_Device_Session_impl_d* session)
255
+ : session_(session), id_(qdmi::dd::Device::get().generateUniqueID()) {}
256
+ /**
257
+ * @brief Frees the device job.
258
+ * @note This function just forwards to the session's @ref freeDeviceJob
259
+ * function. This function is needed because the interface only provides the
260
+ * job handle to the @ref QDMI_job_free function and the job's session handle
261
+ * is private.
262
+ * @see QDMI_job_free
263
+ */
264
+ auto free() -> void;
265
+
266
+ /**
267
+ * @brief Sets a parameter for the job.
268
+ * @see MQT_DDSIM_QDMI_device_job_set_parameter
269
+ */
270
+ auto setParameter(QDMI_Device_Job_Parameter param, size_t size,
271
+ const void* value) -> QDMI_STATUS;
272
+
273
+ /**
274
+ * @brief Queries a property of the job.
275
+ * @see MQT_DDSIM_QDMI_device_job_query_property
276
+ */
277
+ auto queryProperty(QDMI_Device_Job_Property prop, size_t size, void* value,
278
+ size_t* sizeRet) const -> QDMI_STATUS;
279
+
280
+ /**
281
+ * @brief Submits the job to the device.
282
+ * @see MQT_DDSIM_QDMI_device_job_submit
283
+ */
284
+ auto submit() -> QDMI_STATUS;
285
+
286
+ /**
287
+ * @brief Cancels the job.
288
+ * @see MQT_DDSIM_QDMI_device_job_cancel
289
+ */
290
+ auto cancel() -> QDMI_STATUS;
291
+
292
+ /**
293
+ * @brief Checks the status of the job.
294
+ * @see MQT_DDSIM_QDMI_device_job_check
295
+ */
296
+ auto check(QDMI_Job_Status* status) const -> QDMI_STATUS;
297
+
298
+ /**
299
+ * @brief Waits for the job to complete but at most for the specified timeout.
300
+ * @see MQT_DDSIM_QDMI_device_job_wait
301
+ */
302
+ auto wait(size_t timeout) const -> QDMI_STATUS;
303
+
304
+ /**
305
+ * @brief Gets the results of the job.
306
+ * @see MQT_DDSIM_QDMI_device_job_get_results
307
+ */
308
+ auto getResults(QDMI_Job_Result result, size_t size, void* data,
309
+ size_t* sizeRet) -> QDMI_STATUS;
310
+ };
mqt/core/ir/__init__.pyi CHANGED
@@ -1003,6 +1003,48 @@ class QuantumComputation(MutableSequence[Operation]):
1003
1003
  :meth:`sxdg`
1004
1004
  """
1005
1005
 
1006
+ def r(self, theta: float | Expression, phi: float | Expression, q: int) -> None:
1007
+ r"""Apply an :math:`R(\theta, \phi)` gate.
1008
+
1009
+ .. math::
1010
+ R(\theta, \phi) = e^{-i\frac{\theta}{2}(\cos(\phi)X+\sin(\phi)Y)}
1011
+ = \begin{pmatrix} \cos(\theta/2) & -i e^{-i\phi} \sin(\theta/2) \\
1012
+ -i e^{i\phi} \sin(\theta/2) & \cos(\theta/2) \end{pmatrix}
1013
+
1014
+ Args:
1015
+ theta: The rotation angle :math:`\theta`
1016
+ phi: The angle specifying the rotation axis given by :math:`\cos(\phi)X+\sin(\phi)Y`
1017
+ q: The target qubit
1018
+ """
1019
+
1020
+ def cr(self, theta: float | Expression, phi: float | Expression, control: Control | int, target: int) -> None:
1021
+ r"""Apply a controlled :math:`R(\theta, \phi)` gate.
1022
+
1023
+ Args:
1024
+ theta: The rotation angle :math:`\theta`
1025
+ phi: The angle specifying the rotation axis given by :math:`\cos(\phi)X+\sin(\phi)Y`
1026
+ control: The control qubit
1027
+ target: The target qubit
1028
+
1029
+ See Also:
1030
+ :meth:`r`
1031
+ """
1032
+
1033
+ def mcr(
1034
+ self, theta: float | Expression, phi: float | Expression, controls: set[Control | int], target: int
1035
+ ) -> None:
1036
+ r"""Apply a multi-controlled :math:`R(\theta, \phi)` gate.
1037
+
1038
+ Args:
1039
+ theta: The rotation angle :math:`\theta`
1040
+ phi: The angle specifying the rotation axis given by :math:`\cos(\phi)X+\sin(\phi)Y`
1041
+ controls: The control qubits
1042
+ target: The target qubit
1043
+
1044
+ See Also:
1045
+ :meth:`r`
1046
+ """
1047
+
1006
1048
  def rx(self, theta: float | Expression, q: int) -> None:
1007
1049
  r"""Apply an :math:`R_x(\theta)` gate.
1008
1050
 
@@ -185,6 +185,13 @@ class OpType(Enum):
185
185
  See Also:
186
186
  :meth:`mqt.core.ir.QuantumComputation.reset`
187
187
  """
188
+ r = ...
189
+ r"""
190
+ An :math:`R` gate.
191
+
192
+ See Also:
193
+ :meth:`mqt.core.ir.QuantumComputation.r`
194
+ """
188
195
  rx = ...
189
196
  r"""
190
197
  An :math:`R_x` gate.
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file