aboutsummaryrefslogtreecommitdiff
path: root/src/scattering.c
diff options
context:
space:
mode:
authortlatorre <tlatorre@uchicago.edu>2019-06-02 14:47:19 -0400
committertlatorre <tlatorre@uchicago.edu>2019-06-02 14:47:19 -0400
commitc245ebc36584c1588e69f58f5dd1ece4f07ab8ae (patch)
treedeb94a51a2b712a40b859099fc8e57a17ebec85a /src/scattering.c
parentcc00800b0e55ab5a5d892b03e735302eb0c06d47 (diff)
downloadsddm-c245ebc36584c1588e69f58f5dd1ece4f07ab8ae.tar.gz
sddm-c245ebc36584c1588e69f58f5dd1ece4f07ab8ae.tar.bz2
sddm-c245ebc36584c1588e69f58f5dd1ece4f07ab8ae.zip
update likelihood function to speed it up
This commit makes a few small changes to try and reduce the number of divisions and multiplications done in get_expected_charge() to speed up the likelihood function.
Diffstat (limited to 'src/scattering.c')
-rw-r--r--src/scattering.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/scattering.c b/src/scattering.c
index 2512cda..740374e 100644
--- a/src/scattering.c
+++ b/src/scattering.c
@@ -66,7 +66,7 @@ static double prob_scatter(double wavelength, void *params)
delta = (1.0/index - beta_cos_theta)/beta_sin_theta_theta0;
- return qe*exp(-pow(delta,2)/2.0)/pow(wavelength,2)*1e7/sqrt(2*M_PI);
+ return FINE_STRUCTURE_CONSTANT*qe*exp(-pow(delta,2)/2.0)/pow(wavelength,2)*1e7/sqrt(2*M_PI)/beta_sin_theta_theta0;
}
static double prob_scatter2(double wavelength, void *params)
@@ -194,10 +194,10 @@ void init_interpolation(void)
double get_probability(double beta, double cos_theta, double sin_theta, double theta0)
{
/* Make sure theta0 is less than MAX_THETA0, otherwise it's possible that
- * gsl_spline2d_eval() will quit. */
+ * interp2d() will quit. */
if (theta0 > MAX_THETA0) theta0 = MAX_THETA0;
- return interp2d(beta*cos_theta, beta*sin_theta*theta0, x, y, z, nx, ny)/(theta0*sin_theta);
+ return beta*interp2d(beta*cos_theta, beta*sin_theta*theta0, x, y, z, nx, ny);
}
double get_probability2(double beta)