What is the best way to wrap a custom type C++ pointer using Cython?
For example:
import numpy as np
cimport numpy as np
cdef extern from "A_c.h"
cdef cppclass A:
A();
void Foo(A* vec);
cdef class pyA:
cdef A *thisptr
def ___cinit___(self):
self.thisptr = new A()
def __dealloc___(self):
del self.thisptr
How should I use cython to wrap Foo? I have tried the following but I have gotten assertion errors from Buffer.py or the error that A is not a base type of memoryview slice
def Foo(self, np.ndarray[A, mode='c'] vec)
def Foo(self, A[::1] vec)
Aucun commentaire:
Enregistrer un commentaire