32 #include <pybind11/pybind11.h>
33 #include <pybind11/functional.h>
34 #include <pybind11/operators.h>
35 #include <pybind11/stl.h>
36 #include <pybind11/eigen.h>
37 #include <pybind11/operators.h>
40 namespace py = pybind11;
44 py::array vector_to_array(std::vector<T>* ptr,
size_t sz=-1){
45 if(sz==-1) sz=ptr->size();
46 auto capsule = py::capsule(ptr, [](
void *v) {
delete reinterpret_cast<std::vector<T>*
>(v); });
47 return py::array(sz, ptr->data(), capsule);