Skip to content

Commit abbdcc5

Browse files
authored
✨ add parser for .real files (#219)
## Description This moves the `.real` parser from MQT Core, where it has been removed in munich-quantum-toolkit/core#822, to this repository. As there are no previous connection points to the SyReC repository, this is relatively standalone for now. ## Checklist: <!--- This checklist serves as a reminder of a couple of things that ensure your pull request will be merged swiftly. --> - [x] The pull request only contains commits that are related to it. - [x] I have added appropriate tests and documentation. - [x] I have made sure that all CI jobs on GitHub pass. - [x] The pull request introduces no new warnings and follows the project's style guidelines.
2 parents 947c16a + 4137575 commit abbdcc5

File tree

5 files changed

+2453
-12
lines changed

5 files changed

+2453
-12
lines changed

cmake/ExternalDependencies.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ endif()
3535
# cmake-format: off
3636
set(MQT_CORE_VERSION 3.0.0
3737
CACHE STRING "MQT Core version")
38-
set(MQT_CORE_REV "8b25b61666cef507ad8920bd997627d6d348231d"
38+
set(MQT_CORE_REV "be654c753e98e9062d796143dd3a591366370b2d"
3939
CACHE STRING "MQT Core identifier (tag, branch or commit hash)")
4040
set(MQT_CORE_REPO_OWNER "cda-tum"
4141
CACHE STRING "MQT Core repository owner (change when using a fork)")

include/core/real/parser.hpp

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#pragma once
2+
3+
#include "ir/QuantumComputation.hpp"
4+
5+
#include <cstddef>
6+
#include <iosfwd>
7+
#include <string>
8+
9+
namespace syrec {
10+
11+
class RealParser {
12+
public:
13+
[[nodiscard]] static auto imports(const std::string& realString) -> qc::QuantumComputation;
14+
[[nodiscard]] static auto importf(const std::string& filename) -> qc::QuantumComputation;
15+
[[nodiscard]] static auto import(std::istream& is) -> qc::QuantumComputation;
16+
17+
private:
18+
RealParser() = default;
19+
explicit RealParser(qc::QuantumComputation& circ):
20+
qc(&circ) {}
21+
22+
qc::QuantumComputation* qc{};
23+
size_t nqubits{0};
24+
size_t nclassics{0};
25+
26+
[[nodiscard]] auto readRealHeader(std::istream& is) -> int;
27+
auto readRealGateDescriptions(std::istream& is, int line) const -> void;
28+
};
29+
} // namespace syrec

pyproject.toml

+7-11
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ requires = [
33
"scikit-build-core>=0.10.7",
44
"setuptools-scm>=8.1",
55
"pybind11>=2.13.6",
6-
"mqt.core>=3.0.0b3",
6+
"mqt.core>=3.0.0b4",
77
]
88
build-backend = "scikit_build_core.build"
99

@@ -40,7 +40,7 @@ classifiers = [
4040
]
4141
requires-python = ">=3.9"
4242
dependencies = [
43-
"mqt.core>=3.0.0b3",
43+
"mqt.core>=3.0.0b4",
4444
"PyQt6>=6.8",
4545
]
4646
dynamic = ["version"]
@@ -275,10 +275,8 @@ environment = { DEPLOY="ON" }
275275
# The SOVERSION needs to be updated when the shared libraries are updated.
276276
repair-wheel-command = """auditwheel repair -w {dest_dir} {wheel} \
277277
--exclude libmqt-core-ir.so.3.0 \
278-
--exclude libmqt-core-circuit-optimizer.so.3.0 \
279-
--exclude libmqt-core-algorithms.so.3.0 \
280-
--exclude libmqt-core-dd.so.3.0 \
281-
--exclude libmqt-core-zx.so.3.0"""
278+
--exclude libmqt-core-qasm.so.3.0 \
279+
--exclude libmqt-core-dd.so.3.0"""
282280

283281
[tool.cibuildwheel.macos]
284282
environment = { MACOSX_DEPLOYMENT_TARGET = "10.15" }
@@ -288,10 +286,8 @@ repair-wheel-command = "delocate-wheel --require-archs {delocate_archs} -w {dest
288286
before-build = "uv pip install delvewheel>=1.9.0"
289287
repair-wheel-command = """delvewheel repair -w {dest_dir} {wheel} --namespace-pkg mqt \
290288
--exclude mqt-core-ir.dll \
291-
--exclude mqt-core-circuit-optimizer.dll \
292-
--exclude mqt-core-algorithms.dll \
293-
--exclude mqt-core-dd.dll \
294-
--exclude mqt-core-zx.dll"""
289+
--exclude mqt-core-qasm.dll \
290+
--exclude mqt-core-dd.dll"""
295291
environment = { CMAKE_ARGS = "-T ClangCL" }
296292

297293
[[tool.cibuildwheel.overrides]]
@@ -312,7 +308,7 @@ build = [
312308
"pybind11>=2.13.6",
313309
"scikit-build-core>=0.10.7",
314310
"setuptools-scm>=8.1",
315-
"mqt-core>=3.0.0b3",
311+
"mqt-core>=3.0.0b4",
316312
]
317313
docs = [
318314
"furo>=2024.8.6",

0 commit comments

Comments
 (0)