4 #include "boost/numpy.hpp" 7 namespace bn = boost::numpy;
11 std::vector<double>
v(5);
13 Py_intptr_t shape[1] = { v.size() };
14 bn::ndarray result = bn::zeros(1, shape, bn::dtype::get_builtin<double>());
15 std::copy(v.begin(), v.end(),
reinterpret_cast<double*
>(result.get_data()));
21 std::vector<double>
v(5);
23 Py_intptr_t shape[1] = { v.size() };
24 bn::matrix t(bn::zeros(1, shape, bn::dtype::get_builtin<double>()));
25 std::copy(v.begin(), v.end(),
reinterpret_cast<double*
>(t.get_data()));
32 bp::def(
"array",
array);
boost::python::object matrix()
BOOST_PYTHON_MODULE(libbnpy)