Sequential Quantum Gate Decomposer  v1.9.6
Powerful decomposition of general unitarias into one- and two-qubit gates gates
Classes | Macros | Functions | Variables
gates_Wrapper.cpp File Reference
#include <Python.h>
#include "structmember.h"
#include "Gate.h"
#include "CU.h"
#include "CH.h"
#include "CNOT.h"
#include "CZ.h"
#include "CRY.h"
#include "CRX.h"
#include "CRZ.h"
#include "CP.h"
#include "H.h"
#include "RX.h"
#include "RY.h"
#include "RZ.h"
#include "SX.h"
#include "SYC.h"
#include "U1.h"
#include "U2.h"
#include "U3.h"
#include "X.h"
#include "Y.h"
#include "Z.h"
#include "S.h"
#include "SDG.h"
#include "T.h"
#include "Tdg.h"
#include "R.h"
#include "CR.h"
#include "CROT.h"
#include "CCX.h"
#include "SWAP.h"
#include "CSWAP.h"
#include "numpy_interface.h"
#include "RXX.h"
#include "RYY.h"
#include "RZZ.h"
#include "SXdg.h"
Include dependency graph for gates_Wrapper.cpp:

Go to the source code of this file.

Classes

struct  CCX_Wrapper_Type
 
struct  CSWAP_Wrapper_Type
 
struct  Gate_Wrapper
 Type definition of the Gate_Wrapper Python class of the gates module. More...
 
struct  Gate_Wrapper_Type_tmp
 
struct  RXX_Wrapper_Type
 
struct  RYY_Wrapper_Type
 
struct  RZZ_Wrapper_Type
 
struct  SWAP_Wrapper_Type
 

Macros

#define GATE_WRAPPER_BASE_METHODS
 Structure containing metadata about the methods of class qgd_U3. More...
 
#define gate_wrapper_type_template(gate_name, wrapper_new)
 
#define Py_INCREF_template(gate_name)
 
#define PY_SSIZE_T_CLEAN
 

Functions

template<typename GateT >
static PyObject * controlled_gate_Wrapper_new (PyTypeObject *type, PyObject *args, PyObject *kwds)
 Method called when a python instance of a controlled gate class is initialized. More...
 
template<typename GateT >
Gatecreate_controlled_gate (int qbit_num, int target_qbit, int control_qbit)
 
template<typename GateT >
Gatecreate_gate (int qbit_num, int target_qbit)
 
template<typename GateT >
Gatecreate_multi_qubit_gate (int qbit_num, int target_qbit, const std::vector< int > &control_qbits)
 
template<typename GateT >
Gatecreate_multi_target_controlled_gate (int qbit_num, const std::vector< int > &target_qbits, const std::vector< int > &control_qbits)
 
template<typename GateT >
Gatecreate_multi_target_gate (int qbit_num, const std::vector< int > &target_qbits)
 
template<typename GateT >
Gatecreate_qbit_gate (int qbit_num)
 
static void Gate_Wrapper_dealloc (Gate_Wrapper *self)
 Method called when a python instance of the class Gate_Wrapper is destroyed. More...
 
