Александров Петр
2013-03-19 17:24:25 UTC
Is it safe to return a numpy_matrix from a C++ function? For example:
pyublas::numpy_matrix<double> some_function(const int n) {
pyublas::numpy_matrix<double> result(n, n);
for (int i = 0; i < n; i++) {
result(i, i) = 1.23;
}
return result;
}
BOOST_PYTHON_MODULE(TestModule) {
def("some_function", &some_function);
}
pyublas::numpy_matrix<double> some_function(const int n) {
pyublas::numpy_matrix<double> result(n, n);
for (int i = 0; i < n; i++) {
result(i, i) = 1.23;
}
return result;
}
BOOST_PYTHON_MODULE(TestModule) {
def("some_function", &some_function);
}