50 for (
int current_idx_pair=current_idx + index_step_target; current_idx_pair<
matrix_size; current_idx_pair=current_idx_pair+(index_step_target << 1) ) {
52 for(
int idx=0; idx<index_step_target; idx++) {
55 int current_idx_loc = current_idx + idx;
56 int current_idx_pair_loc = current_idx_pair + idx;
58 int row_offset = current_idx_loc*input.
stride;
59 int row_offset_pair = current_idx_pair_loc*input.
stride;
61 if ( control_qbit<0 || ((current_idx_loc >> control_qbit) & 1) ) {
63 for (
int col_idx=0; col_idx<input.
cols; col_idx++) {
65 int index = row_offset+col_idx;
66 int index_pair = row_offset_pair+col_idx;
74 input[index].real = tmp1.
real + tmp2.
real;
75 input[index].imag = tmp1.
imag + tmp2.
imag;
77 tmp1 =
mult(u3_1qbit[2], element);
78 tmp2 =
mult(u3_1qbit[3], element_pair);
80 input[index_pair].real = tmp1.
real + tmp2.
real;
81 input[index_pair].imag = tmp1.
imag + tmp2.
imag;
103 current_idx = current_idx + (index_step_target << 1);
int stride
The column stride of the array. (The array elements in one row are a_0, a_1, ... a_{cols-1}, 0, 0, 0, 0. The number of zeros is stride-cols)
QGD_Complex16 mult(QGD_Complex16 &a, QGD_Complex16 &b)
Call to calculate the product of two complex scalars.
scalar * get_data() const
Call to get the pointer to the stored data.
int cols
The number of columns.
Structure type representing complex numbers in the SQUANDER package.
Class to store data of complex arrays and its properties.
double real
the real part of a complex number
double imag
the imaginary part of a complex number