Quaternion , numpy.object dtype. , PyArray_SimpleNew(..., NPY_OBJECT) .
, Quaternion python. Quaternion . ( , , , python?)
Quaternion - PyQuaternion. . :
typedef struct {
PyObject_HEAD
Quaternion *q;
}PyQuaternion;
static PyTypeObject PyQuaternion_Type = {
PyObject_HEAD_INIT(NULL)
0,
"Quaternion",
sizeof(PyQuaternion),
};
static PyObject *
PyQuaternion_new(PyTypeObject *type, PyObject *args, PyObject *kwds){
};
static int
PyQuaternion_init(PyQuaternion *self, PyObject *args, PyObject *kwds){
};
static void PyQuaternion_dealloc(PyQuaternion *self){
};
, C-API PyQuaternionType, PyQuaternions Quaternions
static PyObject *
PyQuaternion_New(Quaternion *q){
PyQuaternion *self;
self = (PyQuaternion *)PyQuaternion_Type.tp_new(type, NULL, NULL);
self->q = q;
return (PyObject *)self;
}
, self->q PyQuaternion_dealloc, . - PyQuaternion_dealloc self->q.
PyQuaternion_New Quaternion python, , , , , numpy dtype = numpy.object.