Sequential Quantum Gate Decomposer  v1.9.3
Powerful decomposition of general unitarias into one- and two-qubit gates gates
n_aryGrayCodeCounter.h
Go to the documentation of this file.
1 
17 #ifndef n_aryGrayCodeCounter_H
18 #define n_aryGrayCodeCounter_H
19 
20 #include "GrayCode.h"
21 
22 
27 
28 
29 protected:
30 
38  int64_t offset_max;
40  int64_t offset;
41 
42 public:
43 
44 
50 
55 n_aryGrayCodeCounter( matrix_base<int>& n_ary_limits_in);
56 
57 
63 n_aryGrayCodeCounter( matrix_base<int>& n_ary_limits_in, int64_t initial_offset);
64 
65 
66 
70 void initialize();
71 
72 
77 void initialize( int64_t initial_offset );
78 
79 
84 GrayCode get();
85 
86 
90 int next();
91 
92 
97 int next( int& changed_index);
98 
99 
106 int next( int& changed_index, int& value_prev, int& value);
107 
108 
109 void set_offset_max( const int64_t& value );
110 
111 
112 }; //n_aryGrayCodeCounter
113 
114 
115 
116 
117 #endif
GrayCode gray_code
the current gray code associated to the offset value
int64_t offset_max
the maximal offset in the counter offset = prod( n_ary_limits[i] )
n_aryGrayCodeCounter()
Default constructor of the class.
int64_t offset
the current offset in the counter 0<= offset <= offset_max
Header file for Grey code container.
Copyright 2021 Budapest Quantum Computing Group.
void set_offset_max(const int64_t &value)
int next()
Iterate the counter to the next value.
void initialize()
Initialize the gray counter by zero offset.
matrix_base< int > n_ary_limits
The maximal value of the individual gray code elements.
matrix_base< int > counter_chain
The incremental counter chain associated to the gray code.