mqt-core 3.0.2__cp310-cp310-win_amd64.whl → 3.2.0__cp310-cp310-win_amd64.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.

Potentially problematic release.


This version of mqt-core might be problematic. Click here for more details.

Files changed (111) hide show
  1. mqt/core/__init__.py +3 -3
  2. mqt/core/_version.py +2 -2
  3. mqt/core/bin/mqt-core-algorithms.dll +0 -0
  4. mqt/core/bin/mqt-core-circuit-optimizer.dll +0 -0
  5. mqt/core/bin/mqt-core-dd.dll +0 -0
  6. mqt/core/bin/mqt-core-ds.dll +0 -0
  7. mqt/core/bin/mqt-core-ir.dll +0 -0
  8. mqt/core/bin/mqt-core-na.dll +0 -0
  9. mqt/core/bin/mqt-core-qasm.dll +0 -0
  10. mqt/core/bin/mqt-core-zx.dll +0 -0
  11. mqt/core/dd.cp310-win_amd64.pyd +0 -0
  12. mqt/core/dd.pyi +9 -22
  13. mqt/core/include/mqt-core/datastructures/DirectedAcyclicGraph.hpp +4 -4
  14. mqt/core/include/mqt-core/datastructures/DirectedGraph.hpp +7 -7
  15. mqt/core/include/mqt-core/datastructures/UndirectedGraph.hpp +8 -8
  16. mqt/core/include/mqt-core/dd/Approximation.hpp +45 -0
  17. mqt/core/include/mqt-core/dd/Complex.hpp +6 -0
  18. mqt/core/include/mqt-core/dd/ComplexNumbers.hpp +0 -18
  19. mqt/core/include/mqt-core/dd/ComputeTable.hpp +4 -1
  20. mqt/core/include/mqt-core/dd/DDDefinitions.hpp +0 -7
  21. mqt/core/include/mqt-core/dd/Edge.hpp +16 -0
  22. mqt/core/include/mqt-core/dd/Export.hpp +1 -2
  23. mqt/core/include/mqt-core/dd/Node.hpp +26 -49
  24. mqt/core/include/mqt-core/dd/Operations.hpp +27 -0
  25. mqt/core/include/mqt-core/dd/Package.hpp +141 -123
  26. mqt/core/include/mqt-core/dd/RealNumber.hpp +49 -66
  27. mqt/core/include/mqt-core/dd/RealNumberUniqueTable.hpp +14 -25
  28. mqt/core/include/mqt-core/dd/StateGeneration.hpp +143 -0
  29. mqt/core/include/mqt-core/dd/UnaryComputeTable.hpp +6 -4
  30. mqt/core/include/mqt-core/dd/UniqueTable.hpp +13 -39
  31. mqt/core/include/mqt-core/dd/statistics/PackageStatistics.hpp +8 -7
  32. mqt/core/include/mqt-core/dd/statistics/UniqueTableStatistics.hpp +0 -10
  33. mqt/core/include/mqt-core/ir/QuantumComputation.hpp +3 -0
  34. mqt/core/include/mqt-core/ir/operations/CompoundOperation.hpp +2 -0
  35. mqt/core/include/mqt-core/ir/operations/Expression.hpp +1 -1
  36. mqt/core/include/mqt-core/ir/operations/Operation.hpp +2 -2
  37. mqt/core/ir/operations.pyi +58 -86
  38. mqt/core/ir.cp310-win_amd64.pyd +0 -0
  39. mqt/core/lib/mqt-core-algorithms.lib +0 -0
  40. mqt/core/lib/mqt-core-circuit-optimizer.lib +0 -0
  41. mqt/core/lib/mqt-core-dd.lib +0 -0
  42. mqt/core/lib/mqt-core-ds.lib +0 -0
  43. mqt/core/lib/mqt-core-ir.lib +0 -0
  44. mqt/core/lib/mqt-core-na.lib +0 -0
  45. mqt/core/lib/mqt-core-qasm.lib +0 -0
  46. mqt/core/lib/mqt-core-zx.lib +0 -0
  47. mqt/core/plugins/__init__.py +0 -8
  48. mqt/core/plugins/qiskit/qiskit_to_mqt.py +6 -0
  49. mqt/core/share/cmake/mqt-core/AddMQTPythonBinding.cmake +52 -0
  50. mqt/core/share/cmake/mqt-core/PackageAddTest.cmake +4 -4
  51. mqt/core/share/cmake/mqt-core/mqt-core-config-version.cmake +3 -3
  52. mqt/core/share/cmake/mqt-core/mqt-core-config.cmake +1 -0
  53. mqt/core/share/cmake/mqt-core/mqt-core-targets.cmake +2 -2
  54. mqt_core-3.2.0.dist-info/DELVEWHEEL +2 -0
  55. {mqt_core-3.0.2.dist-info → mqt_core-3.2.0.dist-info}/METADATA +49 -23
  56. {mqt_core-3.0.2.dist-info → mqt_core-3.2.0.dist-info}/RECORD +60 -107
  57. {mqt_core-3.0.2.dist-info → mqt_core-3.2.0.dist-info}/WHEEL +1 -1
  58. mqt_core.libs/msvcp140.dll +0 -0
  59. mqt/core/include/nlohmann/adl_serializer.hpp +0 -55
  60. mqt/core/include/nlohmann/byte_container_with_subtype.hpp +0 -103
  61. mqt/core/include/nlohmann/detail/abi_macros.hpp +0 -100
  62. mqt/core/include/nlohmann/detail/conversions/from_json.hpp +0 -497
  63. mqt/core/include/nlohmann/detail/conversions/to_chars.hpp +0 -1118
  64. mqt/core/include/nlohmann/detail/conversions/to_json.hpp +0 -446
  65. mqt/core/include/nlohmann/detail/exceptions.hpp +0 -257
  66. mqt/core/include/nlohmann/detail/hash.hpp +0 -129
  67. mqt/core/include/nlohmann/detail/input/binary_reader.hpp +0 -3009
  68. mqt/core/include/nlohmann/detail/input/input_adapters.hpp +0 -492
  69. mqt/core/include/nlohmann/detail/input/json_sax.hpp +0 -727
  70. mqt/core/include/nlohmann/detail/input/lexer.hpp +0 -1633
  71. mqt/core/include/nlohmann/detail/input/parser.hpp +0 -519
  72. mqt/core/include/nlohmann/detail/input/position_t.hpp +0 -37
  73. mqt/core/include/nlohmann/detail/iterators/internal_iterator.hpp +0 -35
  74. mqt/core/include/nlohmann/detail/iterators/iter_impl.hpp +0 -751
  75. mqt/core/include/nlohmann/detail/iterators/iteration_proxy.hpp +0 -242
  76. mqt/core/include/nlohmann/detail/iterators/iterator_traits.hpp +0 -61
  77. mqt/core/include/nlohmann/detail/iterators/json_reverse_iterator.hpp +0 -130
  78. mqt/core/include/nlohmann/detail/iterators/primitive_iterator.hpp +0 -132
  79. mqt/core/include/nlohmann/detail/json_custom_base_class.hpp +0 -39
  80. mqt/core/include/nlohmann/detail/json_pointer.hpp +0 -988
  81. mqt/core/include/nlohmann/detail/json_ref.hpp +0 -78
  82. mqt/core/include/nlohmann/detail/macro_scope.hpp +0 -482
  83. mqt/core/include/nlohmann/detail/macro_unscope.hpp +0 -45
  84. mqt/core/include/nlohmann/detail/meta/call_std/begin.hpp +0 -17
  85. mqt/core/include/nlohmann/detail/meta/call_std/end.hpp +0 -17
  86. mqt/core/include/nlohmann/detail/meta/cpp_future.hpp +0 -171
  87. mqt/core/include/nlohmann/detail/meta/detected.hpp +0 -70
  88. mqt/core/include/nlohmann/detail/meta/identity_tag.hpp +0 -21
  89. mqt/core/include/nlohmann/detail/meta/is_sax.hpp +0 -159
  90. mqt/core/include/nlohmann/detail/meta/std_fs.hpp +0 -29
  91. mqt/core/include/nlohmann/detail/meta/type_traits.hpp +0 -795
  92. mqt/core/include/nlohmann/detail/meta/void_t.hpp +0 -24
  93. mqt/core/include/nlohmann/detail/output/binary_writer.hpp +0 -1838
  94. mqt/core/include/nlohmann/detail/output/output_adapters.hpp +0 -147
  95. mqt/core/include/nlohmann/detail/output/serializer.hpp +0 -988
  96. mqt/core/include/nlohmann/detail/string_concat.hpp +0 -146
  97. mqt/core/include/nlohmann/detail/string_escape.hpp +0 -72
  98. mqt/core/include/nlohmann/detail/value_t.hpp +0 -118
  99. mqt/core/include/nlohmann/json.hpp +0 -5258
  100. mqt/core/include/nlohmann/json_fwd.hpp +0 -75
  101. mqt/core/include/nlohmann/ordered_map.hpp +0 -359
  102. mqt/core/include/nlohmann/thirdparty/hedley/hedley.hpp +0 -2045
  103. mqt/core/include/nlohmann/thirdparty/hedley/hedley_undef.hpp +0 -158
  104. mqt/core/nlohmann_json.natvis +0 -278
  105. mqt/core/share/cmake/nlohmann_json/nlohmann_jsonConfig.cmake +0 -15
  106. mqt/core/share/cmake/nlohmann_json/nlohmann_jsonConfigVersion.cmake +0 -20
  107. mqt/core/share/cmake/nlohmann_json/nlohmann_jsonTargets.cmake +0 -110
  108. mqt/core/share/pkgconfig/nlohmann_json.pc +0 -4
  109. mqt_core-3.0.2.dist-info/DELVEWHEEL +0 -2
  110. {mqt_core-3.0.2.dist-info → mqt_core-3.2.0.dist-info}/entry_points.txt +0 -0
  111. {mqt_core-3.0.2.dist-info → mqt_core-3.2.0.dist-info}/licenses/LICENSE.md +0 -0