static PyObject * Gate_Wrapper_Extract_Parameters (Gate_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 * Gate_Wrapper_get_Control_Qbit (Gate_Wrapper *self)
 Call to get the control qbit (returns with -1 if no control qbit is used in the gate) More...
 
static PyObject * Gate_Wrapper_get_Control_Qbits (Gate_Wrapper *self)
 Call to get the control qubits vector. More...
 
static PyObject * Gate_Wrapper_get_Gate_Kernel (Gate_Wrapper *self, PyObject *args, PyObject *kwds)
 Calculate the matrix of a U3 gate gate corresponding to the given parameters acting on a single qbit space. More...
 
static PyObject * Gate_Wrapper_get_Involved_Qbits (Gate_Wrapper *self)
 Call to get the target qubits vector. More...
 
static PyObject * Gate_Wrapper_get_Matrix (Gate_Wrapper *self, PyObject *args, PyObject *kwds)
 Call te extract t he matric representation of the gate. More...
 
static PyObject * Gate_Wrapper_get_Name (Gate_Wrapper *self)
 Extract the optimized parameters. More...
 
static PyObject * Gate_Wrapper_get_Parameter_Num (Gate_Wrapper *self)
 Call to get the number of free parameters in the gate. More...
 
static PyObject * Gate_Wrapper_get_Parameter_Start_Index (Gate_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 * Gate_Wrapper_get_Target_Qbit (Gate_Wrapper *self)
 Call to get the target qbit. More...
 
static PyObject * Gate_Wrapper_get_Target_Qbits (Gate_Wrapper *self)
 Call to get the target qubits vector. More...
 
static PyObject * Gate_Wrapper_getstate (Gate_Wrapper *self)
 Method to extract the stored quantum gate in a human-readable data serialized and pickle-able format. More...
 
static int Gate_Wrapper_init (Gate_Wrapper *self, PyObject *args, PyObject *kwds)
 Method called when a python instance of a non-controlled gate class is initialized. More...
 
template<typename GateT >
static PyObject * Gate_Wrapper_new (PyTypeObject *type, PyObject *args, PyObject *kwds)
 Method called when a python instance of a non-controlled gate class is initialized. More...
 
static PyObject * Gate_Wrapper_set_Control_Qbit (Gate_Wrapper *self, PyObject *args)
 Call to set the target qbit. More...
 
static PyObject * Gate_Wrapper_set_Control_Qbits (Gate_Wrapper *self, PyObject *args)
 Call to set the control qubits from a Python list. More...
 
static PyObject * Gate_Wrapper_set_Target_Qbit (Gate_Wrapper *self, PyObject *args)
 Call to set the target qbit. More...
 
static PyObject * Gate_Wrapper_set_Target_Qbits (Gate_Wrapper *self, PyObject *args)
 Call to set the target qubits from a Python list. More...
 
static PyObject * Gate_Wrapper_setstate (Gate_Wrapper *self, PyObject *args)
 Call to set the state of quantum gate from a human-readable data serialized and pickle-able format. More...
 
 gate_wrapper_type_template (CH, controlled_gate_Wrapper_new)
 
 gate_wrapper_type_template (CNOT, controlled_gate_Wrapper_new)
 
 gate_wrapper_type_template (CZ, controlled_gate_Wrapper_new)
 
 gate_wrapper_type_template (CRY, controlled_gate_Wrapper_new)
 
 gate_wrapper_type_template (CRX, controlled_gate_Wrapper_new)
 
 gate_wrapper_type_template (CRZ, controlled_gate_Wrapper_new)
 
 gate_wrapper_type_template (CP, controlled_gate_Wrapper_new)
 
 gate_wrapper_type_template (CU, controlled_gate_Wrapper_new)
 
 gate_wrapper_type_template (CR, controlled_gate_Wrapper_new)
 
 gate_wrapper_type_template (CROT, controlled_gate_Wrapper_new)
 
 gate_wrapper_type_template (SYC, controlled_gate_Wrapper_new)
 
 gate_wrapper_type_template (H, Gate_Wrapper_new)
 
 gate_wrapper_type_template (RX, Gate_Wrapper_new)
 
 gate_wrapper_type_template (RY, Gate_Wrapper_new)
 
 gate_wrapper_type_template (RZ, Gate_Wrapper_new)
 
 gate_wrapper_type_template (U1, Gate_Wrapper_new)
 
 gate_wrapper_type_template (U2, Gate_Wrapper_new)
 
 gate_wrapper_type_template (U3, Gate_Wrapper_new)
 
 gate_wrapper_type_template (X, Gate_Wrapper_new)
 
 gate_wrapper_type_template (Y, Gate_Wrapper_new)
 
 gate_wrapper_type_template (Z, Gate_Wrapper_new)
 
 gate_wrapper_type_template (S, Gate_Wrapper_new)
 
 gate_wrapper_type_template (SDG, Gate_Wrapper_new)
 
 gate_wrapper_type_template (SX, Gate_Wrapper_new)
 
 gate_wrapper_type_template (SXdg, Gate_Wrapper_new)
 
 gate_wrapper_type_template (T, Gate_Wrapper_new)
 
 gate_wrapper_type_template (Tdg, Gate_Wrapper_new)
 
 gate_wrapper_type_template (R, Gate_Wrapper_new)
 
static PyObject * Gate_Wrapper_Wrapper_apply_derivate_to (Gate_Wrapper *self, PyObject *args, PyObject *kwds)
 Call to evaluate derivatives of the gate action on an input state or matrix. More...
 
static PyObject * Gate_Wrapper_Wrapper_apply_from_right (Gate_Wrapper *self, PyObject *args, PyObject *kwds)
 Call to apply the gate operation from the right side on an input state or matrix. More...
 
static PyObject * Gate_Wrapper_Wrapper_apply_to (Gate_Wrapper *self, PyObject *args, PyObject *kwds)
 Call to apply the gate operation on an input state or matrix. More...
 
static PyObject * Gate_Wrapper_Wrapper_apply_to_combined (Gate_Wrapper *self, PyObject *args, PyObject *kwds)
 Call to evaluate forward gate action and all derivatives in one call. More...
 
static PyObject * Gate_Wrapper_Wrapper_apply_to_list (Gate_Wrapper *self, PyObject *args, PyObject *kwds)
 Call to apply the gate operation on a list of input states or matrices. More...
 
static PyObject * generic_Gate_Wrapper_new (PyTypeObject *type, PyObject *args, PyObject *kwds)
 Method called when a python instance of the class qgd_CH_Wrapper is allocated. More...
 
static void matrix_float_owner_capsule_destruct (PyObject *cap)
 Capsule destructor for heap-allocated Matrix_float. More...
 
static void matrix_owner_capsule_destruct (PyObject *cap)
 Capsule destructor: calls delete on a heap-allocated Matrix, which correctly decrements the reference counter and calls scalable_aligned_free when last owner. More...
 
template<typename GateT >
static PyObject * multi_control_gate_Wrapper_new (PyTypeObject *type, PyObject *args, PyObject *kwds)
 Generic wrapper for single-target multi-control gates (e.g., CCX) More...
 
template<typename GateT >
static PyObject * multi_target_controlled_gate_Wrapper_new (PyTypeObject *type, PyObject *args, PyObject *kwds)
 Generic wrapper for multi-target controlled gates (e.g., CSWAP) More...
 
template<typename GateT >
static PyObject * multi_target_gate_Wrapper_new (PyTypeObject *type, PyObject *args, PyObject *kwds)
 Generic wrapper for multi-target gates without control (e.g., SWAP) More...
 
PyMODINIT_FUNC PyInit_gates_Wrapper (void)
 Method called when the Python module is initialized. More...
 
template<typename GateT >
static PyObject * qbit_gate_Wrapper_new (PyTypeObject *type, PyObject *args, PyObject *kwds)
 Method called when a python instance of a qbit-only gate class is initialized. More...
 

Variables

static CCX_Wrapper_Type CCX_Wrapper_Type_ins
 
static CSWAP_Wrapper_Type CSWAP_Wrapper_Type_ins
 
static PyMemberDef Gate_Wrapper_members []
 Structure containing metadata about the members of class qgd_CH_Wrapper. More...
 
static PyMethodDef Gate_Wrapper_methods []
 
static Gate_Wrapper_Type_tmp Gate_Wrapper_Type
 
static PyModuleDef gates_Wrapper_Module
 Structure containing metadata about the module. More...
 
static RXX_Wrapper_Type RXX_Wrapper_Type_ins
 
static RYY_Wrapper_Type RYY_Wrapper_Type_ins
 
static RZZ_Wrapper_Type RZZ_Wrapper_Type_ins
 
static SWAP_Wrapper_Type SWAP_Wrapper_Type_ins
 

Macro Definition Documentation

◆ GATE_WRAPPER_BASE_METHODS

#define GATE_WRAPPER_BASE_METHODS

Structure containing metadata about the methods of class qgd_U3.

Definition at line 2803 of file gates_Wrapper.cpp.

◆ gate_wrapper_type_template

#define gate_wrapper_type_template (   gate_name,
  wrapper_new 
)
Value:
struct gate_name##_Wrapper_Type : Gate_Wrapper_Type_tmp { \
gate_name##_Wrapper_Type() { \
tp_name = #gate_name; \
tp_doc = "Object to represent python binding for a " #gate_name " gate of the Squander package."; \
tp_new = (newfunc) wrapper_new< gate_name>; \
tp_base = &Gate_Wrapper_Type; \
} \
}; \
static gate_name##_Wrapper_Type gate_name##_Wrapper_Type_ins;
static Gate_Wrapper_Type_tmp Gate_Wrapper_Type

