Quantum Gate Decomposer  v1.3
Powerful decomposition of almost any unitary into U3 and CNOT gates
Functions
python_interface.h File Reference

Header file for a methods of the QGD Python Interface. More...

#include "qgd/Operation.h"
Include dependency graph for python_interface.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int iface_delete_N_Qubit_Decomposition (void *ptr)
 Call to deallocate the N_Qubit_Decomposition class. More...
 
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. More...
 
int iface_get_operation_num (void *ptr)
 Call to get the number of decomposing operations. More...
 
void iface_list_operations (void *ptr, int start_index)
 Call to list the operations giving the decomposition of the unitary. More...
 
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 class instance. More...
 
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. More...
 
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. More...
 
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. More...
 
int iface_set_optimalization_block (void *ptr, int optimalization_block)
 Call to set the number of blocks to be optimized in one shot. More...
 
int iface_set_verbose (void *ptr, bool verbose)
 Call to set the verbosity of the N_Qubit_Decomposition class. More...
 
int iface_start_decomposition (void *ptr)
 Starts the decomposition of the unitary. More...
 

Detailed Description

Header file for a methods of the QGD Python Interface.

Definition in file python_interface.h.

Function Documentation

◆ iface_delete_N_Qubit_Decomposition()

int iface_delete_N_Qubit_Decomposition ( void *  ptr)

Call to deallocate the N_Qubit_Decomposition class.

Parameters
ptrA void pointer pointing to an instance of N_Qubit_Decomposition class.

Definition at line 99 of file python_interface.cpp.

◆ iface_get_operation()

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.

The values are returned via the input parameter references, and pointers

Parameters
ptrA void pointer pointing to an instance of N_Qubit_Decomposition class.
nInteger labeling the n-th oepration (n>=0).
op_typeThe type of operation. (Possible values: CNOT_OPERATION=2, U3_OPERATION=3)
target_qbitThe id of the target qubit.
control_qbitThe id of the control qubit.
parametersA pointer pointing to the 3-component array conatining the parameters of the U3 operation.
Returns
Returns with 0 if the export of the n-th operation was successful. If the n-th operation does not exists, -1 is returned. If the operation is not allowed to be exported, i.e. it is not a CNOT or U3 operation, then -2 is returned.

Definition at line 186 of file python_interface.cpp.

Here is the call graph for this function:

◆ iface_get_operation_num()

int iface_get_operation_num ( void *  ptr)

Call to get the number of decomposing operations.

Parameters
ptrA void pointer pointing to an instance of N_Qubit_Decomposition class.

Definition at line 167 of file python_interface.cpp.

Here is the call graph for this function:

◆ iface_list_operations()

void iface_list_operations ( void *  ptr,
int  start_index 
)

Call to list the operations giving the decomposition of the unitary.

Parameters
ptrA void pointer pointing to an instance of N_Qubit_Decomposition class.
start_indexThe starting number of the operations to be listed.

Definition at line 156 of file python_interface.cpp.

Here is the call graph for this function:

◆ iface_new_N_Qubit_Decomposition()

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 class instance.

Parameters
mtx_realPointer to the real part of the unitary to be decomposed
mtx_imagPointer to the imaginary part of the unitary to be decomposed
qbit_numNumber of qubits spanning the unitary
optimize_layer_numLogical value. Set true to optimize the number of decomposing layers during the decomposition procedure, or false otherwise.
initial_guess_numInteger encoding the method to guess initial values for the optimalization. Possible values: 'zeros=0','random=1', 'close_to_zero=2'
Returns
Return with a void pointer pointing to an instance of N_Qubit_Decomposition class.
Parameters
mtx_realPointer to the real part of the unitary to be decomposed
mtx_imagPointer to the imaginary part of the unitary to be decomposed
qbit_numNumber of qubits spanning the unitary
optimize_layer_numLogical value. Set true to optimize the number of decomposing layers during the decomposition procedure, or false otherwise.
initial_guess_numInteger encoding the method to guess initial values for the optimization. Possible values: 'zeros=0','random=1', 'close_to_zero=2'
Returns
Return with a void pointer pointing to an instance of N_Qubit_Decomposition class.

Definition at line 41 of file python_interface.cpp.

Here is the call graph for this function:

◆ iface_set_identical_blocks()

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.

Parameters
ptrA void pointer pointing to an instance of N_Qubit_Decomposition class.
qbitThe number of qubits for which the subdecomposition should contain identical_blocks successive identical blocks.
identical_blocksNumber of successive identical blocks in the decomposition.

Definition at line 118 of file python_interface.cpp.

Here is the call graph for this function:

◆ iface_set_iteration_loops()

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.

Parameters
ptrA void pointer pointing to an instance of N_Qubit_Decomposition class.
qbitThe number of qubits for which the subdecomposition should run iteration_loops number of iterations in each step of the optimization.
iteration_loopsNumber of iteration in each step of the subdecomposition.

Definition at line 131 of file python_interface.cpp.

Here is the call graph for this function:

◆ iface_set_max_layer_num()

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.

Parameters
ptrA void pointer pointing to an instance of N_Qubit_Decomposition class.
qbitThe number of qubits for which the subdecomposition should contain maximum max_layer_num layers of operation blocks.
max_layer_numThe number of maximal number of layers used in the subdecomposition.

Definition at line 144 of file python_interface.cpp.

Here is the call graph for this function:

◆ iface_set_optimalization_block()

int iface_set_optimalization_block ( void *  ptr,
int  optimalization_block 
)

Call to set the number of blocks to be optimized in one shot.

Parameters
ptrA void pointer pointing to an instance of N_Qubit_Decomposition class.
optimalization_blockThe number of blocks to be optimized in one shot
Returns
Returns with 0 on success

Definition at line 223 of file python_interface.cpp.

Here is the call graph for this function:

◆ iface_set_verbose()

int iface_set_verbose ( void *  ptr,
bool  verbose 
)

Call to set the verbosity of the N_Qubit_Decomposition class.

Parameters
ptrA void pointer pointing to an instance of N_Qubit_Decomposition class.
verboseSet False to suppress the output messages of the decompostion, or True (deafult) otherwise.
Returns
Returns with 0 on success

Definition at line 207 of file python_interface.cpp.

Here is the call graph for this function:

◆ iface_start_decomposition()

int iface_start_decomposition ( void *  ptr)

Starts the decomposition of the unitary.

Parameters
ptrA void pointer pointing to an instance of N_Qubit_Decomposition class.

Definition at line 85 of file python_interface.cpp.

Here is the call graph for this function: