Skip to content

Commit 78aabea

Browse files
authored
Merge pull request #593 from andrewkern/patch_tdist
Fix Student's T kernel formula sign error in tdist()
2 parents c5e3701 + a4ba2a5 commit 78aabea

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

VERSIONS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ development head (in the master branch):
2626
add further SIMD optimizations for exp(), log(), log10(), log2() based on the SLEEF framework (https://github.com/shibatch/sleef), thanks to Andy Kern, https://github.com/MesserLab/SLiM/pull/587
2727
SIMD optimization for dnorm() using the previous SLEEF work, thanks to Andy Kern, https://github.com/MesserLab/SLiM/pull/588
2828
SIMD optimizations for spatial interaction strength calculations, thanks to Andy Kern, https://github.com/MesserLab/SLiM/pull/590
29+
fix #593, Student's T distribution had a sign error in tdist(), thanks to Andy Kern, https://github.com/MesserLab/SLiM/issues/591
2930

3031

3132
version 5.1 (Eidos version 4.1):

core/spatial_kernel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class SpatialKernel
7474
// we don't use the GSL for this, because it does two gamma-function calculations that we don't need (they normalize away)
7575
static inline double tdist(double x, double max, double nu, double tau) {
7676
double x_over_tau = x / tau;
77-
return max / pow(1.0 + x_over_tau * x_over_tau / nu, -(nu + 1.0) / 2.0);
77+
return max * pow(1.0 + x_over_tau * x_over_tau / nu, -(nu + 1.0) / 2.0);
7878
};
7979

8080
public:

0 commit comments

Comments
 (0)