113 if ( initial_offset < 0 || initial_offset >
offset_max ) {
114 std::string error(
"n_aryGrayCodeCounter::initialize: Wrong value of initial_offset");
161 int&& ret =
next(changed_index);
175 int value_prev, value;
176 int&& ret =
next( changed_index, value_prev, value);
199 bool update_counter =
true;
200 int counter_chain_idx = 0;
201 while( update_counter ) {
205 update_counter =
false;
209 update_counter =
true;
221 parity = parity ^ (gray_code_new_val & 1);
223 if ( gray_code_new_val !=
gray_code[jdx] ) {
225 value = gray_code_new_val;
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
matrix_base< scalar > copy() const
Call to create a copy of the matrix.
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.
GrayCode_base< int > GrayCode
alias for Piquassoboost state with values of type int64_t
int size() const
Call to get the number of the allocated elements.
GrayCode_base copy() const
Call to create a copy of the state.
GrayCode get()
Get the current gray code counter value.
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.