File embedding.hpp¶
Defines
-
DIAGNOSE(X)¶
-
namespace
find_embedding -
template <typename embedding_problem_t>
class find_embeddingembedding - #include <embedding.hpp>
This class is how we represent and manipulate embedding objects, using as much encapsulation as possible.
We provide methods to view and modify chains.
Public Functions
-
find_embedding::embedding
embedding(embedding_problem_t &e_p) constructor for an empty embedding
-
find_embedding::embedding
embedding(embedding_problem_t &e_p, map<int, vector<int>> &fixed_chains, map<int, vector<int>> &initial_chains)¶ constructor for an initial embedding: accepts fixed and initial chains, populates the embedding based on them, and attempts to link adjacent chains together.
-
embedding<embedding_problem_t> &find_embedding::embedding
operator=(const embedding<embedding_problem_t> &other) copy the data from
other.var_embeddingintothis.var_embedding
-
const chain &find_embedding::embedding
get_chain(int v) const Get the variables in a chain.
-
int find_embedding::embedding
chainsize(int v) const Get the size of a chain.
-
int find_embedding::embedding
weight(int q) const Get the weight of a qubit.
-
int find_embedding::embedding
max_weight() const Get the maximum of all qubit weights.
-
int find_embedding::embedding
max_weight(const int start, const int stop) const¶ Get the maximum of all qubit weights in a range.
-
bool find_embedding::embedding
has_qubit(const int v, const int q) const Check if variable v is includes qubit q in its chain.
-
void find_embedding::embedding
set_chain(const int u, const vector<int> &incoming) Assign a chain for variable u.
-
void find_embedding::embedding
fix_chain(const int u, const vector<int> &incoming) Permanently assign a chain for variable u.
NOTE: This must be done before any chain is assigned to u.
-
bool find_embedding::embedding
operator==(const embedding &other) const check if
thisandotherhave the same chains (up to qubit containment per chain; linking and parent information is not checked)
-
void find_embedding::embedding
construct_chain(const int u, const int q, const vector<vector<int>> &parents) construct the chain for
u, rooted atq, with a vector of parent info, where for each neiborvofu, followingq->parents[v][q]->parents[v][parents[v][q]]…terminates in the chain for
v
-
void find_embedding::embedding
flip_back(int u, const int target_chainsize) distribute path segments to the neighboring chains path segments are the qubits that are ONLY used to join link_qubit[u][v] to link_qubit[u][u] and aren’t used for any other variable
- if the target chainsize is zero, dump the entire segment into the neighbor
- if the target chainsize is k, stop when the neighbor’s size reaches k
-
void find_embedding::embedding
tear_out(int u) short tearout procedure blank out the chain, its linking qubits, and account for the qubits being freed
-
void find_embedding::embedding
steal_all(int u) grow the chain for
u, stealing all available qubits from neighboring variables
-
int find_embedding::embedding
statistics(vector<int> &stats) const compute statistics for this embedding and return
1if no chains are overlapping when no chains are overlapping, populatestatswith a chainlength histogram chains do overlap, populatestatswith a qubit overfill histogram a histogram, in this case, is a vector of size (maximum attained value+1) wherestats[i]is either the number of qubits contained ini+2chains or the number of chains with sizei
-
bool find_embedding::embedding
linked() const check if the embedding is fully linked that is, if each pair of adjacent variables is known to correspond to a pair of adjacent qubits
-
bool find_embedding::embedding
linked(int u) const¶ check if a single variable is linked with all adjacent variables.
-
void find_embedding::embedding
print() const print out this embedding to a level of detail that is useful for debugging purposes TODO describe the output format.
-
void find_embedding::embedding
long_diagnostic(char *current_state) run a long diagnostic, and if debugging is enabled, record
current_stateso that the error message has a little more context.if an error is found, throw -1
-
void find_embedding::embedding
run_long_diagnostic(char *current_state) const run a long diagnostic to verify the integrity of this datastructure.
the guts of this function are its documentation, because this function only exists for debugging purposes
Private Functions
-
bool find_embedding::embedding
linkup(int u, int v)¶ This method attempts to find the linking qubits for a pair of adjacent variables, and returns true/false on success/failure in finding that pair.
Private Members
-
embedding_problem_t &find_embedding::embedding
ep¶
-
int find_embedding::embedding
num_qubits¶
-
int find_embedding::embedding
num_reserved¶
-
int find_embedding::embedding
num_vars¶
-
int find_embedding::embedding
num_fixed¶
-
vector<chain> find_embedding::embedding
var_embedding¶ this is where we store chains see chain.hpp for how
-
vector<int> find_embedding::embedding
qub_weight¶ weights, that is, the number of non-fixed chains that use each qubit this is used in pathfinder clases to determine non-overlapped, or or least-overlapped paths through the qubit graph
-
find_embedding::embedding
-
template <typename embedding_problem_t>