Sequential Quantum Gate Decomposer  v1.9.6
Powerful decomposition of general unitarias into one- and two-qubit gates gates
Macros | Functions
numpy_interface.h File Reference
#include <Python.h>
#include <numpy/arrayobject.h>
#include "matrix.h"
#include "matrix_float.h"
#include "matrix_real.h"
#include "matrix_real_float.h"
Include dependency graph for numpy_interface.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define NPY_NO_DEPRECATED_API   NPY_1_7_API_VERSION
 

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_float_to_numpy (Matrix_float &mtx)
 Call to make a numpy array from an instance of matrix_float class. 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_float_to_numpy (Matrix_real_float &mtx)
 Call to make a numpy array from an instance of matrix_real_float 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 PIC matrix representation of a numpy array. More...
 
Matrix_float numpy2matrix_float (PyArrayObject *arr)
 Call to create a PIC matrix_float 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...
 
Matrix_real_float numpy2matrix_real_float (PyArrayObject *arr)
 Call to create a PIC matrix_real_float representation of a numpy array. More...
 

Macro Definition Documentation

◆ NPY_NO_DEPRECATED_API

#define NPY_NO_DEPRECATED_API   NPY_1_7_API_VERSION

Definition at line 21 of file numpy_interface.h.

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 52 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 31 of file numpy_interface.cpp.

Here is the caller graph for this function:

◆ matrix_float_to_numpy()

PyObject* matrix_float_to_numpy ( Matrix_float mtx)

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

Parameters
mtxa matrix instance

Definition at line 98 of file numpy_interface.cpp.

Here is the call graph for this function:
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 186 of file numpy_interface.cpp.

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

◆ matrix_real_float_to_numpy()

PyObject* matrix_real_float_to_numpy ( Matrix_real_float mtx)

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

Parameters
mtxa matrix instance

Definition at line 153 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 119 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 78 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 PIC matrix representation of a numpy array.

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

Definition at line 208 of file numpy_interface.cpp.

Here is the caller graph for this function:

◆ numpy2matrix_float()

Matrix_float numpy2matrix_float ( PyArrayObject *  arr)

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

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

Definition at line 250 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 284 of file numpy_interface.cpp.

Here is the caller graph for this function:

◆ numpy2matrix_real_float()

Matrix_real_float numpy2matrix_real_float ( PyArrayObject *  arr)

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

Definition at line 327 of file numpy_interface.cpp.

Here is the caller graph for this function: