mqt-core 3.2.1__cp313-cp313t-win_amd64.whl → 3.3.0__cp313-cp313t-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.
- mqt/core/__init__.py +3 -3
- mqt/core/_commands.py +2 -2
- mqt/core/_version.py +16 -3
- 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-fomac.dll +0 -0
- mqt/core/bin/mqt-core-ir.dll +0 -0
- mqt/core/bin/mqt-core-na-fomac.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-qdmi-driver.dll +0 -0
- mqt/core/bin/mqt-core-qdmi-na-device.dll +0 -0
- mqt/core/bin/mqt-core-zx.dll +0 -0
- mqt/core/dd.cp313t-win_amd64.pyd +0 -0
- mqt/core/dd.pyi +5 -7
- mqt/core/fomac.cp313t-win_amd64.pyd +0 -0
- mqt/core/fomac.pyi +125 -0
- mqt/core/include/mqt-core/circuit_optimizer/CircuitOptimizer.hpp +13 -0
- mqt/core/include/mqt-core/dd/CachedEdge.hpp +7 -0
- mqt/core/include/mqt-core/dd/Operations.hpp +12 -14
- mqt/core/include/mqt-core/fomac/FoMaC.hpp +568 -0
- mqt/core/include/mqt-core/ir/QuantumComputation.hpp +29 -28
- mqt/core/include/mqt-core/ir/operations/CompoundOperation.hpp +2 -0
- mqt/core/include/mqt-core/ir/operations/IfElseOperation.hpp +169 -0
- mqt/core/include/mqt-core/ir/operations/OpType.hpp +3 -0
- mqt/core/include/mqt-core/ir/operations/OpType.inc +2 -2
- mqt/core/include/mqt-core/ir/operations/Operation.hpp +3 -1
- mqt/core/include/mqt-core/ir/operations/StandardOperation.hpp +2 -0
- mqt/core/include/mqt-core/mqt_na_qdmi/device.h +602 -0
- mqt/core/include/mqt-core/mqt_na_qdmi/types.h +78 -0
- mqt/core/include/mqt-core/na/device/Device.hpp +410 -0
- mqt/core/include/mqt-core/na/device/DeviceMemberInitializers.hpp +724 -0
- mqt/core/include/mqt-core/na/device/Generator.hpp +447 -0
- mqt/core/include/mqt-core/na/fomac/Device.hpp +169 -0
- mqt/core/include/mqt-core/qdmi/Driver.hpp +431 -0
- mqt/core/include/nlohmann/adl_serializer.hpp +55 -0
- mqt/core/include/nlohmann/byte_container_with_subtype.hpp +103 -0
- mqt/core/include/nlohmann/detail/abi_macros.hpp +111 -0
- mqt/core/include/nlohmann/detail/conversions/from_json.hpp +577 -0
- mqt/core/include/nlohmann/detail/conversions/to_chars.hpp +1118 -0
- mqt/core/include/nlohmann/detail/conversions/to_json.hpp +479 -0
- mqt/core/include/nlohmann/detail/exceptions.hpp +291 -0
- mqt/core/include/nlohmann/detail/hash.hpp +129 -0
- mqt/core/include/nlohmann/detail/input/binary_reader.hpp +3068 -0
- mqt/core/include/nlohmann/detail/input/input_adapters.hpp +549 -0
- mqt/core/include/nlohmann/detail/input/json_sax.hpp +986 -0
- mqt/core/include/nlohmann/detail/input/lexer.hpp +1643 -0
- mqt/core/include/nlohmann/detail/input/parser.hpp +519 -0
- mqt/core/include/nlohmann/detail/input/position_t.hpp +37 -0
- mqt/core/include/nlohmann/detail/iterators/internal_iterator.hpp +35 -0
- mqt/core/include/nlohmann/detail/iterators/iter_impl.hpp +760 -0
- mqt/core/include/nlohmann/detail/iterators/iteration_proxy.hpp +235 -0
- mqt/core/include/nlohmann/detail/iterators/iterator_traits.hpp +61 -0
- mqt/core/include/nlohmann/detail/iterators/json_reverse_iterator.hpp +130 -0
- mqt/core/include/nlohmann/detail/iterators/primitive_iterator.hpp +132 -0
- mqt/core/include/nlohmann/detail/json_custom_base_class.hpp +39 -0
- mqt/core/include/nlohmann/detail/json_pointer.hpp +988 -0
- mqt/core/include/nlohmann/detail/json_ref.hpp +78 -0
- mqt/core/include/nlohmann/detail/macro_scope.hpp +595 -0
- mqt/core/include/nlohmann/detail/macro_unscope.hpp +46 -0
- mqt/core/include/nlohmann/detail/meta/call_std/begin.hpp +17 -0
- mqt/core/include/nlohmann/detail/meta/call_std/end.hpp +17 -0
- mqt/core/include/nlohmann/detail/meta/cpp_future.hpp +171 -0
- mqt/core/include/nlohmann/detail/meta/detected.hpp +70 -0
- mqt/core/include/nlohmann/detail/meta/identity_tag.hpp +21 -0
- mqt/core/include/nlohmann/detail/meta/is_sax.hpp +159 -0
- mqt/core/include/nlohmann/detail/meta/std_fs.hpp +29 -0
- mqt/core/include/nlohmann/detail/meta/type_traits.hpp +795 -0
- mqt/core/include/nlohmann/detail/meta/void_t.hpp +24 -0
- mqt/core/include/nlohmann/detail/output/binary_writer.hpp +1850 -0
- mqt/core/include/nlohmann/detail/output/output_adapters.hpp +147 -0
- mqt/core/include/nlohmann/detail/output/serializer.hpp +988 -0
- mqt/core/include/nlohmann/detail/string_concat.hpp +146 -0
- mqt/core/include/nlohmann/detail/string_escape.hpp +72 -0
- mqt/core/include/nlohmann/detail/string_utils.hpp +37 -0
- mqt/core/include/nlohmann/detail/value_t.hpp +118 -0
- mqt/core/include/nlohmann/json.hpp +5306 -0
- mqt/core/include/nlohmann/json_fwd.hpp +75 -0
- mqt/core/include/nlohmann/ordered_map.hpp +359 -0
- mqt/core/include/nlohmann/thirdparty/hedley/hedley.hpp +2045 -0
- mqt/core/include/nlohmann/thirdparty/hedley/hedley_undef.hpp +158 -0
- mqt/core/include/qdmi/qdmi/client.h +990 -0
- mqt/core/include/qdmi/qdmi/constants.h +1139 -0
- mqt/core/include/qdmi/qdmi/device.h +602 -0
- mqt/core/include/qdmi/qdmi/types.h +78 -0
- mqt/core/include/spdlog/async.h +99 -0
- mqt/core/include/spdlog/async_logger-inl.h +84 -0
- mqt/core/include/spdlog/async_logger.h +74 -0
- mqt/core/include/spdlog/cfg/argv.h +40 -0
- mqt/core/include/spdlog/cfg/env.h +36 -0
- mqt/core/include/spdlog/cfg/helpers-inl.h +107 -0
- mqt/core/include/spdlog/cfg/helpers.h +29 -0
- mqt/core/include/spdlog/common-inl.h +68 -0
- mqt/core/include/spdlog/common.h +406 -0
- mqt/core/include/spdlog/details/backtracer-inl.h +63 -0
- mqt/core/include/spdlog/details/backtracer.h +45 -0
- mqt/core/include/spdlog/details/circular_q.h +115 -0
- mqt/core/include/spdlog/details/console_globals.h +28 -0
- mqt/core/include/spdlog/details/file_helper-inl.h +153 -0
- mqt/core/include/spdlog/details/file_helper.h +61 -0
- mqt/core/include/spdlog/details/fmt_helper.h +141 -0
- mqt/core/include/spdlog/details/log_msg-inl.h +44 -0
- mqt/core/include/spdlog/details/log_msg.h +40 -0
- mqt/core/include/spdlog/details/log_msg_buffer-inl.h +54 -0
- mqt/core/include/spdlog/details/log_msg_buffer.h +32 -0
- mqt/core/include/spdlog/details/mpmc_blocking_q.h +177 -0
- mqt/core/include/spdlog/details/null_mutex.h +35 -0
- mqt/core/include/spdlog/details/os-inl.h +606 -0
- mqt/core/include/spdlog/details/os.h +127 -0
- mqt/core/include/spdlog/details/periodic_worker-inl.h +26 -0
- mqt/core/include/spdlog/details/periodic_worker.h +58 -0
- mqt/core/include/spdlog/details/registry-inl.h +270 -0
- mqt/core/include/spdlog/details/registry.h +131 -0
- mqt/core/include/spdlog/details/synchronous_factory.h +22 -0
- mqt/core/include/spdlog/details/tcp_client-windows.h +135 -0
- mqt/core/include/spdlog/details/tcp_client.h +127 -0
- mqt/core/include/spdlog/details/thread_pool-inl.h +126 -0
- mqt/core/include/spdlog/details/thread_pool.h +117 -0
- mqt/core/include/spdlog/details/udp_client-windows.h +98 -0
- mqt/core/include/spdlog/details/udp_client.h +81 -0
- mqt/core/include/spdlog/details/windows_include.h +11 -0
- mqt/core/include/spdlog/fmt/bin_to_hex.h +224 -0
- mqt/core/include/spdlog/fmt/bundled/args.h +220 -0
- mqt/core/include/spdlog/fmt/bundled/base.h +2989 -0
- mqt/core/include/spdlog/fmt/bundled/chrono.h +2330 -0
- mqt/core/include/spdlog/fmt/bundled/color.h +637 -0
- mqt/core/include/spdlog/fmt/bundled/compile.h +539 -0
- mqt/core/include/spdlog/fmt/bundled/core.h +5 -0
- mqt/core/include/spdlog/fmt/bundled/fmt.license.rst +27 -0
- mqt/core/include/spdlog/fmt/bundled/format-inl.h +1948 -0
- mqt/core/include/spdlog/fmt/bundled/format.h +4244 -0
- mqt/core/include/spdlog/fmt/bundled/os.h +427 -0
- mqt/core/include/spdlog/fmt/bundled/ostream.h +167 -0
- mqt/core/include/spdlog/fmt/bundled/printf.h +633 -0
- mqt/core/include/spdlog/fmt/bundled/ranges.h +850 -0
- mqt/core/include/spdlog/fmt/bundled/std.h +728 -0
- mqt/core/include/spdlog/fmt/bundled/xchar.h +369 -0
- mqt/core/include/spdlog/fmt/chrono.h +23 -0
- mqt/core/include/spdlog/fmt/compile.h +23 -0
- mqt/core/include/spdlog/fmt/fmt.h +30 -0
- mqt/core/include/spdlog/fmt/ostr.h +23 -0
- mqt/core/include/spdlog/fmt/ranges.h +23 -0
- mqt/core/include/spdlog/fmt/std.h +24 -0
- mqt/core/include/spdlog/fmt/xchar.h +23 -0
- mqt/core/include/spdlog/formatter.h +17 -0
- mqt/core/include/spdlog/fwd.h +18 -0
- mqt/core/include/spdlog/logger-inl.h +198 -0
- mqt/core/include/spdlog/logger.h +379 -0
- mqt/core/include/spdlog/mdc.h +52 -0
- mqt/core/include/spdlog/pattern_formatter-inl.h +1340 -0
- mqt/core/include/spdlog/pattern_formatter.h +118 -0
- mqt/core/include/spdlog/sinks/android_sink.h +137 -0
- mqt/core/include/spdlog/sinks/ansicolor_sink-inl.h +142 -0
- mqt/core/include/spdlog/sinks/ansicolor_sink.h +116 -0
- mqt/core/include/spdlog/sinks/base_sink-inl.h +59 -0
- mqt/core/include/spdlog/sinks/base_sink.h +51 -0
- mqt/core/include/spdlog/sinks/basic_file_sink-inl.h +48 -0
- mqt/core/include/spdlog/sinks/basic_file_sink.h +66 -0
- mqt/core/include/spdlog/sinks/callback_sink.h +56 -0
- mqt/core/include/spdlog/sinks/daily_file_sink.h +254 -0
- mqt/core/include/spdlog/sinks/dist_sink.h +81 -0
- mqt/core/include/spdlog/sinks/dup_filter_sink.h +91 -0
- mqt/core/include/spdlog/sinks/hourly_file_sink.h +193 -0
- mqt/core/include/spdlog/sinks/kafka_sink.h +119 -0
- mqt/core/include/spdlog/sinks/mongo_sink.h +108 -0
- mqt/core/include/spdlog/sinks/msvc_sink.h +68 -0
- mqt/core/include/spdlog/sinks/null_sink.h +41 -0
- mqt/core/include/spdlog/sinks/ostream_sink.h +43 -0
- mqt/core/include/spdlog/sinks/qt_sinks.h +304 -0
- mqt/core/include/spdlog/sinks/ringbuffer_sink.h +67 -0
- mqt/core/include/spdlog/sinks/rotating_file_sink-inl.h +179 -0
- mqt/core/include/spdlog/sinks/rotating_file_sink.h +93 -0
- mqt/core/include/spdlog/sinks/sink-inl.h +22 -0
- mqt/core/include/spdlog/sinks/sink.h +34 -0
- mqt/core/include/spdlog/sinks/stdout_color_sinks-inl.h +38 -0
- mqt/core/include/spdlog/sinks/stdout_color_sinks.h +49 -0
- mqt/core/include/spdlog/sinks/stdout_sinks-inl.h +127 -0
- mqt/core/include/spdlog/sinks/stdout_sinks.h +84 -0
- mqt/core/include/spdlog/sinks/syslog_sink.h +104 -0
- mqt/core/include/spdlog/sinks/systemd_sink.h +121 -0
- mqt/core/include/spdlog/sinks/tcp_sink.h +75 -0
- mqt/core/include/spdlog/sinks/udp_sink.h +69 -0
- mqt/core/include/spdlog/sinks/win_eventlog_sink.h +260 -0
- mqt/core/include/spdlog/sinks/wincolor_sink-inl.h +172 -0
- mqt/core/include/spdlog/sinks/wincolor_sink.h +82 -0
- mqt/core/include/spdlog/spdlog-inl.h +96 -0
- mqt/core/include/spdlog/spdlog.h +357 -0
- mqt/core/include/spdlog/stopwatch.h +66 -0
- mqt/core/include/spdlog/tweakme.h +148 -0
- mqt/core/include/spdlog/version.h +11 -0
- mqt/core/ir/__init__.pyi +83 -45
- mqt/core/ir/operations.pyi +40 -27
- mqt/core/ir.cp313t-win_amd64.pyd +0 -0
- mqt/core/lib/cmake/spdlog/spdlogConfig.cmake +44 -0
- mqt/core/lib/cmake/spdlog/spdlogConfigTargets-release.cmake +19 -0
- mqt/core/lib/cmake/spdlog/spdlogConfigTargets.cmake +119 -0
- mqt/core/lib/cmake/spdlog/spdlogConfigVersion.cmake +65 -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-fomac.lib +0 -0
- mqt/core/lib/mqt-core-ir.lib +0 -0
- mqt/core/lib/mqt-core-na-fomac.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-qdmi-driver.lib +0 -0
- mqt/core/lib/mqt-core-qdmi-na-device-gen.lib +0 -0
- mqt/core/lib/mqt-core-qdmi-na-device.lib +0 -0
- mqt/core/lib/mqt-core-zx.lib +0 -0
- mqt/core/lib/pkgconfig/spdlog.pc +13 -0
- mqt/core/lib/spdlog.lib +0 -0
- mqt/core/na/__init__.py +12 -0
- mqt/core/na/fomac.cp313t-win_amd64.pyd +0 -0
- mqt/core/na/fomac.pyi +117 -0
- mqt/core/nlohmann_json.natvis +278 -0
- mqt/core/plugins/qiskit/mqt_to_qiskit.py +75 -11
- mqt/core/plugins/qiskit/qiskit_to_mqt.py +108 -5
- mqt/core/share/cmake/mqt-core/AddMQTPythonBinding.cmake +3 -0
- mqt/core/share/cmake/mqt-core/Cache.cmake +17 -16
- mqt/core/share/cmake/mqt-core/PackageAddTest.cmake +6 -0
- mqt/core/share/cmake/mqt-core/StandardProjectSettings.cmake +1 -1
- mqt/core/share/cmake/mqt-core/mqt-core-config-version.cmake +3 -3
- mqt/core/share/cmake/mqt-core/mqt-core-config.cmake +3 -0
- mqt/core/share/cmake/mqt-core/mqt-core-targets-release.cmake +51 -0
- mqt/core/share/cmake/mqt-core/mqt-core-targets.cmake +124 -3
- mqt/core/share/cmake/nlohmann_json/nlohmann_jsonConfig.cmake +15 -0
- mqt/core/share/cmake/nlohmann_json/nlohmann_jsonConfigVersion.cmake +20 -0
- mqt/core/share/cmake/nlohmann_json/nlohmann_jsonTargets.cmake +110 -0
- mqt/core/share/cmake/qdmi/Cache.cmake +44 -0
- mqt/core/share/cmake/qdmi/PrefixHandling.cmake +78 -0
- mqt/core/share/cmake/qdmi/prefix_defs.txt +26 -0
- mqt/core/share/cmake/qdmi/qdmi-config-version.cmake +85 -0
- mqt/core/share/cmake/qdmi/qdmi-config.cmake +42 -0
- mqt/core/share/cmake/qdmi/qdmi-targets.cmake +129 -0
- mqt/core/share/pkgconfig/nlohmann_json.pc +7 -0
- mqt_core-3.3.0.dist-info/DELVEWHEEL +2 -0
- {mqt_core-3.2.1.dist-info → mqt_core-3.3.0.dist-info}/METADATA +74 -33
- {mqt_core-3.2.1.dist-info → mqt_core-3.3.0.dist-info}/RECORD +244 -50
- {mqt_core-3.2.1.dist-info → mqt_core-3.3.0.dist-info}/WHEEL +1 -1
- mqt/core/include/mqt-core/ir/operations/ClassicControlledOperation.hpp +0 -156
- mqt_core-3.2.1.dist-info/DELVEWHEEL +0 -2
- {mqt_core-3.2.1.dist-info → mqt_core-3.3.0.dist-info}/entry_points.txt +0 -0
- {mqt_core-3.2.1.dist-info → mqt_core-3.3.0.dist-info}/licenses/LICENSE.md +0 -0
|
@@ -0,0 +1,447 @@
|
|
|
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 <algorithm>
|
|
14
|
+
#include <array>
|
|
15
|
+
#include <cstddef>
|
|
16
|
+
#include <cstdint>
|
|
17
|
+
#include <functional>
|
|
18
|
+
#include <istream>
|
|
19
|
+
// NOLINTNEXTLINE(misc-include-cleaner)
|
|
20
|
+
#include <nlohmann/json.hpp>
|
|
21
|
+
#include <ostream>
|
|
22
|
+
#include <sstream>
|
|
23
|
+
#include <stdexcept>
|
|
24
|
+
#include <string>
|
|
25
|
+
#include <vector>
|
|
26
|
+
|
|
27
|
+
namespace na {
|
|
28
|
+
/**
|
|
29
|
+
* @brief Represents a neutral atom device configuration.
|
|
30
|
+
* @details This struct defines the schema for the JSON representation of a
|
|
31
|
+
* neutral atom device configuration. This struct, including all its
|
|
32
|
+
* sub-structs, implements functions to serialize and deserialize to and from
|
|
33
|
+
* JSON using the nlohmann::json library.
|
|
34
|
+
* @note All duration and length values are in multiples of the time unit and
|
|
35
|
+
* the length unit, respectively.
|
|
36
|
+
*/
|
|
37
|
+
struct Device {
|
|
38
|
+
/// @brief The name of the device.
|
|
39
|
+
std::string name;
|
|
40
|
+
/// @brief The number of qubits in the device.
|
|
41
|
+
uint64_t numQubits = 0;
|
|
42
|
+
|
|
43
|
+
/// @brief Represents a 2D-vector.
|
|
44
|
+
struct Vector {
|
|
45
|
+
/// @brief The x-coordinate of the vector.
|
|
46
|
+
int64_t x = 0;
|
|
47
|
+
/// @brief The y-coordinate of the vector.
|
|
48
|
+
int64_t y = 0;
|
|
49
|
+
|
|
50
|
+
// NOLINTNEXTLINE(misc-include-cleaner)
|
|
51
|
+
NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(Vector, x, y)
|
|
52
|
+
|
|
53
|
+
auto operator<=>(const Vector&) const = default;
|
|
54
|
+
};
|
|
55
|
+
/// @brief Represents a region in the device.
|
|
56
|
+
struct Region {
|
|
57
|
+
/// @brief The origin of the region.
|
|
58
|
+
Vector origin;
|
|
59
|
+
|
|
60
|
+
/// @brief The size of the region.
|
|
61
|
+
struct Size {
|
|
62
|
+
/// @brief The width of the region.
|
|
63
|
+
uint64_t width = 0;
|
|
64
|
+
/// @brief The height of the region.
|
|
65
|
+
uint64_t height = 0;
|
|
66
|
+
|
|
67
|
+
// NOLINTNEXTLINE(misc-include-cleaner)
|
|
68
|
+
NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(Size, width, height)
|
|
69
|
+
|
|
70
|
+
auto operator<=>(const Size&) const = default;
|
|
71
|
+
};
|
|
72
|
+
/// @brief The size of the region.
|
|
73
|
+
Size size;
|
|
74
|
+
|
|
75
|
+
// NOLINTNEXTLINE(misc-include-cleaner)
|
|
76
|
+
NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(Region, origin, size)
|
|
77
|
+
|
|
78
|
+
auto operator<=>(const Region&) const = default;
|
|
79
|
+
};
|
|
80
|
+
/// @brief Represents a lattice of traps in the device.
|
|
81
|
+
struct Lattice {
|
|
82
|
+
/// @brief The origin of the lattice.
|
|
83
|
+
Vector latticeOrigin;
|
|
84
|
+
/**
|
|
85
|
+
* @brief The first lattice vector.
|
|
86
|
+
* @details Multiples of this vector are added to the lattice origin to
|
|
87
|
+
* create the lattice structure.
|
|
88
|
+
*/
|
|
89
|
+
Vector latticeVector1;
|
|
90
|
+
/**
|
|
91
|
+
* @brief The second lattice vector.
|
|
92
|
+
* @details Multiples of this vector are added to the lattice origin and
|
|
93
|
+
* multiples of the first lattice vector to create the lattice structure.
|
|
94
|
+
*/
|
|
95
|
+
Vector latticeVector2;
|
|
96
|
+
/**
|
|
97
|
+
* @brief The offsets for each sublattice.
|
|
98
|
+
* @details The actual locations of traps are calculated by adding the
|
|
99
|
+
* each offset to the points in the lattice defined by the lattice
|
|
100
|
+
* vectors, i.e., for each sublattice offset `offset` and indices `i` and
|
|
101
|
+
* `j`, the trap location is `latticeOrigin + i * latticeVector1 + j *
|
|
102
|
+
* latticeVector2 + offset`.
|
|
103
|
+
*/
|
|
104
|
+
std::vector<Vector> sublatticeOffsets;
|
|
105
|
+
/**
|
|
106
|
+
* @brief The extent of the lattice.
|
|
107
|
+
* @details The extent defines the boundary of the lattice in which traps
|
|
108
|
+
* are placed. Only traps of the lattice that are within this extent
|
|
109
|
+
* are considered valid.
|
|
110
|
+
*/
|
|
111
|
+
Region extent;
|
|
112
|
+
|
|
113
|
+
// NOLINTNEXTLINE(misc-include-cleaner)
|
|
114
|
+
NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(Lattice, latticeOrigin,
|
|
115
|
+
latticeVector1, latticeVector2,
|
|
116
|
+
sublatticeOffsets, extent)
|
|
117
|
+
|
|
118
|
+
auto operator<=>(const Lattice&) const = default;
|
|
119
|
+
};
|
|
120
|
+
/// @brief The list of lattices (trap areas) in the device.
|
|
121
|
+
std::vector<Lattice> traps;
|
|
122
|
+
/**
|
|
123
|
+
* @brief The minimum distance between atoms in the device that must be
|
|
124
|
+
* respected.
|
|
125
|
+
*/
|
|
126
|
+
uint64_t minAtomDistance = 0;
|
|
127
|
+
|
|
128
|
+
private:
|
|
129
|
+
struct Operation {
|
|
130
|
+
/// @brief The name of the operation.
|
|
131
|
+
std::string name;
|
|
132
|
+
/// @brief The region in which the operation can be performed.
|
|
133
|
+
Region region;
|
|
134
|
+
/// @brief The duration of the operation.
|
|
135
|
+
uint64_t duration = 0;
|
|
136
|
+
/// @brief The fidelity of the operation.
|
|
137
|
+
double fidelity = 0.0;
|
|
138
|
+
/// @brief The number of parameters the operation takes.
|
|
139
|
+
uint64_t numParameters = 0;
|
|
140
|
+
|
|
141
|
+
// NOLINTNEXTLINE(misc-include-cleaner)
|
|
142
|
+
NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(Operation, name, region,
|
|
143
|
+
duration, fidelity,
|
|
144
|
+
numParameters)
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
public:
|
|
148
|
+
/// @brief Represents a global single-qubit operation.
|
|
149
|
+
struct GlobalSingleQubitOperation : Operation {};
|
|
150
|
+
/// @brief The list of global single-qubit operations supported by the device.
|
|
151
|
+
std::vector<GlobalSingleQubitOperation> globalSingleQubitOperations;
|
|
152
|
+
|
|
153
|
+
/// @brief Represents a global multi-qubit operation.
|
|
154
|
+
struct GlobalMultiQubitOperation : Operation {
|
|
155
|
+
/**
|
|
156
|
+
* @brief The interaction radius of the operation within which two qubits
|
|
157
|
+
* can interact.
|
|
158
|
+
*/
|
|
159
|
+
uint64_t interactionRadius = 0;
|
|
160
|
+
/**
|
|
161
|
+
* @brief The blocking radius of the operation within which no other
|
|
162
|
+
* operation can be performed to avoid interference.
|
|
163
|
+
*/
|
|
164
|
+
uint64_t blockingRadius = 0;
|
|
165
|
+
/// @brief The fidelity of the operation when no qubits are interacting.
|
|
166
|
+
double idlingFidelity = 0.0;
|
|
167
|
+
/// @brief The number of qubits involved in the operation.
|
|
168
|
+
uint64_t numQubits = 0;
|
|
169
|
+
|
|
170
|
+
// NOLINTNEXTLINE(misc-include-cleaner)
|
|
171
|
+
NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_WITH_DEFAULT(
|
|
172
|
+
GlobalMultiQubitOperation, Operation, interactionRadius, blockingRadius,
|
|
173
|
+
idlingFidelity, numQubits)
|
|
174
|
+
};
|
|
175
|
+
/// @brief The list of global multi-qubit operations supported by the device.
|
|
176
|
+
std::vector<GlobalMultiQubitOperation> globalMultiQubitOperations;
|
|
177
|
+
|
|
178
|
+
/// @brief Represents a local single-qubit operation.
|
|
179
|
+
struct LocalSingleQubitOperation : Operation {};
|
|
180
|
+
/// @brief The list of local single-qubit operations supported by the device.
|
|
181
|
+
std::vector<LocalSingleQubitOperation> localSingleQubitOperations;
|
|
182
|
+
|
|
183
|
+
/// @brief Represents a local multi-qubit operation.
|
|
184
|
+
struct LocalMultiQubitOperation : Operation {
|
|
185
|
+
/**
|
|
186
|
+
* @brief The interaction radius of the operation within which two qubits
|
|
187
|
+
* can interact.
|
|
188
|
+
*/
|
|
189
|
+
uint64_t interactionRadius = 0.0;
|
|
190
|
+
/**
|
|
191
|
+
* @brief The blocking radius of the operation within which no other
|
|
192
|
+
* operation can be performed to avoid interference.
|
|
193
|
+
*/
|
|
194
|
+
uint64_t blockingRadius = 0.0;
|
|
195
|
+
/// @brief The number of qubits involved in the operation.
|
|
196
|
+
uint64_t numQubits = 0;
|
|
197
|
+
|
|
198
|
+
// NOLINTNEXTLINE(misc-include-cleaner)
|
|
199
|
+
NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_WITH_DEFAULT(
|
|
200
|
+
LocalMultiQubitOperation, Operation, interactionRadius, blockingRadius,
|
|
201
|
+
numQubits)
|
|
202
|
+
};
|
|
203
|
+
/// @brief The list of local multi-qubit operations supported by the device.
|
|
204
|
+
std::vector<LocalMultiQubitOperation> localMultiQubitOperations;
|
|
205
|
+
|
|
206
|
+
/// @brief Represents a shuttling unit in the device.
|
|
207
|
+
struct ShuttlingUnit {
|
|
208
|
+
size_t id = 0; ///< @brief Unique identifier for the shuttling unit.
|
|
209
|
+
/// @brief The region in which the shuttling unit operates.
|
|
210
|
+
Region region;
|
|
211
|
+
/// @brief The duration of the load operation in the shuttling unit.
|
|
212
|
+
uint64_t loadDuration = 0;
|
|
213
|
+
/// @brief The duration of the store operation in the shuttling unit.
|
|
214
|
+
uint64_t storeDuration = 0;
|
|
215
|
+
/// @brief The fidelity of the load operation in the shuttling unit.
|
|
216
|
+
double loadFidelity = 0.0;
|
|
217
|
+
/// @brief The fidelity of the store operation in the shuttling unit.
|
|
218
|
+
double storeFidelity = 0.0;
|
|
219
|
+
/// @brief The number of parameters the shuttling unit takes.
|
|
220
|
+
uint64_t numParameters = 0;
|
|
221
|
+
/**
|
|
222
|
+
* @brief The mean shuttling speed.
|
|
223
|
+
* @note Only for shuttling operations.
|
|
224
|
+
*/
|
|
225
|
+
uint64_t meanShuttlingSpeed = 0;
|
|
226
|
+
|
|
227
|
+
// NOLINTNEXTLINE(misc-include-cleaner)
|
|
228
|
+
NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(ShuttlingUnit, region,
|
|
229
|
+
loadDuration, storeDuration,
|
|
230
|
+
loadFidelity, storeFidelity,
|
|
231
|
+
numParameters,
|
|
232
|
+
meanShuttlingSpeed)
|
|
233
|
+
};
|
|
234
|
+
/// @brief The list of shuttling units supported by the device.
|
|
235
|
+
std::vector<ShuttlingUnit> shuttlingUnits;
|
|
236
|
+
|
|
237
|
+
/// @brief Represents the decoherence times of the device.
|
|
238
|
+
struct DecoherenceTimes {
|
|
239
|
+
/// @brief The T1 time.
|
|
240
|
+
uint64_t t1 = 0;
|
|
241
|
+
/// @brief The T2 time.
|
|
242
|
+
uint64_t t2 = 0;
|
|
243
|
+
|
|
244
|
+
// NOLINTNEXTLINE(misc-include-cleaner)
|
|
245
|
+
NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(DecoherenceTimes, t1, t2)
|
|
246
|
+
};
|
|
247
|
+
/// @brief The decoherence times of the device.
|
|
248
|
+
DecoherenceTimes decoherenceTimes;
|
|
249
|
+
|
|
250
|
+
/// @brief Represents a unit of measurement for length and time.
|
|
251
|
+
struct Unit {
|
|
252
|
+
/// @brief The unit of measurement (e.g., "µm" for micrometers, "ns" for
|
|
253
|
+
/// nanoseconds).
|
|
254
|
+
std::string unit;
|
|
255
|
+
/// @brief The factor of the unit.
|
|
256
|
+
double scaleFactor = 0;
|
|
257
|
+
|
|
258
|
+
// NOLINTNEXTLINE(misc-include-cleaner)
|
|
259
|
+
NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(Unit, scaleFactor, unit)
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
/// @brief The unit of measurement for lengths in the device.
|
|
263
|
+
Unit lengthUnit = {.unit = "um", ///< Default is micrometers (um).
|
|
264
|
+
.scaleFactor = 1.0};
|
|
265
|
+
|
|
266
|
+
/// @brief The unit of measurement for time in the device.
|
|
267
|
+
Unit durationUnit = {.unit = "us", ///< Default is microseconds (us).
|
|
268
|
+
.scaleFactor = 1.0};
|
|
269
|
+
|
|
270
|
+
// Before we used the macro NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT here,
|
|
271
|
+
// too. Now, we added an id to shuttling units that must be initialized
|
|
272
|
+
// in a custom routine, so we can only use the serialize macro. Additionally,
|
|
273
|
+
// we check here whether the units are valid SI units.
|
|
274
|
+
// NOLINTNEXTLINE(misc-include-cleaner)
|
|
275
|
+
NLOHMANN_DEFINE_TYPE_INTRUSIVE_ONLY_SERIALIZE(
|
|
276
|
+
Device, name, numQubits, traps, minAtomDistance,
|
|
277
|
+
globalSingleQubitOperations, globalMultiQubitOperations,
|
|
278
|
+
localSingleQubitOperations, localMultiQubitOperations, shuttlingUnits,
|
|
279
|
+
decoherenceTimes, lengthUnit, durationUnit)
|
|
280
|
+
|
|
281
|
+
// the name of the following function is given by the nlohmann::json library
|
|
282
|
+
// and must not be changed
|
|
283
|
+
template <typename BasicJsonType>
|
|
284
|
+
// NOLINTNEXTLINE(readability-identifier-naming)
|
|
285
|
+
friend auto from_json(const BasicJsonType& json, Device& device) -> void {
|
|
286
|
+
const Device defaultDevice{};
|
|
287
|
+
device.name = !json.is_null() ? json.value("name", defaultDevice.name)
|
|
288
|
+
: defaultDevice.name;
|
|
289
|
+
device.numQubits = !json.is_null()
|
|
290
|
+
? json.value("numQubits", defaultDevice.numQubits)
|
|
291
|
+
: defaultDevice.numQubits;
|
|
292
|
+
device.traps = !json.is_null() ? json.value("traps", defaultDevice.traps)
|
|
293
|
+
: defaultDevice.traps;
|
|
294
|
+
device.minAtomDistance =
|
|
295
|
+
!json.is_null()
|
|
296
|
+
? json.value("minAtomDistance", defaultDevice.minAtomDistance)
|
|
297
|
+
: defaultDevice.minAtomDistance;
|
|
298
|
+
device.globalSingleQubitOperations =
|
|
299
|
+
!json.is_null() ? json.value("globalSingleQubitOperations",
|
|
300
|
+
defaultDevice.globalSingleQubitOperations)
|
|
301
|
+
: defaultDevice.globalSingleQubitOperations;
|
|
302
|
+
device.globalMultiQubitOperations =
|
|
303
|
+
!json.is_null() ? json.value("globalMultiQubitOperations",
|
|
304
|
+
defaultDevice.globalMultiQubitOperations)
|
|
305
|
+
: defaultDevice.globalMultiQubitOperations;
|
|
306
|
+
device.localSingleQubitOperations =
|
|
307
|
+
!json.is_null() ? json.value("localSingleQubitOperations",
|
|
308
|
+
defaultDevice.localSingleQubitOperations)
|
|
309
|
+
: defaultDevice.localSingleQubitOperations;
|
|
310
|
+
device.localMultiQubitOperations =
|
|
311
|
+
!json.is_null() ? json.value("localMultiQubitOperations",
|
|
312
|
+
defaultDevice.localMultiQubitOperations)
|
|
313
|
+
: defaultDevice.localMultiQubitOperations;
|
|
314
|
+
device.shuttlingUnits =
|
|
315
|
+
!json.is_null()
|
|
316
|
+
? json.value("shuttlingUnits", defaultDevice.shuttlingUnits)
|
|
317
|
+
: defaultDevice.shuttlingUnits;
|
|
318
|
+
std::ranges::for_each(device.shuttlingUnits,
|
|
319
|
+
[i = 0UL](auto& unit) mutable { unit.id = i++; });
|
|
320
|
+
device.decoherenceTimes =
|
|
321
|
+
!json.is_null()
|
|
322
|
+
? json.value("decoherenceTimes", defaultDevice.decoherenceTimes)
|
|
323
|
+
: defaultDevice.decoherenceTimes;
|
|
324
|
+
device.lengthUnit = !json.is_null()
|
|
325
|
+
? json.value("lengthUnit", defaultDevice.lengthUnit)
|
|
326
|
+
: defaultDevice.lengthUnit;
|
|
327
|
+
constexpr std::array allowedLengthUnits = {"mm", "um", "nm"};
|
|
328
|
+
if (std::ranges::find(allowedLengthUnits, device.lengthUnit.unit) ==
|
|
329
|
+
allowedLengthUnits.end()) {
|
|
330
|
+
std::ostringstream ss;
|
|
331
|
+
ss << "Invalid length unit: " << device.lengthUnit.unit
|
|
332
|
+
<< ". Supported units are: ";
|
|
333
|
+
std::ranges::for_each(allowedLengthUnits,
|
|
334
|
+
[&ss](const char* unit) { ss << unit << ", "; });
|
|
335
|
+
ss.seekp(-2, std::ostringstream::cur); // Remove the last comma and space
|
|
336
|
+
ss << ".";
|
|
337
|
+
throw std::runtime_error(ss.str());
|
|
338
|
+
}
|
|
339
|
+
device.durationUnit =
|
|
340
|
+
!json.is_null() ? json.value("durationUnit", defaultDevice.durationUnit)
|
|
341
|
+
: defaultDevice.durationUnit;
|
|
342
|
+
constexpr std::array allowedDurationUnits = {"ms", "us", "ns"};
|
|
343
|
+
if (std::ranges::find(allowedDurationUnits, device.durationUnit.unit) ==
|
|
344
|
+
allowedDurationUnits.end()) {
|
|
345
|
+
std::ostringstream ss;
|
|
346
|
+
ss << "Invalid duration unit: " << device.durationUnit.unit
|
|
347
|
+
<< ". Supported units are: ";
|
|
348
|
+
std::ranges::for_each(allowedDurationUnits,
|
|
349
|
+
[&ss](const char* unit) { ss << unit << ", "; });
|
|
350
|
+
ss.seekp(-2, std::ostringstream::cur); // Remove the last comma and space
|
|
351
|
+
ss << ".";
|
|
352
|
+
throw std::runtime_error(ss.str());
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* @brief Writes a JSON schema with default values for the device configuration
|
|
359
|
+
* to the specified output stream.
|
|
360
|
+
* @param os is the output stream to write the JSON schema to.
|
|
361
|
+
* @throws std::runtime_error if the JSON conversion fails.
|
|
362
|
+
*/
|
|
363
|
+
auto writeJSONSchema(std::ostream& os) -> void;
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* @brief Writes a JSON schema with default values for the device configuration
|
|
367
|
+
* to the specified path.
|
|
368
|
+
* @param path The path to write the JSON schema to.
|
|
369
|
+
* @throws std::runtime_error if the JSON conversion fails or the file cannot be
|
|
370
|
+
* opened.
|
|
371
|
+
*/
|
|
372
|
+
auto writeJSONSchema(const std::string& path) -> void;
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* @brief Parses the device configuration from an input stream.
|
|
376
|
+
* @param is is the input stream containing the JSON representation of the
|
|
377
|
+
* device configuration.
|
|
378
|
+
* @returns The parsed device configuration as a Protobuf message.
|
|
379
|
+
* @throws std::runtime_error if the JSON cannot be parsed.
|
|
380
|
+
*/
|
|
381
|
+
[[nodiscard]] auto readJSON(std::istream& is) -> Device;
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* @brief Parses the device configuration from a JSON file.
|
|
385
|
+
* @param path is the path to the JSON file containing the device configuration.
|
|
386
|
+
* @returns The parsed device configuration as a Protobuf message.
|
|
387
|
+
* @throws std::runtime_error if the JSON file does not exist, or the JSON file
|
|
388
|
+
* cannot be parsed.
|
|
389
|
+
*/
|
|
390
|
+
[[nodiscard]] auto readJSON(const std::string& path) -> Device;
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* @brief Writes a header file with the device configuration to the specified
|
|
394
|
+
* output stream.
|
|
395
|
+
* @param device is the protobuf representation of the device.
|
|
396
|
+
* @param os is the output stream to write the header file to.
|
|
397
|
+
* @throws std::runtime_error if the file cannot be opened or written to.
|
|
398
|
+
* @note This implementation only supports multi-qubit gates up to two
|
|
399
|
+
* qubits.
|
|
400
|
+
*/
|
|
401
|
+
auto writeHeader(const Device& device, std::ostream& os) -> void;
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* @brief Writes a header file with the device configuration to the specified
|
|
405
|
+
* path.
|
|
406
|
+
* @param device is the protobuf representation of the device.
|
|
407
|
+
* @param path is the path to write the header file to.
|
|
408
|
+
* @throws std::runtime_error if the file cannot be opened or written to.
|
|
409
|
+
* @note This implementation only supports multi-qubit gates up to two
|
|
410
|
+
* qubits.
|
|
411
|
+
*/
|
|
412
|
+
auto writeHeader(const Device& device, const std::string& path) -> void;
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* @brief Information about a regular site in a lattice.
|
|
416
|
+
* @details This struct encapsulates all relevant information about a site
|
|
417
|
+
* for use in the forEachRegularSites callback.
|
|
418
|
+
*/
|
|
419
|
+
struct SiteInfo {
|
|
420
|
+
/// @brief The unique identifier of the site.
|
|
421
|
+
uint64_t id;
|
|
422
|
+
/// @brief The x-coordinate of the site.
|
|
423
|
+
int64_t x;
|
|
424
|
+
/// @brief The y-coordinate of the site.
|
|
425
|
+
int64_t y;
|
|
426
|
+
/// @brief The identifier of the lattice (module) the site belongs to.
|
|
427
|
+
uint64_t moduleId;
|
|
428
|
+
/// @brief The identifier of the sublattice (submodule) the site belongs to.
|
|
429
|
+
uint64_t subModuleId;
|
|
430
|
+
};
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* @brief Iterates over all regular sites created by the given lattices and
|
|
434
|
+
* calls the given function for each site.
|
|
435
|
+
* @param lattices is the list of lattices to iterate over.
|
|
436
|
+
* @param f is the function to call for each regular site, receiving a SiteInfo
|
|
437
|
+
* struct containing all site information.
|
|
438
|
+
* @param startId is the starting identifier for the sites. Default is 0.
|
|
439
|
+
* @throws std::runtime_error if lattice vectors are degenerate (i.e., the
|
|
440
|
+
* determinant of the lattice vector matrix is near zero, causing the system
|
|
441
|
+
* of equations to have no unique solution).
|
|
442
|
+
*/
|
|
443
|
+
auto forEachRegularSites(const std::vector<Device::Lattice>& lattices,
|
|
444
|
+
const std::function<void(const SiteInfo&)>& f,
|
|
445
|
+
size_t startId = 0) -> void;
|
|
446
|
+
|
|
447
|
+
} // namespace na
|
|
@@ -0,0 +1,169 @@
|
|
|
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 "fomac/FoMaC.hpp"
|
|
14
|
+
#include "na/device/Generator.hpp"
|
|
15
|
+
|
|
16
|
+
// NOLINTNEXTLINE(misc-include-cleaner)
|
|
17
|
+
#include <nlohmann/json.hpp>
|
|
18
|
+
#include <optional>
|
|
19
|
+
#include <vector>
|
|
20
|
+
|
|
21
|
+
namespace na {
|
|
22
|
+
/**
|
|
23
|
+
* @brief Class representing the FoMaC library with neutral atom extensions.
|
|
24
|
+
* @see fomac::FoMaC
|
|
25
|
+
*/
|
|
26
|
+
class FoMaC : public fomac::FoMaC {
|
|
27
|
+
public:
|
|
28
|
+
/**
|
|
29
|
+
* @brief Class representing a quantum device with neutral atom extensions.
|
|
30
|
+
* @see fomac::FoMaC::Device
|
|
31
|
+
* @note Since it inherits from @ref na::Device, Device objects can be
|
|
32
|
+
* converted to `nlohmann::json` objects.
|
|
33
|
+
*/
|
|
34
|
+
class Device : public fomac::FoMaC::Device, na::Device {
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @brief Initializes the name from the underlying QDMI device.
|
|
38
|
+
*/
|
|
39
|
+
auto initNameFromDevice() -> void;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @brief Initializes the minimum atom distance from the underlying QDMI
|
|
43
|
+
* device.
|
|
44
|
+
*/
|
|
45
|
+
auto initMinAtomDistanceFromDevice() -> bool;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @brief Initializes the number of qubits from the underlying QDMI device.
|
|
49
|
+
*/
|
|
50
|
+
auto initQubitsNumFromDevice() -> void;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @brief Initializes the length unit from the underlying QDMI device.
|
|
54
|
+
*/
|
|
55
|
+
auto initLengthUnitFromDevice() -> bool;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @brief Initializes the duration unit from the underlying QDMI device.
|
|
59
|
+
*/
|
|
60
|
+
auto initDurationUnitFromDevice() -> bool;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @brief Initializes the decoherence times from the underlying QDMI device.
|
|
64
|
+
*/
|
|
65
|
+
auto initDecoherenceTimesFromDevice() -> bool;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* @brief Initializes the trap lattices from the underlying QDMI device.
|
|
69
|
+
* @details It reconstructs the entire lattice structure from the
|
|
70
|
+
* information retrieved from the QDMI device, including lattice vectors,
|
|
71
|
+
* sublattice offsets, and extent.
|
|
72
|
+
* @see na::Device::Lattice
|
|
73
|
+
*/
|
|
74
|
+
auto initTrapsfromDevice() -> bool;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* @brief Initializes the all operations from the underlying QDMI device.
|
|
78
|
+
*/
|
|
79
|
+
auto initOperationsFromDevice() -> bool;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* @brief Constructs a Device object from a fomac::FoMaC::Device object.
|
|
83
|
+
* @param device The fomac::FoMaC::Device object to wrap.
|
|
84
|
+
* @note The constructor does not initialize the additional fields of this
|
|
85
|
+
* class. For their initialization, the corresponding `init*FromDevice`
|
|
86
|
+
* methods must be called, see @ref tryCreateFromDevice.
|
|
87
|
+
*/
|
|
88
|
+
explicit Device(const fomac::FoMaC::Device& device);
|
|
89
|
+
|
|
90
|
+
public:
|
|
91
|
+
/// @returns the length unit of the device.
|
|
92
|
+
[[nodiscard]] auto getLengthUnit() const -> const Unit& {
|
|
93
|
+
return lengthUnit;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/// @returns the duration unit of the device.
|
|
97
|
+
[[nodiscard]] auto getDurationUnit() const -> const Unit& {
|
|
98
|
+
return durationUnit;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/// @returns the decoherence times of the device.
|
|
102
|
+
[[nodiscard]] auto getDecoherenceTimes() const -> const DecoherenceTimes& {
|
|
103
|
+
return decoherenceTimes;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/// @returns the list of trap lattices of the device.
|
|
107
|
+
[[nodiscard]] auto getTraps() const -> const std::vector<Lattice>& {
|
|
108
|
+
return traps;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* @brief Try to create a Device object from a fomac::FoMaC::Device object.
|
|
113
|
+
* @details This method attempts to create a Device object by initializing
|
|
114
|
+
* all necessary fields from the provided fomac::FoMaC::Device object. If
|
|
115
|
+
* any required information is missing or invalid, the method returns
|
|
116
|
+
* `std::nullopt`.
|
|
117
|
+
* @param device is the fomac::FoMaC::Device object to wrap.
|
|
118
|
+
* @return An optional containing the instantiated device if compatible,
|
|
119
|
+
* std::nullopt otherwise.
|
|
120
|
+
*/
|
|
121
|
+
[[nodiscard]] static auto
|
|
122
|
+
tryCreateFromDevice(const fomac::FoMaC::Device& device)
|
|
123
|
+
-> std::optional<Device> {
|
|
124
|
+
Device d(device);
|
|
125
|
+
// The sequence of the following method calls does not matter.
|
|
126
|
+
// They are independent of each other.
|
|
127
|
+
if (!d.initMinAtomDistanceFromDevice()) {
|
|
128
|
+
return std::nullopt;
|
|
129
|
+
}
|
|
130
|
+
if (!d.initLengthUnitFromDevice()) {
|
|
131
|
+
return std::nullopt;
|
|
132
|
+
}
|
|
133
|
+
if (!d.initDurationUnitFromDevice()) {
|
|
134
|
+
return std::nullopt;
|
|
135
|
+
}
|
|
136
|
+
if (!d.initDecoherenceTimesFromDevice()) {
|
|
137
|
+
return std::nullopt;
|
|
138
|
+
}
|
|
139
|
+
if (!d.initTrapsfromDevice()) {
|
|
140
|
+
return std::nullopt;
|
|
141
|
+
}
|
|
142
|
+
if (!d.initOperationsFromDevice()) {
|
|
143
|
+
return std::nullopt;
|
|
144
|
+
}
|
|
145
|
+
d.initNameFromDevice();
|
|
146
|
+
d.initQubitsNumFromDevice();
|
|
147
|
+
return d;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// The following is the result of
|
|
151
|
+
// NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_ONLY_SERIALIZE(Device, na::Device)
|
|
152
|
+
// without any new attributes, which is the reason the macro cannot be used.
|
|
153
|
+
template <typename BasicJsonType>
|
|
154
|
+
friend void to_json(BasicJsonType& nlohmannJsonJ,
|
|
155
|
+
const Device& nlohmannJsonT) {
|
|
156
|
+
// NOLINTNEXTLINE(misc-include-cleaner)
|
|
157
|
+
nlohmann::to_json(nlohmannJsonJ,
|
|
158
|
+
static_cast<const na::Device&>(nlohmannJsonT));
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
/// @brief Deleted default constructor to prevent instantiation.
|
|
163
|
+
FoMaC() = delete;
|
|
164
|
+
|
|
165
|
+
/// @see QDMI_SESSION_PROPERTY_DEVICES
|
|
166
|
+
[[nodiscard]] static auto getDevices() -> std::vector<Device>;
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
} // namespace na
|