Definition at line 2911 of file gates_Wrapper.cpp.

◆ Py_INCREF_template

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

Definition at line 3065 of file gates_Wrapper.cpp.

◆ PY_SSIZE_T_CLEAN

#define PY_SSIZE_T_CLEAN

Definition at line 27 of file gates_Wrapper.cpp.

Function Documentation

◆ controlled_gate_Wrapper_new()

template<typename GateT >
static PyObject* controlled_gate_Wrapper_new ( PyTypeObject type,
PyObject *  args,
PyObject *  kwds 
)
static

Method called when a python instance of a controlled gate class is initialized.

Parameters
selfA pointer pointing to an instance of the class Gate_Wrapper.
argsA tuple of the input arguments: qbit_num (int), target_qbit (int), control_qbit (int)
kwdsA tuple of keywords

Definition at line 264 of file gates_Wrapper.cpp.

◆ create_controlled_gate()

template<typename GateT >
Gate* create_controlled_gate ( int  qbit_num,
int  target_qbit,
int  control_qbit 
)

Definition at line 97 of file gates_Wrapper.cpp.

◆ create_gate()

template<typename GateT >
Gate* create_gate ( int  qbit_num,
int  target_qbit 
)

Definition at line 84 of file gates_Wrapper.cpp.

◆ create_multi_qubit_gate()

