Sequential Quantum Gate Decomposer  v1.9.3
Powerful decomposition of general unitarias into one- and two-qubit gates gates
Classes | Macros | Functions | Variables
qgd_CROT_Wrapper.cpp File Reference
#include <Python.h>
#include "structmember.h"
#include "CROT.h"
#include "numpy_interface.h"
Include dependency graph for qgd_CROT_Wrapper.cpp:

Go to the source code of this file.

Classes

struct  qgd_CROT_Wrapper
 Type definition of the qgd_CROT Python class of the qgd_CROT module. More...
 

Macros

#define PY_SSIZE_T_CLEAN
 

Functions

CROTcreate_CROT (int qbit_num, int target_qbit, int control_qbit, crot_type subtype_in)
 Creates an instance of class N_Qubit_Decomposition and return with a pointer pointing to the class instance (C++ linking is needed) More...
 
PyMODINIT_FUNC PyInit_qgd_CROT_Wrapper (void)
 Method called when the Python module is initialized. More...
 
static PyObject * qgd_CROT_Wrapper_apply_to (qgd_CROT_Wrapper *self, PyObject *args)
 Call to apply the gate operation on the inut matrix. More...
 
static void qgd_CROT_Wrapper_dealloc (qgd_CROT_Wrapper *self)
 Method called when a python instance of the class qgd_CROT_Wrapper is destroyed. More...
 
static PyObject * qgd_CROT_Wrapper_Extract_Parameters (qgd_CROT_Wrapper *self, PyObject *args)
 Call to extract the paramaters corresponding to the gate, from a parameter array associated to the circuit in which the gate is embedded. More...
 
static PyObject * qgd_CROT_Wrapper_get_Control_Qbit (qgd_CROT_Wrapper *self)
 Call to get the control qbit (returns with -1 if no control qbit is used in the gate) More...
 
static PyObject * qgd_CROT_Wrapper_get_Parameter_Num (qgd_CROT_Wrapper *self)
 Call to get the number of free parameters in the gate. More...
 
static PyObject * qgd_CROT_Wrapper_get_Parameter_Start_Index (qgd_CROT_Wrapper *self)
 Call to get the starting index of the parameters in the parameter array corresponding to the circuit in which the current gate is incorporated. More...
 
static PyObject * qgd_CROT_Wrapper_get_Target_Qbit (qgd_CROT_Wrapper *self)
 Call to get the target qbit. More...
 
static int qgd_CROT_Wrapper_init (qgd_CROT_Wrapper *self, PyObject *args, PyObject *kwds)
 Method called when a python instance of the class qgd_CROT_Wrapper is initialized. More...
 
static PyObject * qgd_CROT_Wrapper_new (PyTypeObject *type, PyObject *args, PyObject *kwds)
 Method called when a python instance of the class qgd_CROT_Wrapper is allocated. More...
 
static PyObject * qgd_CROT_Wrapper_set_Control_Qbit (qgd_CROT_Wrapper *self, PyObject *args)
 Call to set the target qbit. More...
 
static PyObject * qgd_CROT_Wrapper_set_Target_Qbit (qgd_CROT_Wrapper *self, PyObject *args)
 Call to set the target qbit. More...
 
void release_CROT (CROT *instance)
 Call to deallocate an instance of N_Qubit_Decomposition class. More...
 

Variables

static PyMemberDef qgd_CROT_Wrapper_members []
 Structure containing metadata about the members of class qgd_CROT_Wrapper. More...
 
static PyMethodDef qgd_CROT_Wrapper_methods []
 Structure containing metadata about the methods of class qgd_CROT_Wrapper. More...
 
static PyModuleDef qgd_CROT_Wrapper_Module
 Structure containing metadata about the module. More...
 
static PyTypeObject qgd_CROT_Wrapper_Type
 A structure describing the type of the class qgd_CROT_Wrapper. More...
 

Macro Definition Documentation

◆ PY_SSIZE_T_CLEAN

#define PY_SSIZE_T_CLEAN

Definition at line 27 of file qgd_CROT_Wrapper.cpp.

Function Documentation

◆ create_CROT()

CROT* create_CROT ( int  qbit_num,
int  target_qbit,
int  control_qbit,
crot_type  subtype_in 
)

Creates an instance of class N_Qubit_Decomposition and return with a pointer pointing to the class instance (C++ linking is needed)

Parameters
qbit_numThe number of qubits spanning the operation.
target_qbitThe 0<=ID<qbit_num of the target qubit.

