Commit fd7a243c authored by Martin Reinecke's avatar Martin Reinecke

Merge branch 'mav_reorg' into 'master'

Mav reorg

See merge request mtr/cxxbase!9
parents 76a024d9 69f3729c
......@@ -46,6 +46,8 @@ namespace py = pybind11;
namespace {
using shape_t = fmav_info::shape_t;
template<size_t nd1, size_t nd2> shape_t repl_dim(const shape_t &s,
const array<size_t,nd1> &si, const array<size_t,nd2> &so)
{
......@@ -74,7 +76,7 @@ template<typename T1, typename T2, size_t nd1, size_t nd2, typename Func>
func(iin, iout);
iin.inc();iout.inc();
}
return aout;
return move(aout);
}
class Pyhpbase
......@@ -196,7 +198,7 @@ class Pyhpbase
oref(i,0)=pixset.ivbegin(i);
oref(i,1)=pixset.ivend(i);
}
return res;
return move(res);
}
};
......@@ -238,7 +240,7 @@ py::array local_v_angle (const py::array &v1, const py::array &v2)
vec3(ii2(i,0),ii2(i,1),ii2(i,2)));
ii1.inc();ii2.inc();iout.inc();
}
return angle;
return move(angle);
}
const char *pyHealpix_DS = R"""(
......
......@@ -21,8 +21,7 @@
namespace {
using mr::shape_t;
using mr::stride_t;
using shape_t = mr::fmav_info::shape_t;
using mr::fmav;
using mr::to_fmav;
using mr::get_optional_Pyarr;
......
......@@ -263,7 +263,7 @@ py::array py_upsample_to_cc(const py::array &in, size_t nrings_out, bool has_np,
auto out2 = to_mav<double,2>(out,true);
MR_assert(out2.writable(),"x1");
upsample_to_cc(in2, has_np, has_sp, out2);
return out;
return move(out);
}
} // unnamed namespace
......
......@@ -10,6 +10,9 @@ namespace mr {
namespace detail_pybind {
using shape_t=fmav_info::shape_t;
using stride_t=fmav_info::stride_t;
namespace py = pybind11;
template<typename T> bool isPyarr(const py::object &obj)
......
This diff is collapsed.
......@@ -42,14 +42,13 @@ class ES_Kernel
{
private:
double beta;
float fbeta;
int p;
vector<double> x, wgt, psi;
size_t supp;
public:
ES_Kernel(size_t supp_, double ofactor, size_t nthreads)
: beta(get_beta(supp_,ofactor)*supp_), fbeta(float(beta)),
: beta(get_beta(supp_,ofactor)*supp_),
p(int(1.5*supp_+2)), supp(supp_)
{
GL_Integrator integ(2*p,nthreads);
......@@ -62,10 +61,13 @@ class ES_Kernel
ES_Kernel(size_t supp_, size_t nthreads)
: ES_Kernel(supp_, 2., nthreads){}
double operator()(double v) const
{ return (v*v>1.) ? 0. : exp(beta*(std::sqrt(1.-v*v)-1.)); }
float operator()(float v) const
{ return (v*v>1.f) ? 0.f : exp(fbeta*(std::sqrt(1.f-v*v)-1.f)); }
template<typename T> T operator()(T v) const
{
using std::sqrt;
auto tmp = (1-v)*(1+v);
auto tmp2 = tmp>=0;
return tmp2*exp(T(beta)*(sqrt(tmp*tmp2)-1));
}
/* Compute correction factors for the ES gridding kernel
This implementation follows eqs. (3.8) to (3.10) of Barnett et al. 2018 */
double corfac(double v) const
......
......@@ -66,6 +66,8 @@ namespace mr {
namespace detail_fft {
using shape_t=fmav_info::shape_t;
constexpr bool FORWARD = true,
BACKWARD = false;
......
......@@ -67,7 +67,7 @@ class sharp_geom_info
class sharp_alm_info
{
public:
~sharp_alm_info() {}
virtual ~sharp_alm_info() {}
virtual size_t lmax() const = 0;
virtual size_t mmax() const = 0;
virtual size_t nm() const = 0;
......
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