mqt-core 3.0.1__cp39-cp39-win_amd64.whl → 3.1.0__cp39-cp39-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.
- mqt/core/__init__.py +5 -5
- mqt/core/_version.py +2 -2
- mqt/core/bin/mqt-core-algorithms.dll +0 -0
- mqt/core/bin/mqt-core-circuit-optimizer.dll +0 -0
- mqt/core/bin/mqt-core-dd.dll +0 -0
- mqt/core/bin/mqt-core-ds.dll +0 -0
- mqt/core/bin/mqt-core-ir.dll +0 -0
- mqt/core/bin/mqt-core-na.dll +0 -0
- mqt/core/bin/mqt-core-qasm.dll +0 -0
- mqt/core/bin/mqt-core-zx.dll +0 -0
- mqt/core/dd.cp39-win_amd64.pyd +0 -0
- mqt/core/include/mqt-core/dd/Approximation.hpp +45 -0
- mqt/core/include/mqt-core/dd/Complex.hpp +6 -0
- mqt/core/include/mqt-core/dd/ComplexNumbers.hpp +0 -18
- mqt/core/include/mqt-core/dd/ComputeTable.hpp +4 -1
- mqt/core/include/mqt-core/dd/DDDefinitions.hpp +0 -7
- mqt/core/include/mqt-core/dd/Edge.hpp +16 -0
- mqt/core/include/mqt-core/dd/Export.hpp +1 -2
- mqt/core/include/mqt-core/dd/Node.hpp +26 -49
- mqt/core/include/mqt-core/dd/Operations.hpp +27 -0
- mqt/core/include/mqt-core/dd/Package.hpp +138 -120
- mqt/core/include/mqt-core/dd/RealNumber.hpp +49 -66
- mqt/core/include/mqt-core/dd/RealNumberUniqueTable.hpp +14 -25
- mqt/core/include/mqt-core/dd/StateGeneration.hpp +143 -0
- mqt/core/include/mqt-core/dd/UnaryComputeTable.hpp +6 -4
- mqt/core/include/mqt-core/dd/UniqueTable.hpp +13 -39
- mqt/core/include/mqt-core/dd/statistics/PackageStatistics.hpp +8 -7
- mqt/core/include/mqt-core/dd/statistics/UniqueTableStatistics.hpp +0 -10
- mqt/core/include/mqt-core/ir/QuantumComputation.hpp +3 -0
- mqt/core/include/mqt-core/ir/operations/CompoundOperation.hpp +2 -0
- mqt/core/include/mqt-core/ir/operations/Operation.hpp +2 -2
- mqt/core/ir.cp39-win_amd64.pyd +0 -0
- mqt/core/lib/mqt-core-algorithms.lib +0 -0
- mqt/core/lib/mqt-core-circuit-optimizer.lib +0 -0
- mqt/core/lib/mqt-core-dd.lib +0 -0
- mqt/core/lib/mqt-core-ds.lib +0 -0
- mqt/core/lib/mqt-core-ir.lib +0 -0
- mqt/core/lib/mqt-core-na.lib +0 -0
- mqt/core/lib/mqt-core-qasm.lib +0 -0
- mqt/core/lib/mqt-core-zx.lib +0 -0
- mqt/core/plugins/__init__.py +0 -8
- mqt/core/plugins/qiskit/qiskit_to_mqt.py +6 -0
- mqt/core/share/cmake/mqt-core/AddMQTPythonBinding.cmake +52 -0
- mqt/core/share/cmake/mqt-core/PackageAddTest.cmake +4 -4
- mqt/core/share/cmake/mqt-core/mqt-core-config-version.cmake +3 -3
- mqt/core/share/cmake/mqt-core/mqt-core-config.cmake +1 -0
- mqt/core/share/cmake/mqt-core/mqt-core-targets.cmake +1 -1
- mqt_core-3.1.0.dist-info/DELVEWHEEL +2 -0
- {mqt_core-3.0.1.dist-info → mqt_core-3.1.0.dist-info}/METADATA +54 -9
- {mqt_core-3.0.1.dist-info → mqt_core-3.1.0.dist-info}/RECORD +55 -102
- {mqt_core-3.0.1.dist-info → mqt_core-3.1.0.dist-info}/WHEEL +1 -1
- mqt_core.libs/msvcp140.dll +0 -0
- mqt/core/include/nlohmann/adl_serializer.hpp +0 -55
- mqt/core/include/nlohmann/byte_container_with_subtype.hpp +0 -103
- mqt/core/include/nlohmann/detail/abi_macros.hpp +0 -100
- mqt/core/include/nlohmann/detail/conversions/from_json.hpp +0 -497
- mqt/core/include/nlohmann/detail/conversions/to_chars.hpp +0 -1118
- mqt/core/include/nlohmann/detail/conversions/to_json.hpp +0 -446
- mqt/core/include/nlohmann/detail/exceptions.hpp +0 -257
- mqt/core/include/nlohmann/detail/hash.hpp +0 -129
- mqt/core/include/nlohmann/detail/input/binary_reader.hpp +0 -3009
- mqt/core/include/nlohmann/detail/input/input_adapters.hpp +0 -492
- mqt/core/include/nlohmann/detail/input/json_sax.hpp +0 -727
- mqt/core/include/nlohmann/detail/input/lexer.hpp +0 -1633
- mqt/core/include/nlohmann/detail/input/parser.hpp +0 -519
- mqt/core/include/nlohmann/detail/input/position_t.hpp +0 -37
- mqt/core/include/nlohmann/detail/iterators/internal_iterator.hpp +0 -35
- mqt/core/include/nlohmann/detail/iterators/iter_impl.hpp +0 -751
- mqt/core/include/nlohmann/detail/iterators/iteration_proxy.hpp +0 -242
- mqt/core/include/nlohmann/detail/iterators/iterator_traits.hpp +0 -61
- mqt/core/include/nlohmann/detail/iterators/json_reverse_iterator.hpp +0 -130
- mqt/core/include/nlohmann/detail/iterators/primitive_iterator.hpp +0 -132
- mqt/core/include/nlohmann/detail/json_custom_base_class.hpp +0 -39
- mqt/core/include/nlohmann/detail/json_pointer.hpp +0 -988
- mqt/core/include/nlohmann/detail/json_ref.hpp +0 -78
- mqt/core/include/nlohmann/detail/macro_scope.hpp +0 -482
- mqt/core/include/nlohmann/detail/macro_unscope.hpp +0 -45
- mqt/core/include/nlohmann/detail/meta/call_std/begin.hpp +0 -17
- mqt/core/include/nlohmann/detail/meta/call_std/end.hpp +0 -17
- mqt/core/include/nlohmann/detail/meta/cpp_future.hpp +0 -171
- mqt/core/include/nlohmann/detail/meta/detected.hpp +0 -70
- mqt/core/include/nlohmann/detail/meta/identity_tag.hpp +0 -21
- mqt/core/include/nlohmann/detail/meta/is_sax.hpp +0 -159
- mqt/core/include/nlohmann/detail/meta/std_fs.hpp +0 -29
- mqt/core/include/nlohmann/detail/meta/type_traits.hpp +0 -795
- mqt/core/include/nlohmann/detail/meta/void_t.hpp +0 -24
- mqt/core/include/nlohmann/detail/output/binary_writer.hpp +0 -1838
- mqt/core/include/nlohmann/detail/output/output_adapters.hpp +0 -147
- mqt/core/include/nlohmann/detail/output/serializer.hpp +0 -988
- mqt/core/include/nlohmann/detail/string_concat.hpp +0 -146
- mqt/core/include/nlohmann/detail/string_escape.hpp +0 -72
- mqt/core/include/nlohmann/detail/value_t.hpp +0 -118
- mqt/core/include/nlohmann/json.hpp +0 -5258
- mqt/core/include/nlohmann/json_fwd.hpp +0 -75
- mqt/core/include/nlohmann/ordered_map.hpp +0 -359
- mqt/core/include/nlohmann/thirdparty/hedley/hedley.hpp +0 -2045
- mqt/core/include/nlohmann/thirdparty/hedley/hedley_undef.hpp +0 -158
- mqt/core/nlohmann_json.natvis +0 -278
- mqt/core/share/cmake/nlohmann_json/nlohmann_jsonConfig.cmake +0 -15
- mqt/core/share/cmake/nlohmann_json/nlohmann_jsonConfigVersion.cmake +0 -20
- mqt/core/share/cmake/nlohmann_json/nlohmann_jsonTargets.cmake +0 -110
- mqt/core/share/pkgconfig/nlohmann_json.pc +0 -4
- mqt_core-3.0.1.dist-info/DELVEWHEEL +0 -2
- {mqt_core-3.0.1.dist-info → mqt_core-3.1.0.dist-info}/entry_points.txt +0 -0
- {mqt_core-3.0.1.dist-info → mqt_core-3.1.0.dist-info}/licenses/LICENSE.md +0 -0
- /mqt_core.libs/{.load-order-mqt_core-3.0.1 → .load-order-mqt_core-3.1.0} +0 -0
mqt/core/__init__.py
CHANGED
|
@@ -12,7 +12,7 @@ from __future__ import annotations
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
# start delvewheel patch
|
|
15
|
-
def
|
|
15
|
+
def _delvewheel_patch_1_10_1():
|
|
16
16
|
import ctypes
|
|
17
17
|
import os
|
|
18
18
|
import platform
|
|
@@ -23,10 +23,10 @@ def _delvewheel_patch_1_10_0():
|
|
|
23
23
|
if os.path.isdir(libs_dir):
|
|
24
24
|
os.add_dll_directory(libs_dir)
|
|
25
25
|
else:
|
|
26
|
-
load_order_filepath = os.path.join(libs_dir, '.load-order-mqt_core-3.0
|
|
26
|
+
load_order_filepath = os.path.join(libs_dir, '.load-order-mqt_core-3.1.0')
|
|
27
27
|
if os.path.isfile(load_order_filepath):
|
|
28
28
|
import ctypes.wintypes
|
|
29
|
-
with open(os.path.join(libs_dir, '.load-order-mqt_core-3.0
|
|
29
|
+
with open(os.path.join(libs_dir, '.load-order-mqt_core-3.1.0')) as file:
|
|
30
30
|
load_order = file.read().split()
|
|
31
31
|
kernel32 = ctypes.WinDLL('kernel32', use_last_error=True)
|
|
32
32
|
kernel32.LoadLibraryExW.restype = ctypes.wintypes.HMODULE
|
|
@@ -37,8 +37,8 @@ def _delvewheel_patch_1_10_0():
|
|
|
37
37
|
raise OSError('Error loading {}; {}'.format(lib, ctypes.FormatError(ctypes.get_last_error())))
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
del
|
|
40
|
+
_delvewheel_patch_1_10_1()
|
|
41
|
+
del _delvewheel_patch_1_10_1
|
|
42
42
|
# end delvewheel patch
|
|
43
43
|
|
|
44
44
|
import os
|
mqt/core/_version.py
CHANGED
|
Binary file
|
|
Binary file
|
mqt/core/bin/mqt-core-dd.dll
CHANGED
|
Binary file
|
mqt/core/bin/mqt-core-ds.dll
CHANGED
|
Binary file
|
mqt/core/bin/mqt-core-ir.dll
CHANGED
|
Binary file
|
mqt/core/bin/mqt-core-na.dll
CHANGED
|
Binary file
|
mqt/core/bin/mqt-core-qasm.dll
CHANGED
|
Binary file
|
mqt/core/bin/mqt-core-zx.dll
CHANGED
|
Binary file
|
mqt/core/dd.cp39-win_amd64.pyd
CHANGED
|
Binary file
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
namespace dd {
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @brief Useful metadata of an approximation run.
|
|
20
|
+
*/
|
|
21
|
+
struct ApproximationMetadata {
|
|
22
|
+
/// @brief The fidelity between the source and the approximated state.
|
|
23
|
+
double fidelity;
|
|
24
|
+
/// @brief The number of nodes visited during the mark stage.
|
|
25
|
+
std::size_t nodesVisited;
|
|
26
|
+
/// @brief The lowest qubit number that requires rebuilding.
|
|
27
|
+
Qubit min;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @brief Approximate the @p state based on fidelity. The fidelity of the
|
|
32
|
+
* approximated state will be at least @p fidelity.
|
|
33
|
+
* @details Traverses the decision diagram layer by layer in a breadth-first
|
|
34
|
+
* manner (iterative deepening algorithm) and eliminates edges greedily until
|
|
35
|
+
* the budget (1 - @p fidelity) is exhausted.
|
|
36
|
+
*
|
|
37
|
+
* @param state The DD to approximate.
|
|
38
|
+
* @param fidelity The desired minimum fidelity after approximation.
|
|
39
|
+
* @param dd The DD package to use for the approximation.
|
|
40
|
+
* @return Metadata about the approximation.
|
|
41
|
+
*/
|
|
42
|
+
ApproximationMetadata approximate(VectorDD& state, double fidelity,
|
|
43
|
+
Package& dd);
|
|
44
|
+
|
|
45
|
+
} // namespace dd
|
|
@@ -88,6 +88,12 @@ struct Complex {
|
|
|
88
88
|
*/
|
|
89
89
|
[[nodiscard]] bool approximatelyZero() const noexcept;
|
|
90
90
|
|
|
91
|
+
/// @brief Mark the complex number as used.
|
|
92
|
+
void mark() const noexcept;
|
|
93
|
+
|
|
94
|
+
/// @brief Unmark the complex number.
|
|
95
|
+
void unmark() const noexcept;
|
|
96
|
+
|
|
91
97
|
/**
|
|
92
98
|
* @brief Convert the complex number to a string.
|
|
93
99
|
* @param formatted Whether to apply special formatting to the numbers.
|
|
@@ -128,24 +128,6 @@ public:
|
|
|
128
128
|
return e;
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
/**
|
|
132
|
-
* @brief Increment the reference count of a complex number.
|
|
133
|
-
* @details This is a pass-through function that increments the reference
|
|
134
|
-
* count of the real and imaginary parts of the given complex number.
|
|
135
|
-
* @param c The complex number
|
|
136
|
-
* @see RealNumberUniqueTable::incRef(RealNumber*)
|
|
137
|
-
*/
|
|
138
|
-
void incRef(const Complex& c) const noexcept;
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* @brief Decrement the reference count of a complex number.
|
|
142
|
-
* @details This is a pass-through function that decrements the reference
|
|
143
|
-
* count of the real and imaginary parts of the given complex number.
|
|
144
|
-
* @param c The complex number
|
|
145
|
-
* @see RealNumberUniqueTable::decRef(RealNumber*)
|
|
146
|
-
*/
|
|
147
|
-
void decRef(const Complex& c) const noexcept;
|
|
148
|
-
|
|
149
131
|
/**
|
|
150
132
|
* @brief Check whether a complex number is one of the static ones.
|
|
151
133
|
* @param c The complex number.
|
|
@@ -36,11 +36,14 @@ namespace dd {
|
|
|
36
36
|
template <class LeftOperandType, class RightOperandType, class ResultType>
|
|
37
37
|
class ComputeTable {
|
|
38
38
|
public:
|
|
39
|
+
/// Default number of buckets for the compute table
|
|
40
|
+
static constexpr std::size_t DEFAULT_NUM_BUCKETS = 16384U;
|
|
41
|
+
|
|
39
42
|
/**
|
|
40
43
|
* Default constructor
|
|
41
44
|
* @param numBuckets Number of hash table buckets. Must be a power of two.
|
|
42
45
|
*/
|
|
43
|
-
explicit ComputeTable(const size_t numBuckets =
|
|
46
|
+
explicit ComputeTable(const size_t numBuckets = DEFAULT_NUM_BUCKETS) {
|
|
44
47
|
// numBuckets must be a power of two
|
|
45
48
|
if ((numBuckets & (numBuckets - 1)) != 0) {
|
|
46
49
|
throw std::invalid_argument("Number of buckets must be a power of two.");
|
|
@@ -32,13 +32,6 @@ namespace dd {
|
|
|
32
32
|
*/
|
|
33
33
|
using Qubit = std::uint16_t;
|
|
34
34
|
|
|
35
|
-
/**
|
|
36
|
-
* @brief Integer type used for reference counting
|
|
37
|
-
* @details Allows a maximum reference count of roughly 4 billion.
|
|
38
|
-
*/
|
|
39
|
-
using RefCount = std::uint32_t;
|
|
40
|
-
static_assert(std::is_unsigned_v<RefCount>, "RefCount should be unsigned.");
|
|
41
|
-
|
|
42
35
|
/**
|
|
43
36
|
* @brief Floating point type to use for computations
|
|
44
37
|
* @note Adjusting the precision might lead to unexpected results.
|
|
@@ -88,6 +88,16 @@ template <class Node> struct Edge {
|
|
|
88
88
|
return Edge{Node::getTerminal(), w};
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
/**
|
|
92
|
+
* @brief Check whether an edge requires tracking.
|
|
93
|
+
* @param e The edge to check.
|
|
94
|
+
* @return Whether the edge requires tracking.
|
|
95
|
+
*/
|
|
96
|
+
[[nodiscard]] static constexpr bool trackingRequired(const Edge& e) {
|
|
97
|
+
return !e.isTerminal() || !constants::isStaticNumber(e.w.r) ||
|
|
98
|
+
!constants::isStaticNumber(e.w.i);
|
|
99
|
+
}
|
|
100
|
+
|
|
91
101
|
/**
|
|
92
102
|
* @brief Check whether this is a terminal
|
|
93
103
|
* @return whether this is a terminal
|
|
@@ -131,6 +141,12 @@ template <class Node> struct Edge {
|
|
|
131
141
|
*/
|
|
132
142
|
[[nodiscard]] std::size_t size() const;
|
|
133
143
|
|
|
144
|
+
/// @brief Mark the edge as used.
|
|
145
|
+
void mark() const noexcept;
|
|
146
|
+
|
|
147
|
+
/// @brief Unmark the edge.
|
|
148
|
+
void unmark() const noexcept;
|
|
149
|
+
|
|
134
150
|
private:
|
|
135
151
|
/**
|
|
136
152
|
* @brief Recursively traverse the DD and count the number of nodes
|
|
@@ -163,8 +163,7 @@ static std::ostream& memoryNode(const Edge<Node>& e, std::ostream& os) {
|
|
|
163
163
|
os << nodelabel << "[label=<";
|
|
164
164
|
os << R"(<font point-size="10"><table border="1" cellspacing="0" cellpadding="2" style="rounded">)";
|
|
165
165
|
os << R"(<tr><td colspan=")" << n << R"(" border="1" sides="B">)" << std::hex
|
|
166
|
-
<< reinterpret_cast<std::uintptr_t>(e.p) << std::dec
|
|
167
|
-
<< " ref: " << e.p->ref << "</td></tr>";
|
|
166
|
+
<< reinterpret_cast<std::uintptr_t>(e.p) << std::dec << "</td></tr>";
|
|
168
167
|
os << "<tr>";
|
|
169
168
|
for (std::size_t i = 0; i < n; ++i) {
|
|
170
169
|
os << "<td port=\"" << i << R"(" href="javascript:;" border="0" tooltip=")"
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
#include <array>
|
|
19
19
|
#include <cassert>
|
|
20
20
|
#include <cstdint>
|
|
21
|
-
#include <limits>
|
|
22
21
|
|
|
23
22
|
namespace dd {
|
|
24
23
|
|
|
@@ -27,11 +26,9 @@ namespace dd {
|
|
|
27
26
|
* @details This class is used to store common information for all DD nodes.
|
|
28
27
|
* The `flags` makes the implicit padding explicit and can be used for storing
|
|
29
28
|
* node properties.
|
|
30
|
-
* Data Layout (8)|(
|
|
29
|
+
* Data Layout (8)|(2|2|4) = 16B.
|
|
31
30
|
*/
|
|
32
31
|
struct NodeBase : LLBase {
|
|
33
|
-
/// Reference count
|
|
34
|
-
RefCount ref = 0;
|
|
35
32
|
/// Variable index
|
|
36
33
|
Qubit v{};
|
|
37
34
|
|
|
@@ -40,13 +37,28 @@ struct NodeBase : LLBase {
|
|
|
40
37
|
* @details Not required for all node types, but padding is required either
|
|
41
38
|
* way.
|
|
42
39
|
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
40
|
+
* 0b10000 = mark flag used for mark-and-sweep garbage collection,
|
|
41
|
+
* 0b1000 = marks a reduced dm node,
|
|
42
|
+
* 0b100 = marks a dm (tmp flag),
|
|
43
|
+
* 0b10 = mark first path edge (tmp flag),
|
|
44
|
+
* 0b1 = mark path is conjugated (tmp flag)
|
|
47
45
|
*/
|
|
48
46
|
std::uint16_t flags = 0;
|
|
49
47
|
|
|
48
|
+
/// Mark flag used for mark-and-sweep garbage collection
|
|
49
|
+
static constexpr std::uint16_t MARK_FLAG = 0b10000U;
|
|
50
|
+
|
|
51
|
+
/// @brief Whether a node is marked as used.
|
|
52
|
+
[[nodiscard]] bool isMarked() const noexcept {
|
|
53
|
+
return (flags & MARK_FLAG) != 0U;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/// @brief Mark the node as used.
|
|
57
|
+
void mark() noexcept { flags |= MARK_FLAG; }
|
|
58
|
+
|
|
59
|
+
/// @brief Unmark the node.
|
|
60
|
+
void unmark() noexcept { flags &= ~MARK_FLAG; }
|
|
61
|
+
|
|
50
62
|
/// Getter for the next object.
|
|
51
63
|
[[nodiscard]] NodeBase* next() const noexcept {
|
|
52
64
|
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast)
|
|
@@ -68,9 +80,12 @@ struct NodeBase : LLBase {
|
|
|
68
80
|
static constexpr NodeBase* getTerminal() noexcept { return nullptr; }
|
|
69
81
|
};
|
|
70
82
|
|
|
83
|
+
static_assert(sizeof(NodeBase) == 16);
|
|
84
|
+
static_assert(alignof(NodeBase) == 8);
|
|
85
|
+
|
|
71
86
|
/**
|
|
72
87
|
* @brief A vector DD node
|
|
73
|
-
* @details Data Layout (8)|(
|
|
88
|
+
* @details Data Layout (8)|(2|2|4)|(24|24) = 64B
|
|
74
89
|
*/
|
|
75
90
|
struct vNode final : NodeBase { // NOLINT(readability-identifier-naming)
|
|
76
91
|
std::array<Edge<vNode>, RADIX> e{}; // edges out of this node
|
|
@@ -89,7 +104,7 @@ using VectorDD = vEdge;
|
|
|
89
104
|
|
|
90
105
|
/**
|
|
91
106
|
* @brief A matrix DD node
|
|
92
|
-
* @details Data Layout (8)|(
|
|
107
|
+
* @details Data Layout (8)|(2|2|4)|(24|24|24|24) = 112B
|
|
93
108
|
*/
|
|
94
109
|
struct mNode final : NodeBase { // NOLINT(readability-identifier-naming)
|
|
95
110
|
std::array<Edge<mNode>, NEDGE> e{}; // edges out of this node
|
|
@@ -108,7 +123,7 @@ using MatrixDD = mEdge;
|
|
|
108
123
|
|
|
109
124
|
/**
|
|
110
125
|
* @brief A density matrix DD node
|
|
111
|
-
* @details Data Layout (8)|(
|
|
126
|
+
* @details Data Layout (8)|(2|2|4)|(24|24|24|24) = 112B
|
|
112
127
|
*/
|
|
113
128
|
struct dNode final : NodeBase { // NOLINT(readability-identifier-naming)
|
|
114
129
|
std::array<Edge<dNode>, NEDGE> e{}; // edges out of this node
|
|
@@ -205,42 +220,4 @@ static inline dEdge densityFromMatrixEdge(const mEdge& e) {
|
|
|
205
220
|
return dEdge{reinterpret_cast<dNode*>(e.p), e.w};
|
|
206
221
|
}
|
|
207
222
|
|
|
208
|
-
/**
|
|
209
|
-
* @brief Increment the reference count of a node.
|
|
210
|
-
* @details This function increments the reference count of a node. If the
|
|
211
|
-
* reference count has saturated (i.e. reached the maximum value of RefCount)
|
|
212
|
-
* the reference count is not incremented.
|
|
213
|
-
* @param p A pointer to the node to increment the reference count of.
|
|
214
|
-
* @returns Whether the reference count was incremented.
|
|
215
|
-
* @note Typically, you do not want to call this function directly. Instead,
|
|
216
|
-
* use the UniqueTable::incRef(Node*) function.
|
|
217
|
-
*/
|
|
218
|
-
[[nodiscard]] static constexpr bool incRef(NodeBase* p) noexcept {
|
|
219
|
-
if (p == nullptr || p->ref == std::numeric_limits<RefCount>::max()) {
|
|
220
|
-
return false;
|
|
221
|
-
}
|
|
222
|
-
++p->ref;
|
|
223
|
-
return true;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* @brief Decrement the reference count of a node.
|
|
228
|
-
* @details This function decrements the reference count of a node. If the
|
|
229
|
-
* reference count has saturated (i.e. reached the maximum value of RefCount)
|
|
230
|
-
* the reference count is not decremented.
|
|
231
|
-
* @param p A pointer to the node to decrement the reference count of.
|
|
232
|
-
* @returns Whether the reference count was decremented.
|
|
233
|
-
* @note Typically, you do not want to call this function directly. Instead,
|
|
234
|
-
* use the UniqueTable::decRef(Node*) function.
|
|
235
|
-
*/
|
|
236
|
-
[[nodiscard]] static constexpr bool decRef(NodeBase* p) noexcept {
|
|
237
|
-
if (p == nullptr || p->ref == std::numeric_limits<RefCount>::max()) {
|
|
238
|
-
return false;
|
|
239
|
-
}
|
|
240
|
-
assert(p->ref != 0 &&
|
|
241
|
-
"Reference count of Node must not be zero before decrement");
|
|
242
|
-
--p->ref;
|
|
243
|
-
return true;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
223
|
} // namespace dd
|
|
@@ -204,6 +204,33 @@ applyClassicControlledOperation(const qc::ClassicControlledOperation& op,
|
|
|
204
204
|
const std::vector<bool>& measurements,
|
|
205
205
|
const qc::Permutation& permutation = {});
|
|
206
206
|
|
|
207
|
+
/**
|
|
208
|
+
* @brief Check whether @p op is virtually executable.
|
|
209
|
+
*
|
|
210
|
+
* @param op The operation in question.
|
|
211
|
+
* @return Whether @p op is virtually executable.
|
|
212
|
+
*/
|
|
213
|
+
bool isExecutableVirtually(const qc::Operation& op) noexcept;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* @brief Apply virtual operation @p op.
|
|
217
|
+
*
|
|
218
|
+
* @param op The virtual operation to apply.
|
|
219
|
+
* @param permutation If suitable, the to be updated permutation.
|
|
220
|
+
*/
|
|
221
|
+
void applyVirtualOperation(const qc::Operation& op,
|
|
222
|
+
qc::Permutation& permutation) noexcept;
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* @brief Apply global phase to a given DD.
|
|
226
|
+
*
|
|
227
|
+
* @param in The input DD
|
|
228
|
+
* @param phase The phase to apply
|
|
229
|
+
* @param dd The DD package to use
|
|
230
|
+
* @return The output DD
|
|
231
|
+
*/
|
|
232
|
+
VectorDD applyGlobalPhase(VectorDD& in, const fp& phase, Package& dd);
|
|
233
|
+
|
|
207
234
|
/**
|
|
208
235
|
* @brief Change the permutation of a given DD.
|
|
209
236
|
*
|