- Notifications
You must be signed in to change notification settings - Fork 62
/
Copy pathmain.cpp
18 lines (16 loc) · 511 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include<numeric>
#include<xtensor.hpp>
#include<pybind11/pybind11.h>
#defineFORCE_IMPORT_ARRAY
#include<xtensor-python/pyarray.hpp>
doublesum_of_sines(xt::pyarray<double>& m)
{
auto sines = xt::sin(m); // sines does not actually hold values.
returnstd::accumulate(sines.begin(), sines.end(), 0.0);
}
PYBIND11_MODULE(mymodule, m)
{
xt::import_numpy();
m.doc() = "Test module for xtensor python bindings";
m.def("sum_of_sines", sum_of_sines, "Sum the sines of the input values");
}