Definition at line 54 of file qgd_CROT_Wrapper.cpp.

Here is the caller graph for this function:

◆ PyInit_qgd_CROT_Wrapper()

PyMODINIT_FUNC PyInit_qgd_CROT_Wrapper ( void  )

Method called when the Python module is initialized.

Definition at line 467 of file qgd_CROT_Wrapper.cpp.

◆ qgd_CROT_Wrapper_apply_to()

static PyObject* qgd_CROT_Wrapper_apply_to ( qgd_CROT_Wrapper self,
PyObject *  args 
)
static

Call to apply the gate operation on the inut matrix.

Definition at line 155 of file qgd_CROT_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_CROT_Wrapper_dealloc()

static void qgd_CROT_Wrapper_dealloc ( qgd_CROT_Wrapper self)
static

Method called when a python instance of the class qgd_CROT_Wrapper is destroyed.

Parameters
selfA pointer pointing to an instance of class qgd_CROT_Wrapper.

Definition at line 83 of file qgd_CROT_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_CROT_Wrapper_Extract_Parameters()

static PyObject* qgd_CROT_Wrapper_Extract_Parameters ( qgd_CROT_Wrapper self,
PyObject *  args 
)
static

Call to extract the paramaters corresponding to the gate, from a parameter array associated to the circuit in which the gate is embedded.

Definition at line 292 of file qgd_CROT_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_CROT_Wrapper_get_Control_Qbit()

static PyObject* qgd_CROT_Wrapper_get_Control_Qbit ( qgd_CROT_Wrapper self)
static

Call to get the control qbit (returns with -1 if no control qbit is used in the gate)

Returns
Returns with the control qbit

Definition at line 253 of file qgd_CROT_Wrapper.cpp.

◆ qgd_CROT_Wrapper_get_Parameter_Num()

static PyObject* qgd_CROT_Wrapper_get_Parameter_Num ( qgd_CROT_Wrapper self)
static

Call to get the number of free parameters in the gate.

Returns
Returns with the starting index

Definition at line 213 of file qgd_CROT_Wrapper.cpp.

◆ qgd_CROT_Wrapper_get_Parameter_Start_Index()

static PyObject* qgd_CROT_Wrapper_get_Parameter_Start_Index ( qgd_CROT_Wrapper self)
static

Call to get the starting index of the parameters in the parameter array corresponding to the circuit in which the current gate is incorporated.

Returns
Returns with the starting index

Definition at line 226 of file qgd_CROT_Wrapper.cpp.

◆ qgd_CROT_Wrapper_get_Target_Qbit()

static PyObject* qgd_CROT_Wrapper_get_Target_Qbit ( qgd_CROT_Wrapper self)
static

Call to get the target qbit.

Returns
Returns with the target qbit

Definition at line 240 of file qgd_CROT_Wrapper.cpp.

◆ qgd_CROT_Wrapper_init()

static int qgd_CROT_Wrapper_init ( qgd_CROT_Wrapper self,
PyObject *  args,
PyObject *  kwds 
)
static

Method called when a python instance of the class qgd_CROT_Wrapper is initialized.

Parameters
selfA pointer pointing to an instance of the class qgd_CROT_Wrapper.
argsA tuple of the input arguments: qbit_num (int), target_qbit (int), Theta (bool) , Phi (bool), Lambda (bool)
kwdsA tuple of keywords

Definition at line 114 of file qgd_CROT_Wrapper.cpp.

Here is the call graph for this function:

◆ qgd_CROT_Wrapper_new()

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

Method called when a python instance of the class qgd_CROT_Wrapper is allocated.

Parameters
typeA pointer pointing to a structure describing the type of the class qgd_CROT_Wrapper.

Definition at line 98 of file qgd_CROT_Wrapper.cpp.

◆ qgd_CROT_Wrapper_set_Control_Qbit()

static PyObject* qgd_CROT_Wrapper_set_Control_Qbit ( qgd_CROT_Wrapper self,
PyObject *  args 
)
static

Call to set the target qbit.

Definition at line 279 of file qgd_CROT_Wrapper.cpp.

◆ qgd_CROT_Wrapper_set_Target_Qbit()

static PyObject* qgd_CROT_Wrapper_set_Target_Qbit ( qgd_CROT_Wrapper self,
PyObject *  args 
)
static

Call to set the target qbit.

Definition at line 265 of file qgd_CROT_Wrapper.cpp.

◆ release_CROT()

void release_CROT ( CROT instance)

Call to deallocate an instance of N_Qubit_Decomposition class.

