-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathDDMinimizer.hpp
58 lines (49 loc) · 1.71 KB
/
DDMinimizer.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include "Definitions.hpp"
#include "Permutation.hpp"
#include "QuantumComputation.hpp"
#include <algorithm>
#include <cstddef>
#include <map>
#include <string>
#include <utility>
#include <vector>
namespace qc {
class DDMinimizer {
public:
/**
* @brief creates a vector hopefully the best initial Layout and applies it
* @param QuantumComputation
*/
static void optimizeInputPermutation(qc::QuantumComputation);
static qc::Permutation createGateBasedPermutation(qc::QuantumComputation& qc);
static bool isFull(std::vector<int> vec);
static int getStairCount(std::vector<int> vec);
static int getLadderPosition(std::vector<int> vec, int laadder);
static std::vector<Qubit> reverseLayout(std::vector<Qubit> layout);
static std::vector<Qubit> rotateRight(std::vector<Qubit> layout);
static std::vector<Qubit> rotateLeft(std::vector<Qubit> layout);
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);
/**
* @brief creates a possible permutations of the initialLayout based on how to
* control bits are located
* @param QuantumComputation
*/
static qc::Permutation
createControlBasedPermutation(qc::QuantumComputation& qc);
/**
* @brief creates a vector of all possible permutations of the initialLayout
* @param QuantumComputation
*/
static std::vector<qc::Permutation>
createAllPermutations(qc::QuantumComputation& qc);
/**
* @brief Helper function to compute how many permutations there are for a
* number of qubits
* @param number of Bits
*/
static std::size_t factorial(std::size_t n);
}; // class DDMinimizer
} // namespace qc