49 std::stringstream sstream;
59 sstream << std::endl << std::endl <<
"****************************************" << std::endl;
60 sstream <<
"Test of N qubit decomposition" << std::endl;
61 sstream <<
"****************************************" << std::endl << std::endl << std::endl;
62 output.
print(sstream,verbose_level);
88 for (
int element_idx=0; element_idx<matrix_size*
matrix_size; element_idx++) {
91 int row_idx =
int((element_idx-col_idx)/matrix_size);
95 Umtx_adj[element_idx].real = element.
real;
96 Umtx_adj[element_idx].imag = -element.
imag;
100 N_Qubit_Decomposition cDecomposition =
101 N_Qubit_Decomposition( Umtx_adj, qbit_num,
false,
RANDOM );
106 std::map<int,int> identical_blocks;
107 identical_blocks[3] = 1;
108 identical_blocks[4] = 2;
109 cDecomposition.set_identical_blocks( identical_blocks );
112 std::map<int,int> num_of_layers;
113 num_of_layers[2] = 3;
114 num_of_layers[3] = 12;
115 num_of_layers[4] = 60;
116 num_of_layers[5] = 240;
117 num_of_layers[6] = 960;
118 num_of_layers[7] = 3775;
119 cDecomposition.set_max_layer_num( num_of_layers );
122 std::map<int,int> num_of_iterations;
123 num_of_iterations[2] = 3;
124 num_of_iterations[3] = 1;
125 num_of_iterations[4] = 1;
126 cDecomposition.set_iteration_loops( num_of_iterations );
129 cDecomposition.set_optimization_blocks( 20 );
132 cDecomposition.set_verbose( 3 );
137 sstream <<
"Starting the decompsition" << std::endl;
138 output.
print(sstream,verbose_level);
143 cDecomposition.start_decomposition(
true);
145 cDecomposition.list_gates(1);
int main()
Decomposition of general random unitary matrix into U3 and CNOT gates.
Matrix few_CNOT_unitary(int qbit_num, int cnot_num)
Call to create a random unitary constructed by CNOT operation between randomly chosen qubits and by r...
void print(const std::stringstream &sstream, int verbose_level=1) const
Call to print output messages in the function of the verbosity level.
Header file for a class containing basic methods for setting up the verbosity level.
A class containing basic methods for setting up the verbosity level.
Umtx
The unitary to be decomposed.
Structure type representing complex numbers in the SQUANDER package.
int Power_of_2(int n)
Calculates the n-th power of 2.
Class to store data of complex arrays and its properties.
A class to cerate general random unitary matrix according to arXiv:1303:5904v1.
Header file for commonly used functions and wrappers to CBLAS functions.
double real
the real part of a complex number
Matrix Construct_Unitary_Matrix()
Call to create a random unitary.
Header file for a class to determine the decomposition of an N-qubit unitary into a sequence of CNOT ...
double imag
the imaginary part of a complex number