.../scitbx/math/boost_python/distributions.cpp | 60 +++++++++++++------ cctbx_sources/scitbx/rigid_body/spatial_lib.h | 1 + cctbx_sources/scitbx/rigid_body/tardy.h | 4 +- .../refinement/boost_python/weighting_schemes.cpp | 4 +- .../smtbx/structure_factors/direct/standard_xray.h | 4 +- 5 files changed, 48 insertions(+), 25 deletions(-) diff --git a/cctbx_sources/scitbx/math/boost_python/distributions.cpp b/cctbx_sources/scitbx/math/boost_python/distributions.cpp index a676798..68818e7 100644 --- a/cctbx_sources/scitbx/math/boost_python/distributions.cpp +++ b/cctbx_sources/scitbx/math/boost_python/distributions.cpp @@ -59,29 +59,51 @@ namespace { { typedef Distribution wt; + #define NEW_MEMBER(name) \ + static FloatType name(wt const &self) { \ + return boost::math::name(self); \ + } + + NEW_MEMBER(mean); + NEW_MEMBER(median); + NEW_MEMBER(mode); + NEW_MEMBER(variance); + NEW_MEMBER(standard_deviation); + NEW_MEMBER(skewness); + NEW_MEMBER(kurtosis); + + #undef NEW_MEMBER + + #define NEW_MEMBER(name) \ + static FloatType name(wt const &self, FloatType arg) { \ + return boost::math::name(self, arg); \ + } + + NEW_MEMBER(pdf); + NEW_MEMBER(cdf); + NEW_MEMBER(quantile); + + #undef NEW_MEMBER + + static scitbx::af::shared quantiles(wt const &self, std::size_t n) { + return scitbx::math::quantiles(self, n); + } + static void wrap() { using namespace boost::python; - def("mean", (FloatType(*)(wt const&)) boost::math::mean); - def("median", (FloatType(*)(wt const&)) boost::math::median); - def("mode", (FloatType(*)(wt const&)) boost::math::mode); - def("variance", (FloatType(*)(wt const&)) boost::math::variance); - def("standard_deviation", - (FloatType(*)(wt const&)) boost::math::standard_deviation); - def("skewness", (FloatType(*)(wt const&)) boost::math::skewness); - def("kurtosis", (FloatType(*)(wt const&)) boost::math::kurtosis); - def("pdf", (FloatType(*)(wt const&, FloatType const&)) boost::math::pdf); - def("cdf", (FloatType(*)(wt const&, FloatType const&)) boost::math::cdf); - def("quantile", (FloatType(*)(wt const&, FloatType const&)) - boost::math::quantile); - def("quantiles", -#if BOOST_WORKAROUND(__EDG_VERSION__, BOOST_TESTED_AT(306)) - (scitbx::af::shared(*)(wt const&, std::size_t)) quantiles -#else - quantiles -#endif - ); + def("mean" , mean); + def("median" , median); + def("mode" , mode); + def("variance" , variance); + def("standard_deviation", standard_deviation); + def("skewness" , skewness); + def("kurtosis" , kurtosis); + def("pdf" , pdf); + def("cdf" , cdf); + def("quantile" , quantile); + def("quantiles" , quantiles); } }; diff --git a/cctbx_sources/scitbx/rigid_body/spatial_lib.h b/cctbx_sources/scitbx/rigid_body/spatial_lib.h index a084f0f..e377292 100755 --- a/cctbx_sources/scitbx/rigid_body/spatial_lib.h +++ b/cctbx_sources/scitbx/rigid_body/spatial_lib.h @@ -2,6 +2,7 @@ #define SCITBX_RIGID_BODY_SPATIAL_LIB_H #include +#include #include namespace scitbx { namespace rigid_body { diff --git a/cctbx_sources/scitbx/rigid_body/tardy.h b/cctbx_sources/scitbx/rigid_body/tardy.h index 104f16b..a8f76cc 100755 --- a/cctbx_sources/scitbx/rigid_body/tardy.h +++ b/cctbx_sources/scitbx/rigid_body/tardy.h @@ -346,7 +346,7 @@ namespace tardy { unsigned nb = this->bodies_size(); af::shared > result((af::reserve(nb))); af::shared > - tau_array = f_ext_as_tau(f_ext_array().const_ref()); + tau_array = this->f_ext_as_tau(f_ext_array().const_ref()); for(unsigned ib=0;ibbodies[ib]->joint->tau_as_d_e_pot_d_q(tau_array[ib])); @@ -379,7 +379,7 @@ namespace tardy { qdd_array() { if (!qdd_array_) { - qdd_array_ = forward_dynamics_ab( + qdd_array_ = this->forward_dynamics_ab( /*tau_array*/ af::const_ref >(0, 0), f_ext_array().const_ref(), /*grav_accn*/ af::const_ref(0, 0)); diff --git a/cctbx_sources/smtbx/refinement/boost_python/weighting_schemes.cpp b/cctbx_sources/smtbx/refinement/boost_python/weighting_schemes.cpp index ce0c27b..904e8d7 100644 --- a/cctbx_sources/smtbx/refinement/boost_python/weighting_schemes.cpp +++ b/cctbx_sources/smtbx/refinement/boost_python/weighting_schemes.cpp @@ -25,9 +25,9 @@ namespace smtbx { namespace refinement { namespace least_squares { : base_t(name, boost::python::no_init) { using namespace boost::python; - def("__call__", &wt::operator(), + this->def("__call__", &wt::operator(), (arg("fo_sq"), arg("sigma"), arg("fc_sq"))); - def("__call__", weights, + this->def("__call__", weights, (arg("fo_sq"), arg("sigmas"), arg("fc_sq"))); } }; diff --git a/cctbx_sources/smtbx/structure_factors/direct/standard_xray.h b/cctbx_sources/smtbx/structure_factors/direct/standard_xray.h index 5e2df76..911bfde 100644 --- a/cctbx_sources/smtbx/structure_factors/direct/standard_xray.h +++ b/cctbx_sources/smtbx/structure_factors/direct/standard_xray.h @@ -161,7 +161,7 @@ namespace smtbx { namespace structure_factors { namespace direct { for (int k=0; k < hr_ht.groups.size(); ++k) { hr_ht_group const &g = hr_ht.groups[k]; float_type hrx = g.hr * scatterer.site; - complex_type f = exp_i_2pi(hrx + g.ht); + complex_type f = this->exp_i_2pi(hrx + g.ht); if (scatterer.flags.use_u_aniso()) { float_type dw = debye_waller_factor_u_star(g.hr, scatterer.u_star); f *= dw; @@ -336,7 +336,7 @@ namespace smtbx { namespace structure_factors { namespace direct { for (int k=0; k < hr_ht.groups.size(); ++k) { hr_ht_group const &g = hr_ht.groups[k]; float_type hrx = g.hr * scatterer.site; - complex_type f = exp_i_2pi(hrx + g.ht); + complex_type f = this->exp_i_2pi(hrx + g.ht); float_type fa = f.real(), fb = f.imag(); if (scatterer.flags.use_u_aniso()) { float_type dw = debye_waller_factor_u_star(g.hr, scatterer.u_star);