Commit b79e8fb2 authored by Martin Reinecke's avatar Martin Reinecke
Browse files

switch to mav

parent ff944a23
Pipeline #76494 passed with stages
in 16 minutes and 6 seconds
...@@ -44,28 +44,26 @@ namespace detail_pymodule_misc { ...@@ -44,28 +44,26 @@ namespace detail_pymodule_misc {
using namespace std; using namespace std;
namespace py = pybind11; namespace py = pybind11;
using a_d_c = py::array_t<double, py::array::c_style | py::array::forcecast>; py::array GL_weights(size_t nlat, size_t nlon)
a_d_c GL_weights(int64_t nlat, int64_t nlon)
{ {
a_d_c res(nlat); auto res = make_Pyarr<double>({nlat});
auto rr=res.mutable_unchecked<1>(); auto res2 = to_mav<double,1>(res, true);
GL_Integrator integ(nlat); GL_Integrator integ(nlat);
auto wgt = integ.weights(); auto wgt = integ.weights();
for (size_t i=0; i<size_t(rr.shape(0)); ++i) for (size_t i=0; i<res2.shape(0); ++i)
rr[i] = wgt[i]*twopi/nlon; res2.v(i) = wgt[i]*twopi/nlon;
return res; return move(res);
} }
a_d_c GL_thetas(int64_t nlat) py::array GL_thetas(size_t nlat)
{ {
a_d_c res(nlat); auto res = make_Pyarr<double>({nlat});
auto rr=res.mutable_unchecked<1>(); auto res2 = to_mav<double,1>(res, true);
GL_Integrator integ(nlat); GL_Integrator integ(nlat);
auto x = integ.coords(); auto x = integ.coords();
for (size_t i=0; i<size_t(rr.shape(0)); ++i) for (size_t i=0; i<res2.shape(0); ++i)
rr[i] = acos(-x[i]); res2.v(i) = acos(-x[i]);
return res; return move(res);
} }
template<typename T> py::array pyrotate_alm(const py::array &alm_, int64_t lmax, template<typename T> py::array pyrotate_alm(const py::array &alm_, int64_t lmax,
...@@ -160,7 +158,7 @@ template<typename T> py::array tphelp(const py::array &in) ...@@ -160,7 +158,7 @@ template<typename T> py::array tphelp(const py::array &in)
auto out = make_Pyarr<T>(in2.shape()); auto out = make_Pyarr<T>(in2.shape());
auto out2 = to_fmav<T>(out, true); auto out2 = to_fmav<T>(out, true);
transpose(in2, out2, [](const T &in, T &out){out=in;}); transpose(in2, out2, [](const T &in, T &out){out=in;});
return out; return move(out);
} }
py::array py_ascontiguousarray(const py::array &in) py::array py_ascontiguousarray(const py::array &in)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment