#include #include "NTensor.hh" namespace py = pybind11; namespace cadabra { void init_ntensor(py::module& m) { py::class_(m, "NTensor", py::buffer_protocol()) .def_buffer([](NTensor &nt) -> py::buffer_info { size_t stride=sizeof(double); std::vector strides(nt.shape.size(), 0); for(size_t i=0; i::format(), /* Python struct-style format descriptor */ nt.shape.size(), /* Number of dimensions */ nt.shape, /* Buffer dimensions */ strides /* Strides (in bytes) for each index */ ); }); }; }