|
Sequential Quantum Gate Decomposer
v1.9.7
Powerful decomposition of general unitarias into one- and two-qubit gates gates
|
Class implementing the adaptive gate decomposition algorithm of arXiv:2203.04426. More...
#include "N_Qubit_Decomposition_Tree_Search.h"#include "N_Qubit_Decomposition_Cost_Function.h"#include "n_aryGrayCodeCounter.h"#include <algorithm>#include <atomic>#include <chrono>#include <cmath>#include <iostream>#include <numeric>#include <queue>#include <random>#include <stdlib.h>#include <thread>#include <time.h>#include <unordered_map>
Go to the source code of this file.
Classes | |
| struct | ForbiddenSubseqSet |
| struct | LevelResult |
| Structure containing the result of a BFS level enumeration. More... | |
Typedefs | |
| using | Discovery = std::vector< std::pair< std::vector< int >, GrayCodeCNOT > > |
Functions | |
| std::vector< uint32_t > | build_pred_mask (const GrayCodeCNOT &ops, const std::vector< matrix_base< int >> &topology) |
| static int | canonical_prefix_ok (const GrayCodeCNOT &path, const std::vector< matrix_base< int >> &topology) |
| bool | contains_topological_subsequence (const GrayCodeCNOT &smallpath, const GrayCodeCNOT &bigpath, const std::vector< matrix_base< int >> &topology) |
| static LevelResult | enumerate_unordered_cnot_BFS_level_init (int n) |
| Initialize the breadth-first search (BFS) enumeration at depth 0 (identity state only). More... | |
| static LevelResult | enumerate_unordered_cnot_BFS_level_step (LevelInfo &L, const std::vector< matrix_base< int >> &topology, bool use_gl=true) |
| Perform one expansion level of breadth-first search (BFS) enumeration over CNOT gate structures. More... | |
| template<class Callback > | |
| void | generate_insertions (const GrayCodeCNOT &curpath, const std::vector< matrix_base< int >> &topology, const std::vector< int > &topo_filt, int num_cnot, Callback &&callback) |
| template<class Callback > | |
| void | generate_insertions_recursive (const GrayCodeCNOT &curpath, const std::vector< matrix_base< int >> &topology, const std::vector< int > &topo_filt, int num_cnot, std::vector< int > &places, std::vector< int > &pairs, int depth, int min_place, Callback &&callback, bool &early_stop) |
| static int | is_unique_structure (const GrayCodeCNOT &path, const std::vector< matrix_base< int >> &topology) |
Class implementing the adaptive gate decomposition algorithm of arXiv:2203.04426.
Definition in file N_Qubit_Decomposition_Tree_Search.cpp.
| using Discovery = std::vector<std::pair<std::vector<int>, GrayCodeCNOT> > |
Definition at line 54 of file N_Qubit_Decomposition_Tree_Search.cpp.
| std::vector<uint32_t> build_pred_mask | ( | const GrayCodeCNOT & | ops, |
| const std::vector< matrix_base< int >> & | topology | ||
| ) |
Definition at line 843 of file N_Qubit_Decomposition_Tree_Search.cpp.


|
static |
Definition at line 96 of file N_Qubit_Decomposition_Tree_Search.cpp.


| bool contains_topological_subsequence | ( | const GrayCodeCNOT & | smallpath, |
| const GrayCodeCNOT & | bigpath, | ||
| const std::vector< matrix_base< int >> & | topology | ||
| ) |
Definition at line 870 of file N_Qubit_Decomposition_Tree_Search.cpp.


|
inlinestatic |
Initialize the breadth-first search (BFS) enumeration at depth 0 (identity state only).
This function sets up the initial state for BFS enumeration of CNOT gate structures. At depth 0, the state represents the identity operation (no CNOT gates applied), where each qubit is in its own computational basis state. The function creates the initial state vector I, where each element I[i] = 2^i represents the i-th qubit's basis state, marks it as visited, and initializes the sequence pairs mapping with an empty Gray code.
| n | The number of qubits in the system |
Definition at line 73 of file N_Qubit_Decomposition_Tree_Search.cpp.

|
inlinestatic |
Perform one expansion level of breadth-first search (BFS) enumeration over CNOT gate structures.
This function processes all states in the current BFS level queue, applies all possible CNOT operations from the topology, and discovers new states at the next depth level. It maintains the BFS property that states are discovered at their minimal depth, ensuring optimal exploration of the gate structure space.
The function operates in two modes:
| L | LevelInfo reference containing the current BFS state:
|
| topology | Vector of CNOT pairs (target, control) representing allowed qubit connections. Each element is a matrix_base<int> with two elements [target, control]. |
| use_gl | If true, uses Gray-Lin mode (applies CNOTs directly to states). If false, builds sequence-based representations with canonical ordering constraints. |
Definition at line 194 of file N_Qubit_Decomposition_Tree_Search.cpp.


| void generate_insertions | ( | const GrayCodeCNOT & | curpath, |
| const std::vector< matrix_base< int >> & | topology, | ||
| const std::vector< int > & | topo_filt, | ||
| int | num_cnot, | ||
| Callback && | callback | ||
| ) |
Definition at line 327 of file N_Qubit_Decomposition_Tree_Search.cpp.


| void generate_insertions_recursive | ( | const GrayCodeCNOT & | curpath, |
| const std::vector< matrix_base< int >> & | topology, | ||
| const std::vector< int > & | topo_filt, | ||
| int | num_cnot, | ||
| std::vector< int > & | places, | ||
| std::vector< int > & | pairs, | ||
| int | depth, | ||
| int | min_place, | ||
| Callback && | callback, | ||
| bool & | early_stop | ||
| ) |
Definition at line 266 of file N_Qubit_Decomposition_Tree_Search.cpp.


|
static |
Definition at line 157 of file N_Qubit_Decomposition_Tree_Search.cpp.


1.8.13