Description
I have a naive question about array_t
. I have a c++ function that takes a vector and modify it so that I can use it in python thereafter. Reading the documentation, I understood that using py::array_t<T, py::array::f_style | py::array::forcecast>
allows converting a numpy array from Python to the type T
and fortran ordering in c++.
But then, as soon as the numpy array does not match exactly what is required (so type T
and fortran ordering) in my C++ code (with and without py::array::forcecast
), the resulting vector in python is filled with zero.
So then, I would like to enforce the type and the ordering, is it possible ? It could throw an error in case the type or the error is not matching T and py::array::f_style.
I have seen some issues about this (#338 or #1305), but I did not find/understand a solution for my problem