I would like to pass a Python list to a constructor which takes C-style arrays. How should that work. The problem is that the C-style array is essentially a pointer. Furthermore, the array has dimension n x n, i.e. it is a multi-dimensional array.
PYBIND11_MODULE(matrix_class_bind, m){
py::class_<matrix_class<double>>(m, "matrix_class")
.def(py::init([](double x[3][3]){
matrix_class<double> new_class(x);
return new_class;}));
}
On the python side it should be something like:
import matrix_class_bind as mcb
a = [[1,2,3], [3,4,5], [1,1,1]]
mcb.matrix_class(a)
xt::pyarray<double>reference and pass to your C-style function by taking the address of the first element similar to a vector/STL array.