50 for(
int idx = 0; idx < element_num; idx++) {
51 Umtx[idx].real = mtx_real[idx];
52 Umtx[idx].imag = mtx_imag[idx];
57 if ( initial_guess_num==0 ) {
58 initial_guess =
ZEROS;
60 else if ( initial_guess_num==1 ) {
63 else if ( initial_guess_num==2 ) {
67 printf(
"Wrong initial guess\n");
74 return (
void*)instance;
186 int iface_get_operation(
void* ptr,
int n,
int &op_type,
int &target_qbit,
int &control_qbit,
double* parameters ) {
191 int ret = instance->
get_operation( n, type, target_qbit, control_qbit, parameters );
void iface_list_operations(void *ptr, int start_index)
Call to list the operations giving the decomposition of the unitary.
int iface_get_operation_num(void *ptr)
Call to get the number of decomposing operations.
void * iface_new_N_Qubit_Decomposition(double *mtx_real, double *mtx_imag, int qbit_num, bool optimize_layer_num, int initial_guess_num)
Creates an instance of class N_Qubit_Decomposition and return with a void pointer pointing to the cla...
int iface_set_verbose(void *ptr, bool verbose)
Call to set the verbosity of the N_Qubit_Decomposition class.
int set_max_layer_num(int n, int max_layer_num_in)
Set the maximal number of layers used in the subdecomposition of the n-th qubit.
int iface_set_max_layer_num(void *ptr, int qbit, int max_layer_num)
Set the maximal number of layers used in the subdecomposition of the qbit-th qubit.
int iface_set_optimalization_block(void *ptr, int optimalization_block)
Call to set the number of blocks to be optimized in one shot.
int iface_start_decomposition(void *ptr)
Starts the decomposition of the unitary.
Header file for a methods of the QGD Python Interface.
Umtx
The unitary to be decomposed.
int iface_set_identical_blocks(void *ptr, int qbit, int identical_blocks)
Set the number of identical successive blocks during the subdecomposition of the qbit-th qubit.
int Power_of_2(int n)
Calculates the n-th power of 2.
void start_decomposition(bool finalize_decomp, bool prepare_export)
Start the disentanglig process of the unitary.
Class to store data of complex arrays and its properties.
int iface_delete_N_Qubit_Decomposition(void *ptr)
Call to deallocate the N_Qubit_Decomposition class.
int iface_get_operation(void *ptr, int n, int &op_type, int &target_qbit, int &control_qbit, double *parameters)
Call to get the n-th optimized operation.
guess_type
Type definition of the types of the initial guess.
int get_operation(unsigned int n, operation_type &type, int &target_qbit, int &control_qbit, double *parameters)
Call to prepare the optimized operations to export.
int iface_set_iteration_loops(void *ptr, int qbit, int iteration_loops)
Set the number of iteration loops during the subdecomposition of the qbit-th qubit.
int get_operation_num()
Call to get the number of operations grouped in the class.
void set_verbose(bool verbose_in)
Call to set the verbose attribute to true or false.
int set_iteration_loops(int n, int iteration_loops_in)
Set the number of iteration loops during the subdecomposition of the n-th qubit.
operation_type
Type definition of operation types (also generalized for decomposition classes derived from the class...
Header file for a class to determine the decomposition of a unitary into a sequence of CNOT and U3 op...
void list_operations(int start_index)
Call to print the operations decomposing the initial unitary.
int set_identical_blocks(int n, int identical_blocks_in)
Set the number of identical successive blocks during the subdecomposition of the n-th qubit.
void set_optimization_blocks(int optimization_block_in)
Call to set the number of operation blocks to be optimized in one shot.
A class to determine the decomposition of a unitary into a sequence of CNOT and U3 operations.