Sequential Quantum Gate Decomposer  v1.9.3
Powerful decomposition of general unitarias into one- and two-qubit gates gates
Functions
numpy_interface.cpp File Reference
#include <Python.h>
#include <numpy/arrayobject.h>
#include "matrix.h"
#include "matrix_real.h"
Include dependency graph for numpy_interface.cpp:

Go to the source code of this file.

Functions

PyObject * array_from_ptr (void *ptr, int dim, npy_intp *shape, int np_type)
 Call to make a numpy array from data stored via void pointer. More...
 
void capsule_cleanup (PyObject *capsule)
 Method to cleanup the memory when the python object becomes released. More...
 
PyObject * matrix_int8_to_numpy (matrix_base< int8_t > &mtx)
 Call to make a numpy array from an instance of matrix_base<int8_t> class. More...
 
PyObject * matrix_real_to_numpy (Matrix_real &mtx)
 Call to make a numpy array from an instance of matrix class. More...
 
PyObject * matrix_to_numpy (Matrix &mtx)
 Call to make a numpy array from an instance of matrix class. More...
 
Matrix numpy2matrix (PyArrayObject *arr)
 Call to create a matrix representation of a numpy array. More...
 
Matrix_real numpy2matrix_real (PyArrayObject *arr)
 Call to create a PIC matrix_real representation of a numpy array. More...
 

Function Documentation

◆ array_from_ptr()

PyObject* array_from_ptr ( void *  ptr,
int  dim,
npy_intp *  shape,
int  np_type 
)

Call to make a numpy array from data stored via void pointer.

Parameters
ptrpointer pointing to the data
dimThe number of dimensions
shapearray containing the dimensions.
np_typeThe data type stored in the numpy array (see possible values at https://numpy.org/doc/1.17/reference/c-api.dtype.html)

Definition at line 49 of file numpy_interface.cpp.

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

◆ capsule_cleanup()

void capsule_cleanup ( PyObject *  capsule)

Method to cleanup the memory when the python object becomes released.

Parameters
capsulePointer to the memory capsule

Definition at line 28 of file numpy_interface.cpp.

Here is the caller graph for this function:

◆ matrix_int8_to_numpy()

PyObject* matrix_int8_to_numpy ( matrix_base< int8_t > &  mtx)

Call to make a numpy array from an instance of matrix_base<int8_t> class.

Parameters
mtxa matrix instance

Definition at line 129 of file numpy_interface.cpp.

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

◆ matrix_real_to_numpy()

PyObject* matrix_real_to_numpy ( Matrix_real mtx)

Call to make a numpy array from an instance of matrix class.

Parameters
mtxa matrix instance

Definition at line 94 of file numpy_interface.cpp.

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

◆ matrix_to_numpy()

PyObject* matrix_to_numpy ( Matrix mtx)

Call to make a numpy array from an instance of matrix class.

Parameters
mtxa matrix instance

Definition at line 73 of file numpy_interface.cpp.

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

◆ numpy2matrix()

Matrix numpy2matrix ( PyArrayObject *  arr)

Call to create a matrix representation of a numpy array.

Call to create a PIC matrix representation of a numpy array.

Definition at line 151 of file numpy_interface.cpp.

Here is the caller graph for this function:

◆ numpy2matrix_real()

Matrix_real numpy2matrix_real ( PyArrayObject *  arr)

Call to create a PIC matrix_real representation of a numpy array.

Definition at line 193 of file numpy_interface.cpp.

Here is the caller graph for this function: