62 {
63
64
65
66#if PY_MAJOR_VERSION == 2
67 py::object capsule(py::handle<>(PyCObject_FromVoidPtr(
69 NekMatrixCapsuleDestructor<T, StandardMatrixTag>)));
70#else
71 py::object capsule(py::handle<>(PyCapsule_New(
73 nullptr,
75 T, StandardMatrixTag>)));
76#endif
77
78 int nRows = mat->GetRows(), nCols = mat->GetColumns();
80
82 "Only full storage matrices are currently supported.");
83
84 return py::incref(
85 np::from_data(mat->GetRawPtr(), np::dtype::get_builtin<T>(),
86 py::make_tuple(nRows, nCols),
87 py::make_tuple(sizeof(T), nRows * sizeof(T)), capsule)
88 .ptr());
89 }
#define ASSERTL0(condition, msg)
void NekMatrixCapsuleDestructor(PyObject *ptr)