Loading [MathJax]/extensions/TeX/AMSsymbols.js
LALInference 4.1.9.1-5e288d3
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
LALInferenceDistanceMarg.c
Go to the documentation of this file.
1//
2// LALInferenceDistanceMarg.c
3//
4//
5// Created by John Veitch on 20/03/2018.
6//
7
9#include <math.h>
10#include <gsl/gsl_integration.h>
11
12
14{
15 double A,B;
16};
17
18double dist_integral(double rho_opt, double rho_match, double dist_min, double dist_max)
19{
20 size_t limit=1000;
21 double result,abserr;
22 gsl_function F;
23 gsl_integration_workspace *workspace = gsl_integration_workspace_alloc (limit);
24
25 F.function = &dist_snr_pdf;
26 struct integrand_args args = {.A=rho_opt, .B=rho_match};
27 F.params = &args;
28
29 gsl_integration_qag (&F, dist_min, dist_max, 0.1, 1e-6, limit, GSL_INTEG_GAUSS61, workspace, &result, &abserr);
30 gsl_integration_workspace_free(workspace);
31 return(result / (dist_max-dist_min));
32}
33
34
35double dist_snr_pdf(double dL, void *args)
36{
37 struct integrand_args *a = (struct integrand_args *)args;
38 double result = exp(-a->A/dL/dL + a->B/dL)*dL*dL;
39 return result;
40}
double dist_integral(double rho_opt, double rho_match, double dist_min, double dist_max)
Compute the integral Int p(d | D, rho_opt, rho_mf) dD D is luminosity distance rho_opt is optimal SNR...
double dist_snr_pdf(double dL, void *args)
double e
static const INT4 a
args