Using the C API, I would like to create a numpy array containing objects of type Quaternion
, which is a class I've written in C++. I already have an array of these (actually a std::vector
), and I want to make a copy -- or use the same memory if possible.
Since this isn't a basic type, I need to use Py_Object
types, and can't use PyArray_SimpleNew
or anything easy like that.
I'm guessing I might want to use PyArray_NewFromDescr
or even PyArray_SimpleNewFromDescr
, but I am completely and utterly lost as to how I might create the PyArray_Descr
object I need to describe my Quaternion class.
Can anyone give me some pointers about how to make that descr object? Or give me a better idea of how to construct my numpy array?
This is basically a more general version of this question, without the distractions.
EDIT:
Using dastrobu's hint, and my SWIG wrapper, I found a way to do it. I know that not everyone is using SWIG, but for those who are, my answer on my other question shows how I worked it out.