17 #ifndef GRAYCODE_BASE_H 18 #define GRAYCODE_BASE_H 28 template <
typename intType>
64 n_ary_limits = n_ary_limits_;
76 n_ary_limits = n_ary_limits_;
89 memset(this->
data, value, n_ary_limits_.
size()*
sizeof(intType));
92 for (
size_t idx=0; idx < this->
size(); idx ++) {
93 this->
data[idx] = value;
97 n_ary_limits = n_ary_limits_;
125 for (intType idx=0; idx<this->
cols; idx++) {
126 if ( this->
data[idx] != gcode[idx] ) {
147 return this->
data[idx];
157 return this->
data[idx];
193 memcpy( ret.
data, this->data, this->rows*this->cols*
sizeof(intType));
212 return n_ary_limits.
copy();
227 memcpy( n_ary_limits_new.get_data(), n_ary_limits.
get_data(), n_ary_limits.
size()*
sizeof(intType) );
229 n_ary_limits_new[ n_ary_limits_new.size() -1 ] = n_ary_limit;
234 gcode_ret[ gcode_ret.
size()-1 ] = 0;
252 memcpy( n_ary_limits_new.get_data(), n_ary_limits.
get_data(), idx*
sizeof(intType) );
253 memcpy( n_ary_limits_new.get_data()+idx, n_ary_limits.
get_data()+idx+1, (n_ary_limits.
size()-idx-1)*
sizeof(intType) );
258 memcpy( gcode_ret.get_data(), this->
data, idx*
sizeof(intType) );
259 memcpy( gcode_ret.get_data()+idx, this->
data+idx+1, (this->
size()-idx-1)*
sizeof(intType) );
274 #endif // GRAYCODE_BASE_HPP GrayCode_base(const GrayCode_base &in)
Copy constructor of the class.
uint8_t padding[CACHELINE-sizeof(matrix_base< intType >) -sizeof(intType)]
padding class object to cache line borders
matrix_base< intType > get_Limits() const
Call to get the n-ary limits of the Gray code.
Copyright 2021 Budapest Quantum Computing Group.
bool owner
logical value indicating whether the class instance is the owner of the stored data or not...
matrix_base< intType > n_ary_limits
the limits of the gray code digits
matrix_base< scalar > copy() const
Call to create a copy of the matrix.
intType * data
pointer to the stored data
intType & operator[](size_t idx)
Operator [] to access elements in array style.
GrayCode_base()
Default constructor of the class.
bool transposed
logical variable indicating whether the matrix needs to be transposed in CBLAS operations ...
bool conjugated
logical variable indicating whether the matrix needs to be conjugated in CBLAS operations ...
scalar * get_data() const
Call to get the pointer to the stored data.
Base Class to store data of arrays and its properties.
void operator=(const GrayCode_base &gcode)
Overloaded assignment operator to create a copy of the state.
void operator=(const matrix_base &mtx)
Assignment operator.
GrayCode_base remove_Digit(const int idx) const
Call to add a new digit to the Gray code.
int rows
The number of rows.
int cols
The number of columns.
GrayCode_base add_Digit(const intType n_ary_limit) const
Call to add a new digit to the Gray code.
GrayCode_base(matrix_base< intType > n_ary_limits_)
Constructor of the class.
const intType & operator[](size_t idx) const
Operator [] to access a constant element in array style of constant instance.
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_base(intType value, matrix_base< intType > &n_ary_limits_)
Constructor of the class.
bool operator==(const GrayCode_base &gcode) const
Operator to compare two keys made of PicState_base class instances.
GrayCode_base(intType *data_in, matrix_base< intType > n_ary_limits_)
Constructor of the class.