Sequential Quantum Gate Decomposer  v1.9.6
Powerful decomposition of general unitarias into one- and two-qubit gates gates
Classes | Macros | Functions | Variables
qgd_N_Qubit_Decompositions_Wrapper.cpp File Reference
#include <Python.h>
#include <numpy/arrayobject.h>
#include "structmember.h"
#include <stdio.h>
#include <complex>
#include <cmath>
#include <cstring>
#include <cctype>
#include <strings.h>
#include "numpy_interface.h"
#include "matrix_any.h"
#include "matrix_real_any.h"
#include "N_Qubit_Decomposition.h"
#include "N_Qubit_Decomposition_adaptive.h"
#include "N_Qubit_Decomposition_Tree_Search.h"
#include "N_Qubit_Decomposition_Tabu_Search.h"
#include "Gates_block.h"
Include dependency graph for qgd_N_Qubit_Decompositions_Wrapper.cpp:

Go to the source code of this file.

Classes

struct  qgd_Circuit_Wrapper
 Type definition for qgd_Circuit_Wrapper. More...
 
struct  qgd_N_Qubit_Decomposition_Wrapper
 Type definition of the unified N-Qubit Decomposition wrapper. More...
 

Macros

#define CIRQ_ADD_ROTATION_GATE(name, param)
 
#define CIRQ_ADD_SINGLE_QUBIT_GATE(name)
 Method to get Cirq circuit representation. More...
 
#define CIRQ_ADD_TWO_QUBIT_GATE(name)
 
#define DECOMPOSITION_WRAPPER_BASE_METHODS
 Base methods shared by all decomposition types These methods are available for all decomposition classes. More...
 
#define decomposition_wrapper_type_template(decomp_class)
 
#define NPY_NO_DEPRECATED_API   NPY_1_7_API_VERSION
 
#define Py_INCREF_template(decomp_name)
 
#define PY_SSIZE_T_CLEAN
 

Functions

static bool config_requests_float (std::map< std::string, Config_Element > &config)
 
 decomposition_wrapper_type_template (N_Qubit_Decomposition) decomposition_wrapper_type_template(N_Qubit_Decomposition_adaptive) decomposition_wrapper_type_template(N_Qubit_Decomposition_custom) decomposition_wrapper_type_template(N_Qubit_Decomposition_Tree_Search) decomposition_wrapper_type_template(N_Qubit_Decomposition_Tabu_Search) static PyModuleDef qgd_N_Qubit_Decompositions_Wrapper_Module
 Structure containing metadata about the module. More...
 
std::map< std::string, Config_Elementextract_config (PyObject *config_arg)
 Extract config dictionary. More...
 
guess_type extract_guess_type (PyObject *initial_guess)
 Extract guess_type from Python string/object. More...
 
Matrix extract_matrix (PyObject *Umtx_arg, PyArrayObject **store_ref)
 Extract and validate Matrix from numpy array. More...
 
void extract_matrix_any (PyObject *matrix_arg, PyArrayObject **store_ref, Matrix &matrix64, Matrix_float &matrix32, bool &is_float32)
 Extract complex64/complex128 numpy input without rejecting float32 callers. More...
 
void extract_parameters_any (PyObject *parameters_arg, PyArrayObject **store_ref, Matrix_real &parameters64, Matrix_real_float &parameters32, bool &is_float32)
 Extract real float32/float64 parameters without forced precision conversion. More...
 
std::vector< matrix_base< int > > extract_topology (PyObject *topology)
 Extract topology list from Python. More...
 
Matrix_real parameters_float_to_double (Matrix_real_float &parameters32)
 
PyMODINIT_FUNC PyInit_qgd_N_Qubit_Decompositions_Wrapper (void)
 Method called when the Python module is initialized. More...
 
static int qgd_N_Qubit_Decomposition_adaptive_Wrapper_init (qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args, PyObject *kwds)
 
static int qgd_N_Qubit_Decomposition_custom_Wrapper_init (qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args, PyObject *kwds)
 
static int qgd_N_Qubit_Decomposition_Tabu_Search_Wrapper_init (qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args, PyObject *kwds)
 
static int qgd_N_Qubit_Decomposition_Tree_Search_Wrapper_init (qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args, PyObject *kwds)
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_add_Adaptive_Layers (qgd_N_Qubit_Decomposition_Wrapper *self)
 Wrapper method to add adaptive layers to the gate structure stored by the class. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_add_Finalyzing_Layer_To_Gate_Structure (qgd_N_Qubit_Decomposition_Wrapper *self)
 Wrapper function to add finalyzing layer (single qubit rotations on all qubits) to the gate structure. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_add_Gate_Structure_From_Binary (qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args)
 Wrapper function to append custom layers to the gate structure from binary file. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_add_Layer_To_Imported_Gate_Structure (qgd_N_Qubit_Decomposition_Wrapper *self)
 Wrapper method to add layer to imported gate structure. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_apply_Global_Phase_Factor (qgd_N_Qubit_Decomposition_Wrapper *self)
 Apply global phase factor to the unitary matrix. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_apply_Imported_Gate_Structure (qgd_N_Qubit_Decomposition_Wrapper *self)
 Wrapper function to apply the imported gate structure on the unitary. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_Compress_Circuit (qgd_N_Qubit_Decomposition_Wrapper *self)
 Call to compress circuit. More...
 
