56 int disentangle_qubit = qbit_num - 1;
61 for (
int qbit=0; qbit< disentangle_qubit; qbit++ ) {
75 layer->
add_u3( 0, Theta, Phi, Lambda );
76 layer->
add_u3( 1, Theta, Phi, Lambda );
79 layer->
add_cnot( target_qbit, control_qbit );
92 layer->
add_u3( qbit, Theta, Phi, Lambda );
93 layer->
add_u3( disentangle_qubit, Theta, Phi, Lambda );
96 layer->
add_cnot( target_qbit, control_qbit );
117 std::stringstream sstream;
127 sstream << std::endl << std::endl <<
"****************************************" << std::endl;
128 sstream <<
"Test of N qubit decomposition with custom gate structure" << std::endl;
129 sstream <<
"****************************************"<< std::endl << std::endl << std::endl;
130 output.
print(sstream,verbose_level);
147 for (
int element_idx=0; element_idx<matrix_size*
matrix_size; element_idx++) {
150 int row_idx =
int((element_idx-col_idx)/matrix_size);
154 Umtx_adj[element_idx].real = element.
real;
155 Umtx_adj[element_idx].imag = -element.
imag;
161 N_Qubit_Decomposition cDecomposition =
162 N_Qubit_Decomposition( Umtx_adj, qbit_num,
false,
RANDOM );
174 cDecomposition.set_custom_gate_structure( gate_structure);
178 delete gate_structure[qbit_num-1];
184 sstream <<
"Starting the decompsition" << std::endl;
185 output.
print(sstream,verbose_level);
189 cDecomposition.start_decomposition(
true,
true);
191 cDecomposition.list_gates(1);
void print(const std::stringstream &sstream, int verbose_level=1) const
Call to print output messages in the function of the verbosity level.
void add_gate(Gate *gate)
Append a general gate to the list of gates.
Gates_block * create_custom_gate_structure(int qbit_num)
Function to create custom gate structure for the decomposition.
void add_cnot(int target_qbit, int control_qbit)
Append a CNOT gate gate to the list of gates.
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.
void add_u3(int target_qbit)
Append a U3 gate to the list of gates.
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.
int main()
Decomposition of general random unitary matrix into a custom structure of U3 and CNOT gates...
A class responsible for grouping two-qubit (CNOT,CZ,CH) and one-qubit gates into layers.
A class to cerate general random unitary matrix according to arXiv:1303:5904v1.
dictionary gate_structure
Base class for the representation of general gate operations.
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