13#define PY_ARRAY_UNIQUE_SYMBOL CORE_ARRAY_API
14#define NO_IMPORT_ARRAY
15#include <numpy/arrayobject.h>
18namespace PythonInterface {
31 std::pair<size_t, size_t> matrixDims = cdata.size();
32 npy_intp dims[2] = {matrixDims.first, matrixDims.second};
34 PyObject *ndarray = PyArray_SimpleNewFromData(2, dims, datatype, (
void *)&(cdata[0][0]));
37 np->flags &= ~NPY_WRITEABLE;
44#define INSTANTIATE_MATRIX_WRAP(ElementType) \
45 template DLLExport PyObject *wrapWithNDArray<Kernel::Matrix<ElementType>>(const Kernel::Matrix<ElementType> &, \
#define INSTANTIATE_MATRIX_WRAP(ElementType)
tagPyArrayObject PyArrayObject
PyObject * wrapWithNDArray(const ElementType *, const int ndims, Py_intptr_t *dims, const NumpyWrapMode mode, const OwnershipMode oMode=OwnershipMode::Cpp)
Defines the wrapWithNDArray specialization for C array types.
NumpyWrapMode
Enum defining wrapping type for conversion to numpy.
Helper class which provides the Collimation Length for SANS instruments.
Defines a mapping between C++ type given by the template parameter and numpy type enum NPY_TYPES.