@@ -0,0 +1,143 @@
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
+ #include "dd/Node.hpp"
14
+ #include "dd/Package.hpp"
15
+
16
+ #include <cstddef>
17
+ #include <cstdint>
18
+ #include <vector>
19
+
20
+ namespace dd {
21
+ /**
22
+ * @brief Construct the all-zero state \f$|0...0\rangle\f$
23
+ * @param n The number of qubits.
24
+ * @param dd The DD package to use for making the vector DD.
25
+ * @param start The starting qubit index. Default is 0.
26
+ * @throws `std::invalid_argument`, if `dd.qubits() < n`.
27
+ * @return A vector DD for the all-zero state.
28
+ */
29
+ VectorDD makeZeroState(std::size_t n, Package& dd, std::size_t start = 0);
30
+
31
+ /**
32
+ * @brief Construct a computational basis state \f$|b_{n-1}...b_0\rangle\f$
33
+ * @param n The number of qubits.
34
+ * @param state The state to construct.
35
+ * @param dd The DD package to use for making the vector DD.
36
+ * @param start The starting qubit index. Default is 0.
37
+ * @throws `std::invalid_argument`, if `dd.qubits() < n` or `size(state) < n`.
38
+ * @return A vector DD for the computational basis state.
39
+ */
40
+ VectorDD makeBasisState(std::size_t n, const std::vector<bool>& state,
41
+ Package& dd, std::size_t start = 0);
42
+
43
+ /**
44
+ * @brief Construct a product state out of
45
+ * \f$\{0, 1, +, -, R, L\}^{\otimes n}\f$.
46
+ * @param n The number of qubits
47
+ * @param state The state to construct.
48
+ * @param dd The DD package to use for making the vector DD.
49
+ * @param start The starting qubit index. Default is 0.
50
+ * @throws `std::invalid_argument`, if `dd.qubits() < n` or `size(state) < n`.
51
+ * @return A vector DD for the product state.
52
+ */
53
+ VectorDD makeBasisState(std::size_t n, const std::vector<BasisStates>& state,
54
+ Package& dd, std::size_t start = 0);
55
+
56
+ /**
57
+ * @brief Construct a GHZ state \f$|0...0\rangle + |1...1\rangle\f$.
58
+ * @param n The number of qubits.
59
+ * @param dd The DD package to use for making the vector DD.
60
+ * @throws `std::invalid_argument`, if `dd.qubits() < n`.
61
+ * @return A vector DD for the GHZ state.
62
+ */
63
+ VectorDD makeGHZState(std::size_t n, Package& dd);
64
+
65
+ /**
66
+ * @brief Construct a W state.
67
+ * @details The W state is defined as
68
+ * \f[
69
+ * |0...01\rangle + |0...10\rangle + |10...0\rangle
70
+ * \f]
71
+ * @param n The number of qubits.
72
+ * @param dd The DD package to use for making the vector DD.
73
+ * @throws `std::invalid_argument`, if `dd.qubits() < n` or the number of qubits
74
+ * and currently set tolerance would lead to an underflow.
75
+ * @return A vector DD for the W state.
76
+ */
77
+ VectorDD makeWState(std::size_t n, Package& dd);
78
+
79
+ /**
80
+ * @brief Construct a decision diagram from an arbitrary state vector.
81
+ * @param vec The state vector to convert to a DD.
82
+ * @param dd The DD package to use for making the vector DD.
83
+ * @throws `std::invalid_argument`, if `vec.size()` is not a power of two or
84
+ * `dd.qubits() < log2(vec.size()) - 1`.
85
+ * @return A vector DD representing the state.
86
+ */
87
+ VectorDD makeStateFromVector(const CVec& vec, Package& dd);
88
+
89
+ /// @brief The strategy to wire two layers.
90
+ enum GenerationWireStrategy : std::uint8_t {
91
+ ROUNDROBIN, // Choose nodes in the next layer in a round-robin fashion.
92
+ RANDOM // Randomly choose nodes in the next layer.
93
+ };
94
+
95
+ /**
96
+ * @brief Generate exponentially large vector DD.
97
+ * @param levels The number of levels in the vector DD.
98
+ * @param dd The DD package to use for generating the vector DD.
99
+ * @throws `std::invalid_argument`, if `dd.qubits() < levels`.
100
+ * @return The exponentially large vector DD.
101
+ */
102
+ VectorDD generateExponentialState(std::size_t levels, Package& dd);
103
+
104
+ /**
105
+ * @brief Generate exponentially large vector DD. Use @p seed for randomization.
106
+ * @param levels The number of levels in the vector DD.
107
+ * @param dd The DD package to use for generating the vector DD.
108
+ * @param seed The seed used for randomization.
109
+ * @throws `std::invalid_argument`, if `dd.qubits() < levels`.
110
+ * @return The exponentially large vector DD.
111
+ */
112
+ VectorDD generateExponentialState(std::size_t levels, Package& dd,
113
+ std::size_t seed);
114
+
115
+ /**
116
+ * @brief Generate random vector DD.
117
+ * @param levels The number of levels in the vector DD.
118
+ * @param nodesPerLevel The number of nodes per level.
119
+ * @param strategy The strategy to wire two layers.
120
+ * @param dd The DD package to use for generating the vector DD.
121
+ * @throws `std::invalid_argument`, if `dd.qubits() < levels`.
122
+ * @return The random vector DD.
123
+ */
124
+ VectorDD generateRandomState(std::size_t levels,
125
+ const std::vector<std::size_t>& nodesPerLevel,
126
+ GenerationWireStrategy strategy, Package& dd);
127
+
128
+ /**
129
+ * @brief Generate random vector DD. Use @p seed for randomization.
130
+ * @param levels The number of levels in the vector DD.
131
+ * @param nodesPerLevel The number of nodes per level.
132
+ * @param strategy The strategy to wire two layers.
133
+ * @param dd The DD package to use for generating the vector DD.
134
+ * @param seed The seed used for randomization.
135
+ * @throws `std::invalid_argument`, if `dd.qubits() < levels`, `levels <= 0`, or
136
+ * `nodesPerLevel.size() != levels`.
137
+ * @return The random vector DD.
138
+ */
139
+ VectorDD generateRandomState(std::size_t levels,
140
+ const std::vector<std::size_t>& nodesPerLevel,
141
+ GenerationWireStrategy strategy, Package& dd,
142
+ std::size_t seed);
143
+ }; // namespace dd
@@ -29,11 +29,13 @@ namespace dd {
29
29
  * @tparam OperandType type of the operation's operand
30
30
  * @tparam ResultType type of the operation's result
31
31
  */
32
- template <class OperandType, class ResultType, std::size_t NBUCKET = 32768>
33
- class UnaryComputeTable {
32
+ template <class OperandType, class ResultType> class UnaryComputeTable {
34
33
  public:
34
+ /// Default number of buckets for the compute table
35
+ static constexpr std::size_t DEFAULT_NUM_BUCKETS = 32768U;
36
+
35
37
  /// Default constructor
36
- explicit UnaryComputeTable(const size_t numBuckets = 32768U) {
38
+ explicit UnaryComputeTable(const size_t numBuckets = DEFAULT_NUM_BUCKETS) {
37
39
  // numBuckets must be a power of two
38
40
  if ((numBuckets & (numBuckets - 1)) != 0) {
39
41
  throw std::invalid_argument("Number of buckets must be a power of two.");
@@ -106,7 +108,7 @@ public:
106
108
  * @brief Clear the compute table
107
109
  * @details Sets all entries to invalid.
108
110
  */
109
- void clear() { valid = std::vector(NBUCKET, false); }
111
+ void clear() { valid = std::vector(stats.numBuckets, false); }
110
112
 
111
113
  private:
112
114
  /// The actual table storing the entries
@@ -96,10 +96,8 @@ public:
96
96
  }
97
97
  }
98
98
 
99
- // lookup a node in the unique table for the appropriate variable; insert it,
100
- // if it has not been found NOTE: reference counting is to be adjusted by
101
- // function invoking the table lookup and only normalized nodes shall be
102
- // stored.
99
+ // Lookup a node in the unique table for the appropriate variable and insert
100
+ // it if it has not been found. Only normalized nodes shall be stored.
103
101
  template <class Node> [[nodiscard]] Node* lookup(Node* p) {
104
102
  static_assert(std::is_base_of_v<NodeBase, Node>,
105
103
  "Node must be derived from NodeBase");
@@ -144,42 +142,19 @@ public:
144
142
  /// Get the total number of entries
145
143
  [[nodiscard]] std::size_t getNumEntries() const noexcept;
146
144
 
147
- /// Get the total number of active entries
148
- [[nodiscard]] std::size_t getNumActiveEntries() const noexcept;
145
+ /// Count the number of marked entries
146
+ [[nodiscard]] std::size_t countMarkedEntries() const noexcept;
149
147
 
150
- /// Get the peak total number of active entries
151
- [[nodiscard]] std::size_t getPeakNumActiveEntries() const noexcept;
152
-
153
- /**
154
- * @brief Increment the reference count of a node.
155
- * @details This is a pass-through function that calls the increment function
156
- * of the node. It additionally keeps track of the number of active entries
157
- * in the table (entries with a reference count greater than zero). Reference
158
- * counts saturate at the maximum value of RefCount.
159
- * @param p A pointer to the node to increase the reference count of.
160
- * @returns Whether the reference count was increased.
161
- * @see Node::incRef(Node*)
162
- */
163
- [[nodiscard]] bool incRef(NodeBase* p) noexcept;
164
148
  /**
165
- * @brief Decrement the reference count of a node.
166
- * @details This is a pass-through function that calls the decrement function
167
- * of the node. It additionally keeps track of the number of active entries
168
- * in the table (entries with a reference count greater than zero). Reference
169
- * counts saturate at the maximum value of RefCount.
170
- * @param p A pointer to the node to decrease the reference count of.
171
- * @returns Whether the reference count was decreased.
172
- * @see Node::decRef(Node*)
149
+ * @brief Determine whether the table possibly requires garbage collection.
173
150
  */
174
- [[nodiscard]] bool decRef(NodeBase* p) noexcept;
175
-
176
151
  [[nodiscard]] bool possiblyNeedsCollection() const;
177
152
 
178
153
  std::size_t garbageCollect(bool force = false);
179
154
 
180
155
  void clear();
181
156
 
182
- template <class Node> void print() {
157
+ template <class Node> void print() const {
183
158
  static_assert(std::is_base_of_v<NodeBase, Node>,
184
159
  "Node must be derived from NodeBase");
185
160
  auto q = cfg.nVars - 1U;
@@ -194,8 +169,8 @@ public:
194
169
  }
195
170
 
196
171
  while (p != nullptr) {
197
- std::cout << "\t\t" << std::hex << reinterpret_cast<std::uintptr_t>(p)
198
- << std::dec << " " << p->ref << std::hex;
172
+ std::cout << "\t\t" << std::hex
173
+ << reinterpret_cast<std::uintptr_t>(p);
199
174
  for (const auto& e : p->e) {
200
175
  std::cout << " p" << reinterpret_cast<std::uintptr_t>(e.p) << "(r"
201
176
  << reinterpret_cast<std::uintptr_t>(e.w.r) << " i"
@@ -235,12 +210,11 @@ private:
235
210
  std::vector<UniqueTableStatistics> stats;
236
211
 
237
212
  /**
238
- Searches for a node in the hash table with the given key.
239
- @param p The node to search for.
240
- @param key The hashed value used to search the table.
241
- @return The Edge<Node> found in the hash table or Edge<Node>::zero if not
242
- found.
243
- **/
213
+ * @brief Search for a node in the hash table with the given key.
214
+ * @param p The node to search for.
215
+ * @param key The hashed value used to search the table.
216
+ * @returns A pointer to the node if found or Node::getTerminal() otherwise.
217
+ */
244
218
  template <class Node>
245
219
  [[nodiscard]] Node* searchTable(Node& p, const std::size_t& key) {
246
220
  static_assert(std::is_base_of_v<NodeBase, Node>,
@@ -20,13 +20,14 @@ namespace dd {
20
20
 
21
21
  /**
22
22
  * @brief Computes an estimate for the memory usage of active DDs.
23
- * @details The estimate is based on the number of active entries in the
24
- * respective unique tables. It accounts for the memory used by DD nodes, DD
25
- * edges, and real numbers.
23
+ * @details The estimate is based on the number of active entries which are
24
+ * computed by temporarily marking all nodes reachable from the current root
25
+ * set and subsequently counting them in the unique tables. It accounts for the
26
+ * memory used by DD nodes, DD edges, and real numbers.
26
27
  * @param package The package instance
27
28
  * @return The estimated memory usage in MiB
28
29
  */
29
- [[nodiscard]] double computeActiveMemoryMiB(const Package& package);
30
+ [[nodiscard]] double computeActiveMemoryMiB(Package& package);
30
31
 
31
32
  /**
32
33
  * @brief Computes an estimate for the peak memory usage of DDs.
@@ -39,7 +40,7 @@ namespace dd {
39
40
  [[nodiscard]] double computePeakMemoryMiB(const Package& package);
40
41
 
41
42
  [[nodiscard]] nlohmann::basic_json<>
42
- getStatistics(const Package& package, bool includeIndividualTables = false);
43
+ getStatistics(Package& package, bool includeIndividualTables = false);
43
44
 
44
45
  /**
45
46
  * @brief Get some key statistics about data structures used by the DD package
@@ -47,8 +48,8 @@ getStatistics(const Package& package, bool includeIndividualTables = false);
47
48
  */
48
49
  [[nodiscard]] nlohmann::basic_json<> getDataStructureStatistics();
49
50
 
50
- [[nodiscard]] std::string getStatisticsString(const Package& package);
51
+ [[nodiscard]] std::string getStatisticsString(Package& package);
51
52
 
52
- void printStatistics(const Package& package, std::ostream& os = std::cout);
53
+ void printStatistics(Package& package, std::ostream& os = std::cout);
53
54
 
54
55
  } // namespace dd
@@ -18,19 +18,9 @@
18
18
  namespace dd {
19
19
  /// \brief A class for storing statistics of a unique table
20
20
  struct UniqueTableStatistics : public TableStatistics {
21
- /**
22
- * @brief The total number of active entries
23
- * @details An entry is considered active if it has a non-zero reference count
24
- */
25
- std::size_t numActiveEntries = 0U;
26
- /// The peak number of active entries in the table
27
- std::size_t peakNumActiveEntries = 0U;
28
21
  /// The number of garbage collection runs
29
22
  std::size_t gcRuns = 0U;
30
23
 
31
- /// Track a new active entry
32
- void trackActiveEntry() noexcept;
33
-
34
24
  /// Reset all statistics (except for the peak values)
35
25
  void reset() noexcept override;
36
26
 
@@ -124,6 +124,9 @@ public:
124
124
  [[nodiscard]] decltype(mt)& getGenerator() noexcept { return mt; }
125
125
 
126
126
  [[nodiscard]] fp getGlobalPhase() const noexcept { return globalPhase; }
127
+ [[nodiscard]] bool hasGlobalPhase() const noexcept {
128
+ return std::abs(getGlobalPhase()) > 0;
129
+ }
127
130
 
128
131
  [[nodiscard]] const std::unordered_set<sym::Variable>&
129
132
  getVariables() const noexcept {
@@ -48,6 +48,8 @@ public:
48
48
 
49
49
  [[nodiscard]] std::unique_ptr<Operation> clone() const override;
50
50
 
51
+ [[nodiscard]] size_t getNqubits() const override;
52
+
51
53
  [[nodiscard]] bool isCompoundOperation() const noexcept override;
52
54
 
53
55
  [[nodiscard]] bool isNonUnitaryOperation() const override;
@@ -210,7 +210,7 @@ public:
210
210
  */
211
211
  [[nodiscard]] bool
212
212
  totalAssignment(const VariableAssignment& assignment) const {
213
- return assignment.find(getVar()) != assignment.end();
213
+ return assignment.contains(getVar());
214
214
  }
215
215
 
216
216
  /**
@@ -68,8 +68,8 @@ public:
68
68
  [[nodiscard]] virtual std::size_t getNcontrols() const {
69
69
  return controls.size();
70
70
  }
71
- [[nodiscard]] std::size_t getNqubits() const {
72
- return getUsedQubits().size();
71
+ [[nodiscard]] virtual std::size_t getNqubits() const {
72
+ return getNcontrols() + getNtargets();
73
73
  }
74
74
 
75
75
  [[nodiscard]] const std::vector<fp>& getParameter() const {