static void qgd_N_Qubit_Decomposition_Wrapper_dealloc (qgd_N_Qubit_Decomposition_Wrapper *self)
 Called when Python object is destroyed. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_export_Unitary (qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args)
 Export unitary matrix to binary file. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_Finalize_Circuit (qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args, PyObject *kwds)
 Call to finalize circuit. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_get_Circuit (qgd_N_Qubit_Decomposition_Wrapper *self)
 Call to get the incorporated circuit. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_get_Cirq_Circuit (qgd_N_Qubit_Decomposition_Wrapper *self)
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_get_Decomposition_Error (qgd_N_Qubit_Decomposition_Wrapper *self)
 Get the error of the decomposition. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_get_Gate_Num (qgd_N_Qubit_Decomposition_Wrapper *self)
 Call to get the number of gates. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_get_Gates (qgd_N_Qubit_Decomposition_Wrapper *self)
 Method to get gates as a list of dictionaries (with parameters from optimized_parameters array) More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_get_Global_Phase (qgd_N_Qubit_Decomposition_Wrapper *self)
 Call to get the global phase factor (returns the angle of the global phase) More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_get_Initial_Circuit (qgd_N_Qubit_Decomposition_Wrapper *self)
 Call to get initial circuit. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_get_Matrix (qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args, PyObject *kwds)
 Call to get the matrix representation of the circuit with given parameters. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_get_Num_of_Iters (qgd_N_Qubit_Decomposition_Wrapper *self)
 Get the number of free parameters in the gate structure used for the decomposition. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_get_Optimized_Parameters (qgd_N_Qubit_Decomposition_Wrapper *self)
 Call to get the optimized parameters. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_get_Parameter_Num (qgd_N_Qubit_Decomposition_Wrapper *self)
 Get the number of free parameters in the gate structure used for the decomposition. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_get_Project_Name (qgd_N_Qubit_Decomposition_Wrapper *self)
 Call to get the project name. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_get_Qbit_Num (qgd_N_Qubit_Decomposition_Wrapper *self)
 Get the number of qubits. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_get_Qiskit_Circuit (qgd_N_Qubit_Decomposition_Wrapper *self)
 Method to get Qiskit circuit representation. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_get_Second_Renyi_Entropy (qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args)
 Get second Renyi entropy. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_get_Trace_Offset (qgd_N_Qubit_Decomposition_Wrapper *self)
 Get trace offset of the compression. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_get_Unitary (qgd_N_Qubit_Decomposition_Wrapper *self)
 Call to get the unitary matrix. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_import_Qiskit_Circuit (qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args)
 Method to import Qiskit circuit. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_import_Qiskit_Circuit_adaptive (qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *qc_in)
 Method to import Qiskit circuit (adaptive-specific version with custom CZ decomposition) More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_import_Qiskit_Circuit_standard (qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *qc_in)
 Method to import Qiskit circuit (standard version for non-adaptive decompositions) More...
 
static int qgd_N_Qubit_Decomposition_Wrapper_init (qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args, PyObject *kwds)
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_List_Gates (qgd_N_Qubit_Decomposition_Wrapper *self)
 Call to list the gates decomposing the unitary. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_new (PyTypeObject *type, PyObject *args, PyObject *kwds)
 Allocate memory for new Python object. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_Optimization_Problem (qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args)
 Call to evaluate the optimization problem (cost function) More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_Optimization_Problem_Batch (qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args)
 Call to evaluate the optimization problem for batched parameters. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_Optimization_Problem_Combined (qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args)
 Call to evaluate the optimization problem with cost and gradient combined. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_Optimization_Problem_Combined_Unitary (qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args)
 Call to evaluate the optimization problem with unitary and derivatives. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_Optimization_Problem_Grad (qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args)
 Call to evaluate the gradient of the optimization problem. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_Reorder_Qubits (qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args)
 Method to reorder the qubits in the decomposition class. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_set_Convergence_Threshold (qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args)
 Wrapper method to set the threshold of convergence. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_set_Cost_Function_Variant (qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args, PyObject *kwds)
 Call to set the cost function variant. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_set_Debugfile (qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args)
 Set the debugfile name of the decomposition class. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_set_Gate_Structure (qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args)
 Wrapper function to set custom gate structure for the decomposition. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_set_Gate_Structure_From_Binary (qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args)
 Wrapper function to set custom layers to the gate structure that are intended to be used in the decomposition. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_set_Global_Phase (qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args)
 Call to set the global phase. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_set_Identical_Blocks (qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args)
 Set the number of identical successive blocks (N_Qubit_Decomposition only) More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_set_Iteration_Loops (qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args)
 Set the number of iteration loops during the subdecomposition of the qbit-th qubit. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_set_Max_Iterations (qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args)
 Set the number of maximum iterations for optimization. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_set_Max_Layer_Num (qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args)
 Set the maximal number of layers used in the subdecomposition of the qbit-th qubit. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_set_Optimization_Blocks (qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args)
 Wrapper method to set the number of gate blocks to be optimized. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_set_Optimization_Tolerance (qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args)
 Wrapper method to set the optimization tolerance. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_set_Optimized_Parameters (qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args)
 Extract the optimized parameters. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_set_Optimizer (qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args, PyObject *kwds)
 Call to set the optimizer algorithm. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_set_Project_Name (qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args)
 Call to set the project name. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_set_Trace_Offset (qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args, PyObject *kwds)
 Set trace offset for the compression. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_set_Unitary (qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args)
 Call to set unitary matrix. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_set_Unitary_From_Binary (qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args)
 Wrapper function to set unitary from binary file. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_set_Verbose (qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args)
 Set the verbosity of the decomposition class. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_Start_Decomposition (qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args, PyObject *kwds)
 Wrapper function to call the start_decomposition method of C++ class N_Qubit_Decomposition. More...
 
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_Upload_Umtx_to_DFE (qgd_N_Qubit_Decomposition_Wrapper *self)
 Upload unitary matrix to DFE. More...
 
template<typename DecompT >
void release_decomposition (DecompT *instance)
 Deallocate decomposition instance. More...
 
template<typename DecompT >
static int search_wrapper_init (qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args, PyObject *kwds)
 

Variables

static PyMethodDef qgd_N_Qubit_Decomposition_adaptive_methods []
 Method table for N_Qubit_Decomposition_adaptive. More...
 
static PyMethodDef qgd_N_Qubit_Decomposition_custom_methods []
 Method table for N_Qubit_Decomposition_custom. More...
 
static PyMethodDef qgd_N_Qubit_Decomposition_methods []
 Method table for base N_Qubit_Decomposition. More...
 
