-
-
Notifications
You must be signed in to change notification settings - Fork 37
Changes Required for DD Reordering to Minimize Runtime #407
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
base: main
Are you sure you want to change the base?
Changes from 80 commits
2990adb
9e31e69
082ccef
579f602
00a92a7
cd8a2e4
105e3da
fff70f2
9e2e8a4
47e28dc
3879de4
79f9faa
9b451a5
17369f7
cb874c8
8aa5152
4ac11f4
a6da074
ddf738e
f4c6d99
55ac1d1
6f94a49
d8b98af
6f635a9
2f4fba2
246a957
c3dd9c4
136007f
62776b4
a335cad
6b2a77c
2788f5b
00e9865
e36dfaa
f1f8535
e7ef6b4
9e579e7
bc9fdad
6afcacf
81af6e4
0e503b4
6f4a7b4
a56c4bf
a4061cb
2e3a23b
4ab0b1e
e03373d
74d56c2
1fe783a
12bb49d
2eaa4c5
e1a5b3e
b46330d
8bc9018
53200c5
4d13054
46aa58a
dfc0c83
775a70f
e4a994f
b74db3a
aabac4c
c31e7ec
39f426c
3f8c523
08bbc4e
6b74748
08613ef
39c22df
1889992
e396757
17670d1
77bc202
1bdbc4f
3d79041
55364c4
9d2c78b
e9db34f
1551ada
44f2ec0
ee7eada
9cab70f
375f8c4
cf9bc98
893d3f9
502d577
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,180 @@ | ||||||||||||||||||||||||||||||
| #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 Changes the order of qubits in a QuantumComputation to heuristically | ||||||||||||||||||||||||||||||
| * optimize for short running times of the DD-simulator. | ||||||||||||||||||||||||||||||
| * @detail Computes an initialLayout for the QuantumComputation based on a | ||||||||||||||||||||||||||||||
| * heuristic to optimize the running time of the DD-simulator. After that, the | ||||||||||||||||||||||||||||||
| * initialLayout is applied, i.e. the qubits in the QuantumComputation are | ||||||||||||||||||||||||||||||
| * re-ordered such that the resulting QuantumComputation's initialLayout is | ||||||||||||||||||||||||||||||
| * the identity again. The current implementation is based on patterns found | ||||||||||||||||||||||||||||||
| * in the controlled gates. | ||||||||||||||||||||||||||||||
| * @param QuantumComputation | ||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||
| static void optimizeInputPermutation(qc::QuantumComputation& qc); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||
| * @brief Computes a permutation for the QuantumComputation based on a | ||||||||||||||||||||||||||||||
| * heuristic to optimize the running time of the DD-simulator. | ||||||||||||||||||||||||||||||
| * @param QuantumComputation | ||||||||||||||||||||||||||||||
| * @return the qc::Permutation The computed permutation to be used as the | ||||||||||||||||||||||||||||||
| * initialLayout for a QuantumComputation | ||||||||||||||||||||||||||||||
| * @details First collects operation indices of controlled operation for | ||||||||||||||||||||||||||||||
| * patterns (s. makeDataStructure). Then, based on the pattern of the | ||||||||||||||||||||||||||||||
| * controlled gates, the layout is adjusted. If no pattern is found, the | ||||||||||||||||||||||||||||||
| * control based permutation is created. | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
| * @param QuantumComputation | |
| * @return the qc::Permutation The computed permutation to be used as the | |
| * initialLayout for a QuantumComputation | |
| * @details First collects operation indices of controlled operation for | |
| * patterns (s. makeDataStructure). Then, based on the pattern of the | |
| * controlled gates, the layout is adjusted. If no pattern is found, the | |
| * control based permutation is created. | |
| * @details First collects operation indices of controlled operation for | |
| * patterns (s. makeDataStructure). Then, based on the pattern of the | |
| * controlled gates, the layout is adjusted. If no pattern is found, the | |
| * control based permutation is created. | |
| * @param qc is the QuantumComputation to optimize the layout for | |
| * @return the qc::Permutation The computed permutation to be used as the | |
| * initialLayout for a QuantumComputation |
Outdated
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.
As above, I would recommend the order @brief, @details, @param, @return as this conincides how the information would be displayed in docs generated by doxygen, for example.
Outdated
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.
When I am looking at this function with very special arguments, I wonder whether it might be better to have the variables that are arguments right now as members of the class. Then, the function would not have any arguments but, when called, would still initialize the class members.
Additionally: Does that function need to be public, or can it be private? This already applies to the function above, I guess.
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.