-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes Required for DD Reordering to Minimize Runtime #407
Open
Claudiaaaaaaaaa
wants to merge
86
commits into
cda-tum:main
Choose a base branch
from
Claudiaaaaaaaaa:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 67 commits
Commits
Show all changes
86 commits
Select commit
Hold shift + click to select a range
2990adb
setup of private repository with current status done
9e31e69
Merge branch 'cda-tum:main' into main
Claudiaaaaaaaaa 082ccef
Control based reordering implemented
579f602
code cleanup and results printed to file
00a92a7
Merge branch 'cda-tum:main' into main
Claudiaaaaaaaaa cd8a2e4
wrote wrapper functions for parameter parsed testing.
105e3da
corrected time measurement, documented bug with u gate
fff70f2
added empty files to provide folder structure
9e2e8a4
collected test results
47e28dc
Merge branch 'cda-tum:main' into main
Claudiaaaaaaaaa 3879de4
automized long time time measurements and results
79f9faa
Merge branch 'cda-tum:main' into main
Claudiaaaaaaaaa 9b451a5
added short qasm for pattern recognition
17369f7
implemented structure for gate based reordering
cb874c8
Implemented final logic for gate/pattern based reordering
8aa5152
added test for executing gate/pattern based reordering
4ac11f4
Merge branch 'cda-tum:main' into main
Claudiaaaaaaaaa a6da074
removed all testing environment used for development, make it pull re…
ddf738e
Merge branch 'main' of https://github.com/Claudiaaaaaaaaa/mqt-ddsim
f4c6d99
🎨 pre-commit fixes
pre-commit-ci[bot] 55ac1d1
Update src/DDMinimizer.cpp
Claudiaaaaaaaaa 6f94a49
Update src/DDMinimizer.cpp
Claudiaaaaaaaaa d8b98af
Merge branch 'cda-tum:main' into main
Claudiaaaaaaaaa 6f635a9
Final implementation
Claudiaaaaaaaaa 2f4fba2
Merge branch 'main' into main
Claudiaaaaaaaaa 246a957
🎨 pre-commit fixes
pre-commit-ci[bot] c3dd9c4
removed unneccesary include
Claudiaaaaaaaaa 136007f
Update DDMinimizer.hpp
Claudiaaaaaaaaa 62776b4
adjusted inclues for new folder structure in mqt-core
Claudiaaaaaaaaa a335cad
🎨 pre-commit fixes
pre-commit-ci[bot] 6b2a77c
fix CodeQL suggestions
Claudiaaaaaaaaa 2788f5b
Merge branch 'main' of https://github.com/Claudiaaaaaaaaa/mqt-ddsim
Claudiaaaaaaaaa 00e9865
🎨 pre-commit fixes
pre-commit-ci[bot] e36dfaa
Merge branch 'cda-tum:main' into main
Claudiaaaaaaaaa f1f8535
Added all the comments
Claudiaaaaaaaaa e7ef6b4
🎨 pre-commit fixes
pre-commit-ci[bot] 9e579e7
worked on issues from Lint
bc9fdad
Merge branch 'main' of https://github.com/Claudiaaaaaaaaa/mqt-ddsim
6afcacf
🎨 pre-commit fixes
pre-commit-ci[bot] 81af6e4
resolved naming issues from Lint
0e503b4
🎨 pre-commit fixes
pre-commit-ci[bot] 6f4a7b4
adjusted changes from .cpp
a56c4bf
Merge branch 'main' of https://github.com/Claudiaaaaaaaaa/mqt-ddsim
a4061cb
🎨 pre-commit fixes
pre-commit-ci[bot] 2e3a23b
worked on lint
4ab0b1e
🎨 pre-commit fixes
pre-commit-ci[bot] e03373d
new try for linter
74d56c2
🎨 pre-commit fixes
pre-commit-ci[bot] 1fe783a
corrected typo for lint
12bb49d
check test format
2eaa4c5
🎨 pre-commit fixes
pre-commit-ci[bot] e1a5b3e
check tests for current state
b46330d
🎨 pre-commit fixes
pre-commit-ci[bot] 8bc9018
added cx test
53200c5
🎨 pre-commit fixes
pre-commit-ci[bot] 4d13054
lint fixes
46aa58a
🎨 pre-commit fixes
pre-commit-ci[bot] dfc0c83
removed io include
775a70f
Merge branch 'main' of https://github.com/Claudiaaaaaaaaa/mqt-ddsim
e4a994f
🎨 pre-commit fixes
pre-commit-ci[bot] b74db3a
iostream
aabac4c
added more test cases
c31e7ec
🎨 pre-commit fixes
pre-commit-ci[bot] 39f426c
changed test names for lint
3f8c523
added final test
08bbc4e
🎨 pre-commit fixes
pre-commit-ci[bot] 6b74748
Merge branch 'cda-tum:main' into main
Claudiaaaaaaaaa 08613ef
Merge branch 'cda-tum:main' into main
Claudiaaaaaaaaa 39c22df
Update include/DDMinimizer.hpp
Claudiaaaaaaaaa 1889992
🎨 pre-commit fixes
pre-commit-ci[bot] e396757
Included all review changes
17670d1
🎨 pre-commit fixes
pre-commit-ci[bot] 77bc202
checked project guidelines -> ran clangd -> fixed issues
1bdbc4f
Merge branch 'cda-tum:main' into main
Claudiaaaaaaaaa 3d79041
implemented changes of overseen comments
55364c4
🎨 pre-commit fixes
pre-commit-ci[bot] 9d2c78b
added const for lint
e9db34f
small change in hopes to get token for coverage test
1551ada
Merge branch 'main' into main
burgholzer 44f2ec0
✅ slightly more compact test circuit descriptions
burgholzer ee7eada
Merge branch 'main' into main
Claudiaaaaaaaaa 9cab70f
implemented new suggested changes
375f8c4
🎨 pre-commit fixes
pre-commit-ci[bot] cf9bc98
ran clangd to pass pre commit check
893d3f9
Merge branch 'main' of https://github.com/Claudiaaaaaaaaa/mqt-ddsim
502d577
🎨 pre-commit fixes
pre-commit-ci[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
#include "Definitions.hpp" | ||
#include "ir/Permutation.hpp" | ||
#include "ir/QuantumComputation.hpp" | ||
|
||
#include <cstddef> | ||
#include <map> | ||
#include <set> | ||
#include <string> | ||
#include <utility> | ||
#include <vector> | ||
|
||
namespace qc { | ||
class DDMinimizer { | ||
|
||
public: | ||
/** | ||
* @brief creates a Heuristic based initialLayout for the QuantumComputation | ||
and applies it. The current implementation is based on pattern found in the | ||
controlled gates | ||
* @param QuantumComputation | ||
*/ | ||
ystade marked this conversation as resolved.
Show resolved
Hide resolved
|
||
static void optimizeInputPermutation(qc::QuantumComputation& qc); | ||
|
||
/** | ||
* @brief creates a Heuristic based initialLayout for the QuantumComputation. | ||
This implementation is based on pattern found in the controlled | ||
gates | ||
* @param QuantumComputation | ||
* @return the qc::Permutation | ||
*/ | ||
ystade marked this conversation as resolved.
Show resolved
Hide resolved
|
||
static qc::Permutation createGateBasedPermutation(qc::QuantumComputation& qc); | ||
|
||
// Helper functions for createGateBasedPermutation | ||
/** | ||
* @brief creates a data structure for the pattern analysis of controlled gates | ||
* @param QuantumComputation | ||
* @return a pair of maps: | ||
1. map string of c_x, x_c, c_l, x_l, c_r, x_r ladder step to control | ||
and target bit to the index of the gate | ||
2. map: string of c_x, x_c, c_l, x_l, c_r, x_r ladder to vector of max | ||
index of gate for the indices: for c_l and x_l position 0 in the vector marks | ||
the line of c(x) at 0 -> we count the left most as the first for c_r and x_r | ||
position 0 in the vector marks the line of c(x) at bits - 1 -> we count the | ||
right most as the first | ||
*/ | ||
ystade marked this conversation as resolved.
Show resolved
Hide resolved
|
||
static std::pair< | ||
std::map<std::string, std::map<std::pair<Qubit, Qubit>, int>>, | ||
std::map<std::string, std::vector<int>>> | ||
makeDataStructure(qc::QuantumComputation& qc); | ||
|
||
// Functions to analyze the pattern of the controlled gates | ||
static bool isFull(const std::vector<int>& vec); | ||
static int getStairCount(const std::vector<int>& vec); | ||
static int getLadderPosition(const std::vector<int>& vec, int laadder); | ||
|
||
// Functions to adjust the layout based on the pattern of the controlled gates | ||
static std::vector<Qubit> reverseLayout(std::vector<Qubit> layout); | ||
static std::vector<Qubit> rotateRight(std::vector<Qubit> layout, int stairs); | ||
static std::vector<Qubit> rotateLeft(std::vector<Qubit> layout, int stairs); | ||
|
||
/** | ||
* @brief creates a Heuristic based initialLayout for the QuantumComputation. | ||
This implementation is based on which qubits are controlled by which | ||
qubits | ||
* @param QuantumComputation | ||
* @return the qc::Permutation | ||
*/ | ||
ystade marked this conversation as resolved.
Show resolved
Hide resolved
|
||
static qc::Permutation | ||
createControlBasedPermutation(qc::QuantumComputation& qc); | ||
|
||
// Helper function for createControlBasedPermutation | ||
|
||
/** | ||
* @brief recursively adjusts the weights of the qubits based on the control | ||
* and target qubits | ||
* @param map of qubit to weight, current set of target qubits, current | ||
* control qubit, overall map of control qubit to target qubits, count of | ||
* recoursive calls | ||
* @return adjusted map of qubit to weight | ||
*/ | ||
static std::map<Qubit, int> | ||
adjustWeights(std::map<Qubit, int> qubitWeights, | ||
const std::set<Qubit>& targets, Qubit ctrl, | ||
const std::map<Qubit, std::set<Qubit>>& controlToTargets, | ||
int count); | ||
|
||
/** | ||
* @brief creates a vector of all possible permutations of the initialLayout | ||
used for first implementation of testing all Permutations and | ||
drawing conclusions | ||
* @param QuantumComputation | ||
*/ | ||
static std::vector<qc::Permutation> | ||
createAllPermutations(qc::QuantumComputation& qc); | ||
|
||
/** | ||
* @brief Helper function to compute how many permutations there are for a set | ||
* number of qubits | ||
* @param number of Bits | ||
*/ | ||
static std::size_t factorial(std::size_t n); | ||
|
||
}; // class DDMinimizer | ||
} // namespace qc |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.