Skip to content

Commit

Permalink
🚚 Move to MQT Core package (#290)
Browse files Browse the repository at this point in the history
## Description

This PR replaces the QFR submodule with the newly introduced MQT Core
library that subsumes the QFR, DD package, and ZX package. At the
moment, this entails no functional changes and only required minor
adaptions.

## 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.
  • Loading branch information
burgholzer authored Jul 8, 2023
2 parents 05f1424 + ab9c5a7 commit 0a0249f
Show file tree
Hide file tree
Showing 14 changed files with 27 additions and 29 deletions.
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "extern/qfr"]
path = extern/qfr
url = https://github.com/cda-tum/qfr.git
[submodule "extern/mqt-core"]
path = extern/mqt-core
url = https://github.com/cda-tum/mqt-core.git
branch = main
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ macro(CHECK_SUBMODULE_PRESENT modulename)
endif()
endmacro()

check_submodule_present(qfr)
check_submodule_present(mqt-core)

# add main library code
add_subdirectory(src)
Expand Down
19 changes: 9 additions & 10 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ prune docs
prune test
prune .idea

graft extern/qfr
graft extern/mqt-core
prune **/.github
prune **/apps
prune **/doc
Expand All @@ -12,12 +12,11 @@ prune **/plots
prune **/test
prune **/tests

prune extern/qfr/extern/json/include
prune extern/qfr/extern/dd_package/extern
prune extern/qfr/extern/zx/extern/googletest
prune extern/qfr/extern/zx/extern/boost/config/checks
prune extern/qfr/extern/zx/extern/boost/config/tools
prune extern/qfr/extern/zx/extern/boost/multiprecision/config
prune extern/qfr/extern/zx/extern/boost/multiprecision/example
prune extern/qfr/extern/zx/extern/boost/multiprecision/performance
prune extern/qfr/extern/zx/extern/boost/multiprecision/tools
prune extern/mqt-core/extern/json/include
prune extern/mqt-core/extern/googletest
prune extern/mqt-core/extern/boost/config/checks
prune extern/mqt-core/extern/boost/config/tools
prune extern/mqt-core/extern/boost/multiprecision/config
prune extern/mqt-core/extern/boost/multiprecision/example
prune extern/mqt-core/extern/boost/multiprecision/performance
prune extern/mqt-core/extern/boost/multiprecision/tools
1 change: 1 addition & 0 deletions extern/mqt-core
Submodule mqt-core added at 04b208
1 change: 0 additions & 1 deletion extern/qfr
Submodule qfr deleted from cc193f
2 changes: 1 addition & 1 deletion include/Configuration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Configuration {
public:
// configuration options for execution
struct Execution {
dd::fp numericalTolerance = dd::ComplexTable<>::tolerance();
dd::fp numericalTolerance = dd::ComplexTable::tolerance();

bool parallel = true;
std::size_t nthreads = std::max(2U, std::thread::hardware_concurrency());
Expand Down
2 changes: 1 addition & 1 deletion include/EquivalenceCheckingManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class EquivalenceCheckingManager {
// what is executed during `run`
void setTolerance(dd::fp tol) {
configuration.execution.numericalTolerance = tol;
dd::ComplexTable<>::setTolerance(tol);
dd::ComplexTable::setTolerance(tol);
}
void setParallel(bool parallel) {
configuration.execution.parallel = parallel;
Expand Down
4 changes: 2 additions & 2 deletions include/checker/zx/ZXChecker.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
#include "Definitions.hpp"
#include "EquivalenceCriterion.hpp"
#include "QuantumComputation.hpp"
#include "Simplify.hpp"
#include "ZXDiagram.hpp"
#include "checker/EquivalenceChecker.hpp"
#include "nlohmann/json.hpp"
#include "zx/Simplify.hpp"
#include "zx/ZXDiagram.hpp"

namespace ec {
class ZXEquivalenceChecker : public EquivalenceChecker {
Expand Down
2 changes: 1 addition & 1 deletion mqt/qcec/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pybind11_add_module(py${PROJECT_NAME} bindings.cpp)
target_link_libraries(py${PROJECT_NAME} PRIVATE ${PROJECT_NAME} MQT::qfr_python)
target_link_libraries(py${PROJECT_NAME} PRIVATE ${PROJECT_NAME} MQT::CorePython)
target_compile_definitions(py${PROJECT_NAME}
PRIVATE VERSION_INFO=${QCEC_VERSION_INFO})
6 changes: 3 additions & 3 deletions mqt/qcec/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#include "pybind11/pybind11.h"
#include "pybind11/stl.h"
#include "pybind11_json/pybind11_json.hpp"
#include "qiskit/QasmQobjExperiment.hpp"
#include "qiskit/QuantumCircuit.hpp"
#include "python/qiskit/QasmQobjExperiment.hpp"
#include "python/qiskit/QuantumCircuit.hpp"

#include <exception>
#include <memory>
Expand Down Expand Up @@ -192,7 +192,7 @@ PYBIND11_MODULE(pyqcec, m) {
// Convenience functions
// Execution
.def("set_tolerance", &EquivalenceCheckingManager::setTolerance,
"tolerance"_a = dd::ComplexTable<>::tolerance(),
"tolerance"_a = dd::ComplexTable::tolerance(),
"Set the :attr:`numerical tolerance "
"<.Configuration.Execution.numerical_tolerance>` of the underlying "
"decision diagram package.")
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def build_extension(self, ext: CMakeExtension) -> None:
f"-DPYTHON_EXECUTABLE={sys.executable}",
f"-DQCEC_VERSION_INFO={version}",
f"-DCMAKE_BUILD_TYPE={cfg}",
"-DBUILD_MQT_CORE_TESTS=OFF",
"-DBINDINGS=ON",
]
build_args = []
Expand Down
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# add MQT::qfr library
add_subdirectory("${PROJECT_SOURCE_DIR}/extern/qfr" "extern/qfr"
add_subdirectory("${PROJECT_SOURCE_DIR}/extern/mqt-core" "extern/mqt-core"
EXCLUDE_FROM_ALL)

add_library(
Expand All @@ -24,7 +24,7 @@ target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_SOURCE_DIR}/include
${PROJECT_BINARY_DIR}/include)

# link to the MQT::qfr libraries
target_link_libraries(${PROJECT_NAME} PUBLIC MQT::qfr_dd MQT::qfr_zx)
target_link_libraries(${PROJECT_NAME} PUBLIC MQT::CoreDD MQT::CoreZX)

# add MQT alias
add_library(MQT::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
1 change: 0 additions & 1 deletion src/EquivalenceCheckingManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include "EquivalenceCheckingManager.hpp"

#include "EquivalenceCriterion.hpp"
#include "Expression.hpp"
#include "zx/FunctionalityConstruction.hpp"

#include <cassert>
Expand Down
5 changes: 2 additions & 3 deletions src/checker/zx/ZXChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@

#include "Definitions.hpp"
#include "QuantumComputation.hpp"
#include "Simplify.hpp"
#include "ZXDiagram.hpp"
#include "dd/Definitions.hpp"
#include "zx/FunctionalityConstruction.hpp"
#include "zx/Simplify.hpp"
#include "zx/ZXDiagram.hpp"

#include <chrono>
#include <optional>
Expand Down

1 comment on commit 0a0249f

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cpp-Linter Report ✔️

No problems need attention.

Have any feedback or feature suggestions? Share it here.

Please sign in to comment.