Parameters
ptrA pointer pointing to an instance of N_Qubit_Decomposition class.

Definition at line 65 of file qgd_CROT_Wrapper.cpp.

Here is the caller graph for this function:

Variable Documentation

◆ qgd_CROT_Wrapper_members

PyMemberDef qgd_CROT_Wrapper_members[]
static
Initial value:
= {
{NULL}
}

Structure containing metadata about the members of class qgd_CROT_Wrapper.

Definition at line 342 of file qgd_CROT_Wrapper.cpp.

◆ qgd_CROT_Wrapper_methods

PyMethodDef qgd_CROT_Wrapper_methods[]
static
Initial value:
= {
{"apply_to", (PyCFunction) qgd_CROT_Wrapper_apply_to, METH_VARARGS,
"Call to apply the gate on the input matrix."
},
{"get_Parameter_Num", (PyCFunction) qgd_CROT_Wrapper_get_Parameter_Num, METH_NOARGS,
"Call to get the number of free parameters in the gate."
},
{"get_Parameter_Start_Index", (PyCFunction) qgd_CROT_Wrapper_get_Parameter_Start_Index, METH_NOARGS,
"Call to get the starting index of the parameters in the parameter array corresponding to the circuit in which the current gate is incorporated."
},
{"get_Target_Qbit", (PyCFunction) qgd_CROT_Wrapper_get_Target_Qbit, METH_NOARGS,
"Call to get the target qbit."
},
{"get_Control_Qbit", (PyCFunction) qgd_CROT_Wrapper_get_Control_Qbit, METH_NOARGS,
"Call to get the control qbit (returns with -1 if no control qbit is used in the gate)."
},
{"set_Target_Qbit", (PyCFunction) qgd_CROT_Wrapper_set_Target_Qbit, METH_VARARGS,
"Call to set the target qbit."
},
{"set_Control_Qbit", (PyCFunction) qgd_CROT_Wrapper_set_Control_Qbit, METH_VARARGS,
"Call to set the control qbit."
},
{"Extract_Parameters", (PyCFunction) qgd_CROT_Wrapper_Extract_Parameters, METH_VARARGS,
"Call to extract the paramaters corresponding to the gate, from a parameter array associated to the circuit in which the gate is embedded."
},
{NULL}
}
static PyObject * qgd_CROT_Wrapper_apply_to(qgd_CROT_Wrapper *self, PyObject *args)
Call to apply the gate operation on the inut matrix.
static PyObject * qgd_CROT_Wrapper_set_Control_Qbit(qgd_CROT_Wrapper *self, PyObject *args)
Call to set the target qbit.
static PyObject * qgd_CROT_Wrapper_get_Parameter_Num(qgd_CROT_Wrapper *self)
Call to get the number of free parameters in the gate.
static PyObject * qgd_CROT_Wrapper_Extract_Parameters(qgd_CROT_Wrapper *self, PyObject *args)
Call to extract the paramaters corresponding to the gate, from a parameter array associated to the ci...
static PyObject * qgd_CROT_Wrapper_get_Control_Qbit(qgd_CROT_Wrapper *self)
Call to get the control qbit (returns with -1 if no control qbit is used in the gate) ...
static PyObject * qgd_CROT_Wrapper_get_Target_Qbit(qgd_CROT_Wrapper *self)
Call to get the target qbit.
static PyObject * qgd_CROT_Wrapper_get_Parameter_Start_Index(qgd_CROT_Wrapper *self)
Call to get the starting index of the parameters in the parameter array corresponding to the circuit ...
static PyObject * qgd_CROT_Wrapper_set_Target_Qbit(qgd_CROT_Wrapper *self, PyObject *args)
Call to set the target qbit.

Structure containing metadata about the methods of class qgd_CROT_Wrapper.

Definition at line 350 of file qgd_CROT_Wrapper.cpp.

◆ qgd_CROT_Wrapper_Module

PyModuleDef qgd_CROT_Wrapper_Module
static
Initial value:
= {
PyModuleDef_HEAD_INIT,
"qgd_CROT_Wrapper",
"Python binding for QGD RY gate",
-1,
}

Structure containing metadata about the module.

Definition at line 455 of file qgd_CROT_Wrapper.cpp.

◆ qgd_CROT_Wrapper_Type

PyTypeObject qgd_CROT_Wrapper_Type
static

A structure describing the type of the class qgd_CROT_Wrapper.

Definition at line 382 of file qgd_CROT_Wrapper.cpp.