2#include <gsl/gsl_integration.h>
3#include <gsl/gsl_errno.h>
5#include "constants.hpp"
13template <
typename interpT>
14typename interpT::realT logRadProfIntegrationF(
typename interpT::realT x,
void *params )
16 mx::math::logInterpolator<interpT> *lI = (mx::math::logInterpolator<interpT> *)params;
26template <
typename interpT>
27typename interpT::realT
28logRadProfIntegrator(
const std::vector<typename interpT::realT>
30 const std::vector<typename interpT::realT>
32 typename interpT::realT x0,
33 typename interpT::realT xf
36 typedef typename interpT::realT realT;
38 mx::math::logInterpolator<interpT> logInterp;
40 logInterp.
setup( x, y );
42 func.function = &logRadProfIntegrationF<interpT>;
43 func.params = &logInterp;
49 gsl_set_error_handler_off();
50 gsl_integration_workspace *w = gsl_integration_workspace_alloc( 1e6 );
52 int rv = gsl_integration_qag( &func, x0, xf, 1e-3, 1e-3, 1e6, 6, w, &result, &abserr );
56 gsl_integration_workspace_free( w );
66template <
typename interpT>
67typename interpT::realT
68logRadProfIntegrator(
const std::vector<typename interpT::realT>
70 const std::vector<typename interpT::realT>
74 return logRadProfIntegrator<interpT>( x, y, x[0], x.back() );
void setup(const std::vector< realT > &x, const std::vector< realT > &y)
Convert the inputs to their log10 values, and construct the interpolator.
constexpr T two_pi()
Get the value of 2pi.
Interpolation in log space.