template<typename GateT >
Gate* create_multi_qubit_gate ( int  qbit_num,
int  target_qbit,
const std::vector< int > &  control_qbits 
)

Definition at line 113 of file gates_Wrapper.cpp.

◆ create_multi_target_controlled_gate()

template<typename GateT >
Gate* create_multi_target_controlled_gate ( int  qbit_num,
const std::vector< int > &  target_qbits,
const std::vector< int > &  control_qbits 
)

Definition at line 121 of file gates_Wrapper.cpp.

◆ create_multi_target_gate()

template<typename GateT >
Gate* create_multi_target_gate ( int  qbit_num,
const std::vector< int > &  target_qbits 
)

Definition at line 105 of file gates_Wrapper.cpp.

◆ create_qbit_gate()

template<typename GateT >
Gate* create_qbit_gate ( int  qbit_num)

Definition at line 90 of file gates_Wrapper.cpp.

◆ Gate_Wrapper_dealloc()

static void Gate_Wrapper_dealloc ( Gate_Wrapper self)
static

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

Parameters
selfA pointer pointing to an instance of class Gate_Wrapper.

Definition at line 135 of file gates_Wrapper.cpp.

Here is the caller graph for this function:

◆ Gate_Wrapper_Extract_Parameters()

static PyObject* Gate_Wrapper_Extract_Parameters ( Gate_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.

Returns
Returns with he extracted parameters

Definition at line 2197 of file gates_Wrapper.cpp.

Here is the call graph for this function:

◆ Gate_Wrapper_get_Control_Qbit()

static PyObject* Gate_Wrapper_get_Control_Qbit ( Gate_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 1923 of file gates_Wrapper.cpp.

Here is the call graph for this function:

◆ Gate_Wrapper_get_Control_Qbits()

static PyObject* Gate_Wrapper_get_Control_Qbits ( Gate_Wrapper self)
static

Call to get the control qubits vector.

Returns
Returns with a Python list of control qubits

Definition at line 2042 of file gates_Wrapper.cpp.

Here is the call graph for this function:

◆ Gate_Wrapper_get_Gate_Kernel()

static PyObject* Gate_Wrapper_get_Gate_Kernel ( Gate_Wrapper self,
PyObject *  args,
PyObject *  kwds 
)
static

Calculate the matrix of a U3 gate gate corresponding to the given parameters acting on a single qbit space.

Parameters
ThetaOver2Real parameter standing for the parameter theta (optional).
PhiReal parameter standing for the parameter phi (optional).
LambdaReal parameter standing for the parameter lambda (optional).
Returns
Returns with the matrix of the one-qubit matrix.

Definition at line 1772 of file gates_Wrapper.cpp.

Here is the call graph for this function:

◆ Gate_Wrapper_get_Involved_Qbits()

static PyObject* Gate_Wrapper_get_Involved_Qbits ( Gate_Wrapper self)
static

Call to get the target qubits vector.

Returns
Returns with a Python list of target qubits

Definition at line 2165 of file gates_Wrapper.cpp.

Here is the call graph for this function:

◆ Gate_Wrapper_get_Matrix()

static PyObject* Gate_Wrapper_get_Matrix ( Gate_Wrapper self,
PyObject *  args,
PyObject *  kwds 
)
static

Call te extract t he matric representation of the gate.

Parameters
start_indexThe index of the first inverse gate

Definition at line 516 of file gates_Wrapper.cpp.

Here is the call graph for this function:

◆ Gate_Wrapper_get_Name()

static PyObject* Gate_Wrapper_get_Name ( Gate_Wrapper self)
static

Extract the optimized parameters.

Parameters
start_indexThe index of the first inverse gate

Definition at line 2284 of file gates_Wrapper.cpp.

◆ Gate_Wrapper_get_Parameter_Num()

static PyObject* Gate_Wrapper_get_Parameter_Num ( Gate_Wrapper self)
static

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

Returns
Returns with the number of parameters

Definition at line 1839 of file gates_Wrapper.cpp.

Here is the call graph for this function:

◆ Gate_Wrapper_get_Parameter_Start_Index()

static PyObject* Gate_Wrapper_get_Parameter_Start_Index ( Gate_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 1868 of file gates_Wrapper.cpp.

Here is the call graph for this function:

◆ Gate_Wrapper_get_Target_Qbit()

static PyObject* Gate_Wrapper_get_Target_Qbit ( Gate_Wrapper self)
static

Call to get the target qbit.

Returns
Returns with the target qbit

Definition at line 1897 of file gates_Wrapper.cpp.

Here is the call graph for this function:

◆ Gate_Wrapper_get_Target_Qbits()

static PyObject* Gate_Wrapper_get_Target_Qbits ( Gate_Wrapper self)
static

Call to get the target qubits vector.

Returns
Returns with a Python list of target qubits

Definition at line 2011 of file gates_Wrapper.cpp.

Here is the call graph for this function:

◆ Gate_Wrapper_getstate()

static PyObject* Gate_Wrapper_getstate ( Gate_Wrapper self)
static

Method to extract the stored quantum gate in a human-readable data serialized and pickle-able format.

Definition at line 2309 of file gates_Wrapper.cpp.

Here is the call graph for this function:

◆ Gate_Wrapper_init()

static int Gate_Wrapper_init ( Gate_Wrapper self,
PyObject *  args,
PyObject *  kwds 
)
static

Method called when a python instance of a non-controlled gate class is initialized.

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

Definition at line 497 of file gates_Wrapper.cpp.

Here is the caller graph for this function:

◆ Gate_Wrapper_new()

template<typename GateT >
static PyObject* Gate_Wrapper_new ( PyTypeObject type,
PyObject *  args,
PyObject *  kwds 
)
static

Method called when a python instance of a non-controlled gate class is initialized.

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

Definition at line 190 of file gates_Wrapper.cpp.

◆ Gate_Wrapper_set_Control_Qbit()

static PyObject* Gate_Wrapper_set_Control_Qbit ( Gate_Wrapper self,
PyObject *  args 
)
static

Call to set the target qbit.

Definition at line 1978 of file gates_Wrapper.cpp.

Here is the call graph for this function:

◆ Gate_Wrapper_set_Control_Qbits()

static PyObject* Gate_Wrapper_set_Control_Qbits ( Gate_Wrapper self,
PyObject *  args 
)
static

Call to set the control qubits from a Python list.

Definition at line 2118 of file gates_Wrapper.cpp.

Here is the call graph for this function:

◆ Gate_Wrapper_set_Target_Qbit()

static PyObject* Gate_Wrapper_set_Target_Qbit ( Gate_Wrapper self,
PyObject *  args 
)
static

Call to set the target qbit.

Definition at line 1948 of file gates_Wrapper.cpp.

Here is the call graph for this function:

◆ Gate_Wrapper_set_Target_Qbits()

static PyObject* Gate_Wrapper_set_Target_Qbits ( Gate_Wrapper self,
PyObject *  args 
)
static

Call to set the target qubits from a Python list.

Definition at line 2072 of file gates_Wrapper.cpp.

Here is the call graph for this function:

◆ Gate_Wrapper_setstate()

static PyObject* Gate_Wrapper_setstate ( Gate_Wrapper self,
PyObject *  args 
)
static

Call to set the state of quantum gate from a human-readable data serialized and pickle-able format.

Definition at line 2438 of file gates_Wrapper.cpp.

Here is the call graph for this function:

◆ gate_wrapper_type_template() [1/28]

gate_wrapper_type_template ( CH  ,
controlled_gate_Wrapper_new   
)

◆ gate_wrapper_type_template() [2/28]

gate_wrapper_type_template ( CNOT  ,
controlled_gate_Wrapper_new   
)

◆ gate_wrapper_type_template() [3/28]

gate_wrapper_type_template ( CZ  ,
controlled_gate_Wrapper_new   
)

◆ gate_wrapper_type_template() [4/28]

gate_wrapper_type_template ( CRY  ,
controlled_gate_Wrapper_new   
)

◆ gate_wrapper_type_template() [5/28]

gate_wrapper_type_template ( CRX  ,
controlled_gate_Wrapper_new   
)

◆ gate_wrapper_type_template() [6/28]

gate_wrapper_type_template ( CRZ  ,
controlled_gate_Wrapper_new   
)

◆ gate_wrapper_type_template() [7/28]

gate_wrapper_type_template ( CP  ,
controlled_gate_Wrapper_new   
)

◆ gate_wrapper_type_template() [8/28]

gate_wrapper_type_template ( CU  ,
controlled_gate_Wrapper_new   
)

◆ gate_wrapper_type_template() [9/28]

gate_wrapper_type_template ( CR  ,
controlled_gate_Wrapper_new   
)

◆ gate_wrapper_type_template() [10/28]

gate_wrapper_type_template ( CROT  ,
controlled_gate_Wrapper_new   
)

◆ gate_wrapper_type_template() [11/28]

gate_wrapper_type_template ( SYC  ,
controlled_gate_Wrapper_new   
)

◆ gate_wrapper_type_template() [12/28]

gate_wrapper_type_template ( H  ,
Gate_Wrapper_new   
)

◆ gate_wrapper_type_template() [13/28]

gate_wrapper_type_template ( RX  ,
Gate_Wrapper_new   
)

◆ gate_wrapper_type_template() [14/28]

gate_wrapper_type_template ( RY  ,
Gate_Wrapper_new   
)

◆ gate_wrapper_type_template() [15/28]

gate_wrapper_type_template ( RZ  ,
Gate_Wrapper_new   
)

◆ gate_wrapper_type_template() [16/28]

gate_wrapper_type_template ( U1  ,
Gate_Wrapper_new   
)

◆ gate_wrapper_type_template() [17/28]

gate_wrapper_type_template ( U2  ,
Gate_Wrapper_new   
)

◆ gate_wrapper_type_template() [18/28]

gate_wrapper_type_template ( U3  ,
Gate_Wrapper_new   
)

◆ gate_wrapper_type_template() [19/28]

gate_wrapper_type_template ( X  ,
Gate_Wrapper_new   
)

◆ gate_wrapper_type_template() [20/28]

gate_wrapper_type_template ( Y  ,
Gate_Wrapper_new   
)

◆ gate_wrapper_type_template() [21/28]

gate_wrapper_type_template ( Z  ,
Gate_Wrapper_new   
)

◆ gate_wrapper_type_template() [22/28]

gate_wrapper_type_template ( S  ,
Gate_Wrapper_new   
)

◆ gate_wrapper_type_template() [23/28]

gate_wrapper_type_template ( SDG  ,
Gate_Wrapper_new   
)

◆ gate_wrapper_type_template() [24/28]

gate_wrapper_type_template ( SX  ,
Gate_Wrapper_new   
)

◆ gate_wrapper_type_template() [25/28]

gate_wrapper_type_template ( SXdg  ,
Gate_Wrapper_new   
)

◆ gate_wrapper_type_template() [26/28]

gate_wrapper_type_template ( T  ,
Gate_Wrapper_new   
)

◆ gate_wrapper_type_template() [27/28]

gate_wrapper_type_template ( Tdg  ,
Gate_Wrapper_new   
)

◆ gate_wrapper_type_template() [28/28]

gate_wrapper_type_template ( R  ,
Gate_Wrapper_new   
)

◆ Gate_Wrapper_Wrapper_apply_derivate_to()

static PyObject* Gate_Wrapper_Wrapper_apply_derivate_to ( Gate_Wrapper self,
PyObject *  args,
PyObject *  kwds 
)
static

Call to evaluate derivatives of the gate action on an input state or matrix.

Definition at line 1291 of file gates_Wrapper.cpp.

Here is the call graph for this function:

◆ Gate_Wrapper_Wrapper_apply_from_right()

static PyObject* Gate_Wrapper_Wrapper_apply_from_right ( Gate_Wrapper self,
PyObject *  args,
PyObject *  kwds 
)
static

Call to apply the gate operation from the right side on an input state or matrix.

Definition at line 680 of file gates_Wrapper.cpp.

Here is the call graph for this function:

◆ Gate_Wrapper_Wrapper_apply_to()

static PyObject* Gate_Wrapper_Wrapper_apply_to ( Gate_Wrapper self,
PyObject *  args,
PyObject *  kwds 
)
static

Call to apply the gate operation on an input state or matrix.

Definition at line 1092 of file gates_Wrapper.cpp.

Here is the call graph for this function:

◆ Gate_Wrapper_Wrapper_apply_to_combined()

static PyObject* Gate_Wrapper_Wrapper_apply_to_combined ( Gate_Wrapper self,
PyObject *  args,
PyObject *  kwds 
)
static

Call to evaluate forward gate action and all derivatives in one call.

Return format: list where item[0] is apply_to output, item[1:] are derivatives.

Definition at line 1535 of file gates_Wrapper.cpp.

Here is the call graph for this function:

◆ Gate_Wrapper_Wrapper_apply_to_list()

static PyObject* Gate_Wrapper_Wrapper_apply_to_list ( Gate_Wrapper self,
PyObject *  args,
PyObject *  kwds 
)
static

Call to apply the gate operation on a list of input states or matrices.

Definition at line 859 of file gates_Wrapper.cpp.

Here is the call graph for this function:

◆ generic_Gate_Wrapper_new()

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

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

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

Definition at line 151 of file gates_Wrapper.cpp.

Here is the caller graph for this function:

◆ matrix_float_owner_capsule_destruct()

static void matrix_float_owner_capsule_destruct ( PyObject *  cap)
static

Capsule destructor for heap-allocated Matrix_float.

Definition at line 1282 of file gates_Wrapper.cpp.

Here is the caller graph for this function:

◆ matrix_owner_capsule_destruct()

static void matrix_owner_capsule_destruct ( PyObject *  cap)
static

Capsule destructor: calls delete on a heap-allocated Matrix, which correctly decrements the reference counter and calls scalable_aligned_free when last owner.

Definition at line 1273 of file gates_Wrapper.cpp.

Here is the caller graph for this function:

◆ multi_control_gate_Wrapper_new()

template<typename GateT >
static PyObject* multi_control_gate_Wrapper_new ( PyTypeObject type,
PyObject *  args,
PyObject *  kwds 
)
static

Generic wrapper for single-target multi-control gates (e.g., CCX)

Parameters
typeThe Python type object
argsPositional arguments: qbit_num (int), target_qbit (int), control_qbits (list of ints)
kwdsKeyword arguments

Definition at line 306 of file gates_Wrapper.cpp.

◆ multi_target_controlled_gate_Wrapper_new()

template<typename GateT >
static PyObject* multi_target_controlled_gate_Wrapper_new ( PyTypeObject type,
PyObject *  args,
PyObject *  kwds 
)
static

Generic wrapper for multi-target controlled gates (e.g., CSWAP)

Parameters
typeThe Python type object
argsPositional arguments: qbit_num (int), target_qbits (list of ints), control_qbits (list of ints)
kwdsKeyword arguments

Definition at line 424 of file gates_Wrapper.cpp.

◆ multi_target_gate_Wrapper_new()

template<typename GateT >
static PyObject* multi_target_gate_Wrapper_new ( PyTypeObject type,
PyObject *  args,
PyObject *  kwds 
)
static

Generic wrapper for multi-target gates without control (e.g., SWAP)

Parameters
typeThe Python type object
argsPositional arguments: qbit_num (int), target_qbits (list of ints)
kwdsKeyword arguments

Definition at line 368 of file gates_Wrapper.cpp.

◆ PyInit_gates_Wrapper()

PyMODINIT_FUNC PyInit_gates_Wrapper ( void  )

Method called when the Python module is initialized.

Definition at line 3077 of file gates_Wrapper.cpp.

◆ qbit_gate_Wrapper_new()

template<typename GateT >
static PyObject* qbit_gate_Wrapper_new ( PyTypeObject type,
PyObject *  args,
PyObject *  kwds 
)
static

Method called when a python instance of a qbit-only gate class is initialized.

Parameters
typeA pointer pointing to an instance of the class Gate_Wrapper.
argsA tuple of the input arguments: qbit_num (int)
kwdsA tuple of keywords

Definition at line 230 of file gates_Wrapper.cpp.

Variable Documentation

◆ CCX_Wrapper_Type_ins

CCX_Wrapper_Type CCX_Wrapper_Type_ins
static

Definition at line 2978 of file gates_Wrapper.cpp.

◆ CSWAP_Wrapper_Type_ins

CSWAP_Wrapper_Type CSWAP_Wrapper_Type_ins
static

Definition at line 2989 of file gates_Wrapper.cpp.

◆ Gate_Wrapper_members

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

Structure containing metadata about the members of class qgd_CH_Wrapper.

Definition at line 2881 of file gates_Wrapper.cpp.

◆ Gate_Wrapper_methods

PyMethodDef Gate_Wrapper_methods[]
static
Initial value:
= {
,
{"__getstate__", (PyCFunction) Gate_Wrapper_getstate, METH_NOARGS,
"Method to extract the stored quantum gate in a human-readable data serialized and pickle-able format"
},
{"__setstate__", (PyCFunction) Gate_Wrapper_setstate, METH_VARARGS,
"Call to set the state of quantum gate from a human-readable data serialized and pickle-able format"
},
{NULL}
}
static PyObject * Gate_Wrapper_getstate(Gate_Wrapper *self)
Method to extract the stored quantum gate in a human-readable data serialized and pickle-able format...
#define GATE_WRAPPER_BASE_METHODS
Structure containing metadata about the methods of class qgd_U3.
static PyObject * Gate_Wrapper_setstate(Gate_Wrapper *self, PyObject *args)
Call to set the state of quantum gate from a human-readable data serialized and pickle-able format...

Definition at line 2865 of file gates_Wrapper.cpp.

◆ Gate_Wrapper_Type

Gate_Wrapper_Type_tmp Gate_Wrapper_Type
static

Definition at line 2908 of file gates_Wrapper.cpp.

◆ gates_Wrapper_Module

PyModuleDef gates_Wrapper_Module
static
Initial value:
= {
PyModuleDef_HEAD_INIT,
"gates_Wrapper",
"Python binding for gates implemented in Squander C++",
-1,
}

Structure containing metadata about the module.

Definition at line 3058 of file gates_Wrapper.cpp.

◆ RXX_Wrapper_Type_ins

RXX_Wrapper_Type RXX_Wrapper_Type_ins
static

Definition at line 2944 of file gates_Wrapper.cpp.

◆ RYY_Wrapper_Type_ins

RYY_Wrapper_Type RYY_Wrapper_Type_ins
static

Definition at line 2955 of file gates_Wrapper.cpp.

◆ RZZ_Wrapper_Type_ins

RZZ_Wrapper_Type RZZ_Wrapper_Type_ins
static

Definition at line 2966 of file gates_Wrapper.cpp.

◆ SWAP_Wrapper_Type_ins

SWAP_Wrapper_Type SWAP_Wrapper_Type_ins
static

Definition at line 2933 of file gates_Wrapper.cpp.