56 int disentangle_qubit = qbit_num - 1;
61 for (
int qbit=0; qbit< disentangle_qubit; qbit++ ) {
76 layer->
add_cnot( target_qbit, control_qbit );
87 layer->
add_u3( disentangle_qubit );
90 layer->
add_cnot( target_qbit, control_qbit );
93 gates_block->
add_gate( (Gate*)layer );
111 std::stringstream sstream;
121 sstream << std::endl << std::endl <<
"****************************************" << std::endl;
122 sstream <<
"Test of N qubit decomposition with custom gate structure" << std::endl;
123 sstream <<
"****************************************"<< std::endl << std::endl << std::endl;
124 output.
print(sstream,verbose_level);
141 for (
int element_idx=0; element_idx<matrix_size*
matrix_size; element_idx++) {
144 int row_idx =
int((element_idx-col_idx)/matrix_size);
148 Umtx_adj[element_idx].real = element.
real;
149 Umtx_adj[element_idx].imag = -element.
imag;
155 std::map<std::string, Config_Element>
config;
158 N_Qubit_Decomposition cDecomposition(
176 cDecomposition.set_custom_gate_structure( gate_structure);
180 delete gate_structure[qbit_num-1];
186 sstream <<
"Starting the decompsition" << std::endl;
187 output.
print(sstream,verbose_level);
191 cDecomposition.start_decomposition(
true );
193 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.
Double-precision complex matrix (float64).
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 create general random unitary matrices according to arXiv:1303.5904v1. ...
dictionary gate_structure
Header file for commonly used functions and wrappers to CBLAS functions.
double real
the real part of a complex number
Matrix Construct_Unitary_Matrix()
Construct a random unitary with internally generated float64 parameters.
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