static PyMethodDef qgd_N_Qubit_Decomposition_Tabu_Search_methods []
 Method table for N_Qubit_Decomposition_Tabu_Search. More...
 
static PyMethodDef qgd_N_Qubit_Decomposition_Tree_Search_methods []
 Method table for N_Qubit_Decomposition_Tree_Search. More...
 

Macro Definition Documentation

◆ CIRQ_ADD_ROTATION_GATE

#define CIRQ_ADD_ROTATION_GATE (   name,
  param 
)
Value:
do { \
PyObject* param_obj = PyDict_GetItemString(gate, param); \
if (!param_obj) continue; \
PyObject* gate_func = PyObject_GetAttrString(cirq_module, #name); \
PyObject* gate_args = PyTuple_Pack(1, param_obj); \
PyObject* cirq_gate = PyObject_CallObject(gate_func, gate_args); \
Py_DECREF(gate_args); Py_DECREF(gate_func); \
if (cirq_gate) { \
PyObject* on_method = PyObject_GetAttrString(cirq_gate, "on"); \
PyObject* on_args = PyTuple_Pack(1, target_qubit); \
PyObject* gate_op = PyObject_CallObject(on_method, on_args); \
Py_DECREF(on_args); Py_DECREF(on_method); Py_DECREF(cirq_gate); \
if (gate_op) { \
PyObject* append_args = PyTuple_Pack(1, gate_op); \
PyObject_CallObject(append_func, append_args); \
Py_DECREF(append_args); Py_DECREF(gate_op); \
} \
} \
} while(0)

Definition at line 2480 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

◆ CIRQ_ADD_SINGLE_QUBIT_GATE

#define CIRQ_ADD_SINGLE_QUBIT_GATE (   name)
Value:
do { \
PyObject* gate_func = PyObject_GetAttrString(cirq_module, #name); \
PyObject* gate_args = PyTuple_Pack(1, target_qubit); \
PyObject* cirq_gate = PyObject_CallObject(gate_func, gate_args); \
Py_DECREF(gate_args); Py_DECREF(gate_func); \
if (cirq_gate) { \
PyObject* append_args = PyTuple_Pack(1, cirq_gate); \
PyObject_CallObject(append_func, append_args); \
Py_DECREF(append_args); Py_DECREF(cirq_gate); \
} \
} while(0)

Method to get Cirq circuit representation.

Returns
Returns with a Cirq Circuit object

Definition at line 2451 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

◆ CIRQ_ADD_TWO_QUBIT_GATE

#define CIRQ_ADD_TWO_QUBIT_GATE (   name)
Value:
do { \
PyObject* control_qbit_obj = PyDict_GetItemString(gate, "control_qbit"); \
if (!control_qbit_obj) continue; \
long control_idx = qbit_num - 1 - PyLong_AsLong(control_qbit_obj); \
PyObject* control_qubit = PyList_GetItem(qubits, control_idx); \
PyObject* gate_func = PyObject_GetAttrString(cirq_module, #name); \
PyObject* gate_args = PyTuple_Pack(2, control_qubit, target_qubit); \
PyObject* cirq_gate = PyObject_CallObject(gate_func, gate_args); \
Py_DECREF(gate_args); Py_DECREF(gate_func); \
if (cirq_gate) { \
PyObject* append_args = PyTuple_Pack(1, cirq_gate); \
PyObject_CallObject(append_func, append_args); \
Py_DECREF(append_args); Py_DECREF(cirq_gate); \
} \
} while(0)

Definition at line 2464 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

◆ DECOMPOSITION_WRAPPER_BASE_METHODS

#define DECOMPOSITION_WRAPPER_BASE_METHODS

Base methods shared by all decomposition types These methods are available for all decomposition classes.

Definition at line 3124 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

◆ decomposition_wrapper_type_template

#define decomposition_wrapper_type_template (   decomp_class)

Definition at line 3281 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

◆ NPY_NO_DEPRECATED_API

#define NPY_NO_DEPRECATED_API   NPY_1_7_API_VERSION

Definition at line 6 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

◆ Py_INCREF_template

#define Py_INCREF_template (   decomp_name)
Value:
Py_INCREF(&qgd_##decomp_name##_Wrapper_Type); \
if (PyModule_AddObject(m, "qgd_" #decomp_name, (PyObject *) &qgd_##decomp_name##_Wrapper_Type) < 0) { \
Py_DECREF(&qgd_##decomp_name##_Wrapper_Type); \
Py_DECREF(m); \
return NULL; \
}

Definition at line 3357 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

◆ PY_SSIZE_T_CLEAN

#define PY_SSIZE_T_CLEAN

Definition at line 5 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Function Documentation

◆ config_requests_float()

static bool config_requests_float ( std::map< std::string, Config_Element > &  config)
static

Definition at line 218 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the caller graph for this function:

◆ decomposition_wrapper_type_template()

decomposition_wrapper_type_template ( N_Qubit_Decomposition  )

Structure containing metadata about the module.

◆ extract_config()

std::map<std::string, Config_Element> extract_config ( PyObject *  config_arg)

Extract config dictionary.

Definition at line 193 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ extract_guess_type()

guess_type extract_guess_type ( PyObject *  initial_guess)

Extract guess_type from Python string/object.

Definition at line 142 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the caller graph for this function:

◆ extract_matrix()

Matrix extract_matrix ( PyObject *  Umtx_arg,
PyArrayObject **  store_ref 
)

Extract and validate Matrix from numpy array.

Definition at line 57 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ extract_matrix_any()

void extract_matrix_any ( PyObject *  matrix_arg,
PyArrayObject **  store_ref,
Matrix matrix64,
Matrix_float matrix32,
bool is_float32 
)

Extract complex64/complex128 numpy input without rejecting float32 callers.

Definition at line 74 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ extract_parameters_any()

void extract_parameters_any ( PyObject *  parameters_arg,
PyArrayObject **  store_ref,
Matrix_real parameters64,
Matrix_real_float parameters32,
bool is_float32 
)

Extract real float32/float64 parameters without forced precision conversion.

Definition at line 104 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ extract_topology()

std::vector<matrix_base<int> > extract_topology ( PyObject *  topology)

Extract topology list from Python.

Definition at line 168 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the caller graph for this function:

◆ parameters_float_to_double()

Matrix_real parameters_float_to_double ( Matrix_real_float parameters32)

Definition at line 128 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the caller graph for this function:

◆ PyInit_qgd_N_Qubit_Decompositions_Wrapper()

PyMODINIT_FUNC PyInit_qgd_N_Qubit_Decompositions_Wrapper ( void  )

Method called when the Python module is initialized.

Definition at line 3369 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

◆ qgd_N_Qubit_Decomposition_adaptive_Wrapper_init()

static int qgd_N_Qubit_Decomposition_adaptive_Wrapper_init ( qgd_N_Qubit_Decomposition_Wrapper self,
PyObject *  args,
PyObject *  kwds 
)
static

Definition at line 279 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_custom_Wrapper_init()

static int qgd_N_Qubit_Decomposition_custom_Wrapper_init ( qgd_N_Qubit_Decomposition_Wrapper self,
PyObject *  args,
PyObject *  kwds 
)
static

Definition at line 347 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_Tabu_Search_Wrapper_init()

static int qgd_N_Qubit_Decomposition_Tabu_Search_Wrapper_init ( qgd_N_Qubit_Decomposition_Wrapper self,
PyObject *  args,
PyObject *  kwds 
)
static

Definition at line 450 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

◆ qgd_N_Qubit_Decomposition_Tree_Search_Wrapper_init()

static int qgd_N_Qubit_Decomposition_Tree_Search_Wrapper_init ( qgd_N_Qubit_Decomposition_Wrapper self,
PyObject *  args,
PyObject *  kwds 
)
static

Definition at line 445 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

◆ qgd_N_Qubit_Decomposition_Wrapper_add_Adaptive_Layers()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_add_Adaptive_Layers ( qgd_N_Qubit_Decomposition_Wrapper self)
static

Wrapper method to add adaptive layers to the gate structure stored by the class.

Note
applicable to: Adaptive

Definition at line 2174 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_add_Finalyzing_Layer_To_Gate_Structure()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_add_Finalyzing_Layer_To_Gate_Structure ( qgd_N_Qubit_Decomposition_Wrapper self)
static

Wrapper function to add finalyzing layer (single qubit rotations on all qubits) to the gate structure.

Definition at line 874 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_add_Gate_Structure_From_Binary()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_add_Gate_Structure_From_Binary ( qgd_N_Qubit_Decomposition_Wrapper self,
PyObject *  args 
)
static

Wrapper function to append custom layers to the gate structure from binary file.

Note
applicable to: Adaptive

Definition at line 2098 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_add_Layer_To_Imported_Gate_Structure()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_add_Layer_To_Imported_Gate_Structure ( qgd_N_Qubit_Decomposition_Wrapper self)
static

Wrapper method to add layer to imported gate structure.

Note
applicable to: Adaptive

Definition at line 2190 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_apply_Global_Phase_Factor()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_apply_Global_Phase_Factor ( qgd_N_Qubit_Decomposition_Wrapper self)
static

Apply global phase factor to the unitary matrix.

Returns
Py_None on success, NULL on error
Note
applicable to: Decomposition, Adaptive, Custom, Tree Search, Tabu Search

Definition at line 1133 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

◆ qgd_N_Qubit_Decomposition_Wrapper_apply_Imported_Gate_Structure()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_apply_Imported_Gate_Structure ( qgd_N_Qubit_Decomposition_Wrapper self)
static

Wrapper function to apply the imported gate structure on the unitary.

The transformed unitary is to be decomposed in the calculations, and the imported gate structure is released.

Note
applicable to: Adaptive

Definition at line 2206 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_Compress_Circuit()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_Compress_Circuit ( qgd_N_Qubit_Decomposition_Wrapper self)
static

Call to compress circuit.

Note
applicable to: Adaptive

Definition at line 2016 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_dealloc()

static void qgd_N_Qubit_Decomposition_Wrapper_dealloc ( qgd_N_Qubit_Decomposition_Wrapper self)
static

Called when Python object is destroyed.

Definition at line 468 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_export_Unitary()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_export_Unitary ( qgd_N_Qubit_Decomposition_Wrapper self,
PyObject *  args 
)
static

Export unitary matrix to binary file.

Parameters
argsTuple containing filename string
Returns
0 on success, -1 on error
Note
applicable to: Decomposition, Adaptive, Custom, Tree Search, Tabu Search

Definition at line 1034 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_Finalize_Circuit()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_Finalize_Circuit ( qgd_N_Qubit_Decomposition_Wrapper self,
PyObject *  args,
PyObject *  kwds 
)
static

Call to finalize circuit.

Note
applicable to: Adaptive

Definition at line 2037 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_get_Circuit()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_get_Circuit ( qgd_N_Qubit_Decomposition_Wrapper self)
static

Call to get the incorporated circuit.

Returns
Python wrapper object containing the circuit

Definition at line 581 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_get_Cirq_Circuit()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_get_Cirq_Circuit ( qgd_N_Qubit_Decomposition_Wrapper self)
static

Definition at line 2501 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_get_Decomposition_Error()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_get_Decomposition_Error ( qgd_N_Qubit_Decomposition_Wrapper self)
static

Get the error of the decomposition.

Returns
Double value of the decomposition error
Note
applicable to: Decomposition, Adaptive, Custom, Tree Search, Tabu Search

Definition at line 1809 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_get_Gate_Num()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_get_Gate_Num ( qgd_N_Qubit_Decomposition_Wrapper self)
static

Call to get the number of gates.

Returns
PyLong representing the number of gates

Definition at line 547 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_get_Gates()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_get_Gates ( qgd_N_Qubit_Decomposition_Wrapper self)
static

Method to get gates as a list of dictionaries (with parameters from optimized_parameters array)

Returns
Returns with a Python list of gate dictionaries

Definition at line 2309 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_get_Global_Phase()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_get_Global_Phase ( qgd_N_Qubit_Decomposition_Wrapper self)
static

Call to get the global phase factor (returns the angle of the global phase)

Returns
PyFloat representing the angle of the global phase (the radius is always sqrt(2))
Note
applicable to: Decomposition, Adaptive, Custom, Tree Search, Tabu Search

Definition at line 1098 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

◆ qgd_N_Qubit_Decomposition_Wrapper_get_Initial_Circuit()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_get_Initial_Circuit ( qgd_N_Qubit_Decomposition_Wrapper self)
static

Call to get initial circuit.

Note
applicable to: Adaptive

Definition at line 1995 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_get_Matrix()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_get_Matrix ( qgd_N_Qubit_Decomposition_Wrapper self,
PyObject *  args,
PyObject *  kwds 
)
static

Call to get the matrix representation of the circuit with given parameters.

Parameters
argsTuple containing parameters array (numpy array of doubles)
kwdsOptional keyword arguments (currently unused)
Returns
Numpy array representing the unitary matrix of the parameterized circuit
Note
applicable to: Decomposition, Adaptive, Custom, Tree Search, Tabu Search

Definition at line 1303 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_get_Num_of_Iters()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_get_Num_of_Iters ( qgd_N_Qubit_Decomposition_Wrapper self)
static

Get the number of free parameters in the gate structure used for the decomposition.

Returns
The number of iterations
Note
applicable to: Adaptive, Tree Search, Tabu Search

Definition at line 1021 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_get_Optimized_Parameters()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_get_Optimized_Parameters ( qgd_N_Qubit_Decomposition_Wrapper self)
static

Call to get the optimized parameters.

Returns
Numpy array of optimized parameters

Definition at line 559 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_get_Parameter_Num()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_get_Parameter_Num ( qgd_N_Qubit_Decomposition_Wrapper self)
static

Get the number of free parameters in the gate structure used for the decomposition.

Note
applicable to: Decomposition, Adaptive, Custom, Tree Search, Tabu Search

Definition at line 971 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_get_Project_Name()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_get_Project_Name ( qgd_N_Qubit_Decomposition_Wrapper self)
static

Call to get the project name.

Returns
PyUnicode string with project name
Note
applicable to: Decomposition, Adaptive, Custom, Tree Search, Tabu Search

Definition at line 1057 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

◆ qgd_N_Qubit_Decomposition_Wrapper_get_Qbit_Num()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_get_Qbit_Num ( qgd_N_Qubit_Decomposition_Wrapper self)
static

Get the number of qubits.

Returns
Integer value of the number of qubits
Note
applicable to: Decomposition, Adaptive, Custom, Tree Search, Tabu Search

Definition at line 1929 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_get_Qiskit_Circuit()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_get_Qiskit_Circuit ( qgd_N_Qubit_Decomposition_Wrapper self)
static

Method to get Qiskit circuit representation.

Returns
Returns with a Qiskit QuantumCircuit object

Definition at line 2404 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_get_Second_Renyi_Entropy()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_get_Second_Renyi_Entropy ( qgd_N_Qubit_Decomposition_Wrapper self,
PyObject *  args 
)
static

Get second Renyi entropy.

Parameters
argsPython tuple of arguments (parameters_arr, input_state_arg, qubit_list_arg)
Returns
Double value of the second Renyi entropy
Note
applicable to: Adaptive, Tree Search, Tabu Search

Definition at line 1834 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_get_Trace_Offset()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_get_Trace_Offset ( qgd_N_Qubit_Decomposition_Wrapper self)
static

Get trace offset of the compression.

Returns
Integer value of trace offset
Note
applicable to: Decomposition, Adaptive, Custom, Tree Search, Tabu Search

Definition at line 1751 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_get_Unitary()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_get_Unitary ( qgd_N_Qubit_Decomposition_Wrapper self)
static

Call to get the unitary matrix.

Returns
Numpy array representing the unitary matrix
Note
applicable to: Decomposition, Adaptive, Custom, Tree Search, Tabu Search

Definition at line 1150 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_import_Qiskit_Circuit()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_import_Qiskit_Circuit ( qgd_N_Qubit_Decomposition_Wrapper self,
PyObject *  args 
)
static

Method to import Qiskit circuit.

Parameters
qc_inQiskit QuantumCircuit to import
Returns
Returns Py_None on success

Definition at line 3097 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_import_Qiskit_Circuit_adaptive()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_import_Qiskit_Circuit_adaptive ( qgd_N_Qubit_Decomposition_Wrapper self,
PyObject *  qc_in 
)
static

Method to import Qiskit circuit (adaptive-specific version with custom CZ decomposition)

Parameters
qc_inQiskit QuantumCircuit to import
Returns
Returns Py_None on success

Definition at line 2701 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_import_Qiskit_Circuit_standard()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_import_Qiskit_Circuit_standard ( qgd_N_Qubit_Decomposition_Wrapper self,
PyObject *  qc_in 
)
static

Method to import Qiskit circuit (standard version for non-adaptive decompositions)

Parameters
qc_inQiskit QuantumCircuit to import
Returns
Returns Py_None on success

Definition at line 2644 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_init()

static int qgd_N_Qubit_Decomposition_Wrapper_init ( qgd_N_Qubit_Decomposition_Wrapper self,
PyObject *  args,
PyObject *  kwds 
)
static

Definition at line 229 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_List_Gates()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_List_Gates ( qgd_N_Qubit_Decomposition_Wrapper self)
static

Call to list the gates decomposing the unitary.

Definition at line 616 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_new()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_new ( PyTypeObject type,
PyObject *  args,
PyObject *  kwds 
)
static

Allocate memory for new Python object.

Definition at line 488 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

◆ qgd_N_Qubit_Decomposition_Wrapper_Optimization_Problem()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_Optimization_Problem ( qgd_N_Qubit_Decomposition_Wrapper self,
PyObject *  args 
)
static

Call to evaluate the optimization problem (cost function)

Parameters
argsTuple containing parameters array (numpy array of doubles)
Returns
PyFloat with the cost function value
Note
applicable to: Decomposition, Adaptive, Custom, Tree Search, Tabu Search

Definition at line 1396 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_Optimization_Problem_Batch()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_Optimization_Problem_Batch ( qgd_N_Qubit_Decomposition_Wrapper self,
PyObject *  args 
)
static

Call to evaluate the optimization problem for batched parameters.

Parameters
argsTuple containing parameters matrix (numpy array of doubles, each row is a parameter set)
Returns
Numpy array of cost function values
Note
applicable to: Decomposition, Adaptive, Custom, Tree Search, Tabu Search

Definition at line 1650 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_Optimization_Problem_Combined()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_Optimization_Problem_Combined ( qgd_N_Qubit_Decomposition_Wrapper self,
PyObject *  args 
)
static

Call to evaluate the optimization problem with cost and gradient combined.

Parameters
argsTuple containing parameters array (numpy array of doubles)
Returns
Tuple (cost value, gradient array)
Note
applicable to: Decomposition, Adaptive, Custom, Tree Search, Tabu Search

Definition at line 1578 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_Optimization_Problem_Combined_Unitary()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_Optimization_Problem_Combined_Unitary ( qgd_N_Qubit_Decomposition_Wrapper self,
PyObject *  args 
)
static

Call to evaluate the optimization problem with unitary and derivatives.

Parameters
argsTuple containing parameters array (numpy array of doubles)
Returns
Tuple (unitary matrix, list of unitary derivatives)
Note
applicable to: Decomposition, Adaptive, Custom, Tree Search, Tabu Search

Definition at line 1446 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_Optimization_Problem_Grad()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_Optimization_Problem_Grad ( qgd_N_Qubit_Decomposition_Wrapper self,
PyObject *  args 
)
static

Call to evaluate the gradient of the optimization problem.

Parameters
argsTuple containing parameters array (numpy array of doubles)
Returns
Numpy array representing the gradient
Note
applicable to: Decomposition, Adaptive, Custom, Tree Search, Tabu Search

Definition at line 1509 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_Reorder_Qubits()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_Reorder_Qubits ( qgd_N_Qubit_Decomposition_Wrapper self,
PyObject *  args 
)
static

Method to reorder the qubits in the decomposition class.

Parameters
argsTuple or list of integers representing the new qubit ordering

Definition at line 773 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

◆ qgd_N_Qubit_Decomposition_Wrapper_set_Convergence_Threshold()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_set_Convergence_Threshold ( qgd_N_Qubit_Decomposition_Wrapper self,
PyObject *  args 
)
static

Wrapper method to set the threshold of convergence.

Parameters
argsDouble representing the threshold value

Definition at line 835 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

◆ qgd_N_Qubit_Decomposition_Wrapper_set_Cost_Function_Variant()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_set_Cost_Function_Variant ( qgd_N_Qubit_Decomposition_Wrapper self,
PyObject *  args,
PyObject *  kwds 
)
static

Call to set the cost function variant.

Parameters
argsPositional arguments
kwdsKeyword arguments (costfnc: integer)
Returns
Py_BuildValue("i", 0) on success, NULL on error
Note
applicable to: Adaptive, Custom, Tree Search, Tabu Search

Definition at line 1357 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_set_Debugfile()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_set_Debugfile ( qgd_N_Qubit_Decomposition_Wrapper self,
PyObject *  args 
)
static

Set the debugfile name of the decomposition class.

Parameters
argsPyObject string for debug filename

Definition at line 743 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

◆ qgd_N_Qubit_Decomposition_Wrapper_set_Gate_Structure()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_set_Gate_Structure ( qgd_N_Qubit_Decomposition_Wrapper self,
PyObject *  args 
)
static

Wrapper function to set custom gate structure for the decomposition.

Parameters
selfA pointer pointing to an instance of the class qgd_N_Qubit_Decompositions_Wrapper
argsPyObject containing either a dictionary {int: Gates_block} (Decomposition only) or a single gate structure (all types)
Returns
Returns with zero on success.
Note
applicable to: Decomposition (both map and single), Adaptive, Custom, Tree Search, Tabu Search (single only)

Definition at line 899 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_set_Gate_Structure_From_Binary()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_set_Gate_Structure_From_Binary ( qgd_N_Qubit_Decomposition_Wrapper self,
PyObject *  args 
)
static

Wrapper function to set custom layers to the gate structure that are intended to be used in the decomposition.

Note
applicable to: Adaptive

Definition at line 2058 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_set_Global_Phase()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_set_Global_Phase ( qgd_N_Qubit_Decomposition_Wrapper self,
PyObject *  args 
)
static

Call to set the global phase.

Parameters
argsTuple containing phase angle (double)
Returns
Py_None on success, NULL on error
Note
applicable to: Decomposition, Adaptive, Custom, Tree Search, Tabu Search

Definition at line 1112 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_set_Identical_Blocks()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_set_Identical_Blocks ( qgd_N_Qubit_Decomposition_Wrapper self,
PyObject *  args 
)
static

Set the number of identical successive blocks (N_Qubit_Decomposition only)

Note
applicable to: Decomposition

Definition at line 1954 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_set_Iteration_Loops()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_set_Iteration_Loops ( qgd_N_Qubit_Decomposition_Wrapper self,
PyObject *  args 
)
static

Set the number of iteration loops during the subdecomposition of the qbit-th qubit.

Parameters
argsDictionary {'n': iteration_loops} labeling the number of successive identical layers used in the subdecomposition at the disentangling of the n-th qubit

Definition at line 676 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

◆ qgd_N_Qubit_Decomposition_Wrapper_set_Max_Iterations()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_set_Max_Iterations ( qgd_N_Qubit_Decomposition_Wrapper self,
PyObject *  args 
)
static

Set the number of maximum iterations for optimization.

Parameters
argsTuple containing max_iterations integer
Returns
Py_None on success, NULL on error
Note
applicable to: Decomposition, Adaptive, Custom, Tree Search, Tabu Search

Definition at line 1280 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_set_Max_Layer_Num()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_set_Max_Layer_Num ( qgd_N_Qubit_Decomposition_Wrapper self,
PyObject *  args 
)
static

Set the maximal number of layers used in the subdecomposition of the qbit-th qubit.

Parameters
argsDictionary {'n': max_layer_num} labeling the maximal number of the gate layers used in the subdecomposition

Definition at line 628 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

◆ qgd_N_Qubit_Decomposition_Wrapper_set_Optimization_Blocks()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_set_Optimization_Blocks ( qgd_N_Qubit_Decomposition_Wrapper self,
PyObject *  args 
)
static

Wrapper method to set the number of gate blocks to be optimized.

Parameters
argsInteger representing the number of optimization blocks

Definition at line 855 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

◆ qgd_N_Qubit_Decomposition_Wrapper_set_Optimization_Tolerance()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_set_Optimization_Tolerance ( qgd_N_Qubit_Decomposition_Wrapper self,
PyObject *  args 
)
static

Wrapper method to set the optimization tolerance.

Parameters
argsDouble representing the tolerance value

Definition at line 815 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

◆ qgd_N_Qubit_Decomposition_Wrapper_set_Optimized_Parameters()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_set_Optimized_Parameters ( qgd_N_Qubit_Decomposition_Wrapper self,
PyObject *  args 
)
static

Extract the optimized parameters.

Parameters
start_indexThe index of the first inverse gate
Note
applicable to: Decomposition, Adaptive, Custom, Tree Search, Tabu Search

Definition at line 983 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_set_Optimizer()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_set_Optimizer ( qgd_N_Qubit_Decomposition_Wrapper self,
PyObject *  args,
PyObject *  kwds 
)
static

Call to set the optimizer algorithm.

Parameters
argsPositional arguments
kwdsKeyword arguments (optimizer: string)
Returns
Py_BuildValue("i", 0) on success, NULL on error
Note
applicable to: Decomposition, Adaptive, Custom, Tree Search, Tabu Search

Definition at line 1197 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_set_Project_Name()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_set_Project_Name ( qgd_N_Qubit_Decomposition_Wrapper self,
PyObject *  args 
)
static

Call to set the project name.

Parameters
argsTuple containing project name string
Returns
0 on success, -1 on error
Note
applicable to: Decomposition, Adaptive, Custom, Tree Search, Tabu Search

Definition at line 1075 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_set_Trace_Offset()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_set_Trace_Offset ( qgd_N_Qubit_Decomposition_Wrapper self,
PyObject *  args,
PyObject *  kwds 
)
static

Set trace offset for the compression.

Parameters
argsPython tuple of arguments (trace_offset: int)
Returns
Py_None on success, NULL on error
Note
applicable to: Decomposition, Adaptive, Custom, Tree Search, Tabu Search

Definition at line 1776 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

◆ qgd_N_Qubit_Decomposition_Wrapper_set_Unitary()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_set_Unitary ( qgd_N_Qubit_Decomposition_Wrapper self,
PyObject *  args 
)
static

Call to set unitary matrix.

Parameters
argsTuple containing numpy array (unitary matrix)
Returns
Py_BuildValue("i", 0) on success, NULL on error
Note
applicable to: Adaptive, Tree Search, Tabu Search

Definition at line 2237 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_set_Unitary_From_Binary()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_set_Unitary_From_Binary ( qgd_N_Qubit_Decomposition_Wrapper self,
PyObject *  args 
)
static

Wrapper function to set unitary from binary file.

Note
applicable to: Adaptive

Definition at line 2136 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_set_Verbose()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_set_Verbose ( qgd_N_Qubit_Decomposition_Wrapper self,
PyObject *  args 
)
static

Set the verbosity of the decomposition class.

Parameters
argsInteger (0=False, non-zero=True)

Definition at line 723 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

◆ qgd_N_Qubit_Decomposition_Wrapper_Start_Decomposition()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_Start_Decomposition ( qgd_N_Qubit_Decomposition_Wrapper self,
PyObject *  args,
PyObject *  kwds 
)
static

Wrapper function to call the start_decomposition method of C++ class N_Qubit_Decomposition.

Parameters
selfA pointer pointing to an instance of the class qgd_N_Qubit_Decompositions_Wrapper
kwdsA tuple of keywords

Definition at line 507 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_N_Qubit_Decomposition_Wrapper_Upload_Umtx_to_DFE()

static PyObject* qgd_N_Qubit_Decomposition_Wrapper_Upload_Umtx_to_DFE ( qgd_N_Qubit_Decomposition_Wrapper self)
static

Upload unitary matrix to DFE.

Returns
Py_None on success, NULL on error
Note
applicable to: Decomposition, Adaptive, Custom, Tree Search, Tabu Search (only when compiled with DFE)

Definition at line 1722 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

◆ release_decomposition()

template<typename DecompT >
void release_decomposition ( DecompT *  instance)

Deallocate decomposition instance.

Definition at line 458 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the caller graph for this function:

◆ search_wrapper_init()

template<typename DecompT >
static int search_wrapper_init ( qgd_N_Qubit_Decomposition_Wrapper self,
PyObject *  args,
PyObject *  kwds 
)
static

Definition at line 396 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

Here is the call graph for this function:

Variable Documentation

◆ qgd_N_Qubit_Decomposition_adaptive_methods

PyMethodDef qgd_N_Qubit_Decomposition_adaptive_methods[]
static
Initial value:
= {
{"get_Initial_Circuit", (PyCFunction) qgd_N_Qubit_Decomposition_Wrapper_get_Initial_Circuit, METH_NOARGS,
"Method to get initial circuit in decomposition"},
{"Compress_Circuit", (PyCFunction) qgd_N_Qubit_Decomposition_Wrapper_Compress_Circuit, METH_NOARGS,
"Method to compress gate structure"},
{"Finalize_Circuit", (PyCFunction) qgd_N_Qubit_Decomposition_Wrapper_Finalize_Circuit, METH_VARARGS | METH_KEYWORDS,
"Method to finalize the decomposition"},
{"set_Gate_Structure_From_Binary", (PyCFunction) qgd_N_Qubit_Decomposition_Wrapper_set_Gate_Structure_From_Binary, METH_VARARGS,
"Set gate structure from binary"},
{"add_Gate_Structure_From_Binary", (PyCFunction) qgd_N_Qubit_Decomposition_Wrapper_add_Gate_Structure_From_Binary, METH_VARARGS,
"Add gate structure from binary"},
{"set_Unitary_From_Binary", (PyCFunction) qgd_N_Qubit_Decomposition_Wrapper_set_Unitary_From_Binary, METH_VARARGS,
"Set unitary from binary"},
{"add_Adaptive_Layers", (PyCFunction) qgd_N_Qubit_Decomposition_Wrapper_add_Adaptive_Layers, METH_NOARGS,
"Call to add adaptive layers to the gate structure"},
{"add_Layer_To_Imported_Gate_Structure", (PyCFunction) qgd_N_Qubit_Decomposition_Wrapper_add_Layer_To_Imported_Gate_Structure, METH_VARARGS,
"Add layer to imported gate structure"},
{"apply_Imported_Gate_Structure", (PyCFunction) qgd_N_Qubit_Decomposition_Wrapper_apply_Imported_Gate_Structure, METH_NOARGS,
"Apply imported gate structure"},
{"set_Unitary", (PyCFunction) qgd_N_Qubit_Decomposition_Wrapper_set_Unitary, METH_VARARGS,
"Call to set unitary matrix"},
{NULL}
}
#define DECOMPOSITION_WRAPPER_BASE_METHODS
Base methods shared by all decomposition types These methods are available for all decomposition clas...
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_add_Gate_Structure_From_Binary(qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args)
Wrapper function to append custom layers to the gate structure from binary file.
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_add_Layer_To_Imported_Gate_Structure(qgd_N_Qubit_Decomposition_Wrapper *self)
Wrapper method to add layer to imported gate structure.
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_Finalize_Circuit(qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args, PyObject *kwds)
Call to finalize circuit.
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_get_Initial_Circuit(qgd_N_Qubit_Decomposition_Wrapper *self)
Call to get initial circuit.
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_set_Unitary_From_Binary(qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args)
Wrapper function to set unitary from binary file.
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_apply_Imported_Gate_Structure(qgd_N_Qubit_Decomposition_Wrapper *self)
Wrapper function to apply the imported gate structure on the unitary.
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_Compress_Circuit(qgd_N_Qubit_Decomposition_Wrapper *self)
Call to compress circuit.
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_add_Adaptive_Layers(qgd_N_Qubit_Decomposition_Wrapper *self)
Wrapper method to add adaptive layers to the gate structure stored by the class.
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_set_Gate_Structure_From_Binary(qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args)
Wrapper function to set custom layers to the gate structure that are intended to be used in the decom...
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_set_Unitary(qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args)
Call to set unitary matrix.

Method table for N_Qubit_Decomposition_adaptive.

Definition at line 3228 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

◆ qgd_N_Qubit_Decomposition_custom_methods

PyMethodDef qgd_N_Qubit_Decomposition_custom_methods[]
static
Initial value:
= {
{NULL}
}
#define DECOMPOSITION_WRAPPER_BASE_METHODS
Base methods shared by all decomposition types These methods are available for all decomposition clas...

Method table for N_Qubit_Decomposition_custom.

Definition at line 3256 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

◆ qgd_N_Qubit_Decomposition_methods

PyMethodDef qgd_N_Qubit_Decomposition_methods[]
static
Initial value:
= {
{"set_Identical_Blocks", (PyCFunction) qgd_N_Qubit_Decomposition_Wrapper_set_Identical_Blocks, METH_VARARGS,
"Set the number of identical successive blocks during subdecomposition"},
{NULL}
}
#define DECOMPOSITION_WRAPPER_BASE_METHODS
Base methods shared by all decomposition types These methods are available for all decomposition clas...
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_set_Identical_Blocks(qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args)
Set the number of identical successive blocks (N_Qubit_Decomposition only)

Method table for base N_Qubit_Decomposition.

Definition at line 3218 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

◆ qgd_N_Qubit_Decomposition_Tabu_Search_methods

PyMethodDef qgd_N_Qubit_Decomposition_Tabu_Search_methods[]
static
Initial value:
= {
{"set_Unitary", (PyCFunction) qgd_N_Qubit_Decomposition_Wrapper_set_Unitary, METH_VARARGS,
"Call to set unitary matrix"},
{NULL}
}
#define DECOMPOSITION_WRAPPER_BASE_METHODS
Base methods shared by all decomposition types These methods are available for all decomposition clas...
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_set_Unitary(qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args)
Call to set unitary matrix.

Method table for N_Qubit_Decomposition_Tabu_Search.

Definition at line 3264 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.

◆ qgd_N_Qubit_Decomposition_Tree_Search_methods

PyMethodDef qgd_N_Qubit_Decomposition_Tree_Search_methods[]
static
Initial value:
= {
{"set_Unitary", (PyCFunction) qgd_N_Qubit_Decomposition_Wrapper_set_Unitary, METH_VARARGS,
"Call to set unitary matrix"},
{NULL}
}
#define DECOMPOSITION_WRAPPER_BASE_METHODS
Base methods shared by all decomposition types These methods are available for all decomposition clas...
static PyObject * qgd_N_Qubit_Decomposition_Wrapper_set_Unitary(qgd_N_Qubit_Decomposition_Wrapper *self, PyObject *args)
Call to set unitary matrix.

Method table for N_Qubit_Decomposition_Tree_Search.

Definition at line 3274 of file qgd_N_Qubit_Decompositions_Wrapper.cpp.