Skip to content

Commit

Permalink
fix a bug in InteractionType with t-distribution
Browse files Browse the repository at this point in the history
  • Loading branch information
bhaller committed Dec 1, 2023
1 parent 0400d6f commit bf3ea73
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 3 additions & 2 deletions TO_DO
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ look for exported symbols that are not tagged with "eidos" or "Eidos" somewhere
dump demangled symbols from SLiMgui:
nm -g -U -j ./SLiMgui | c++filt

some valgrind commands (set SLIM_LEAK_CHECKING to 1):
some valgrind commands (set SLIM_LEAK_CHECKING to 1, and change the compile C/C++ flags to -O1 -g):
valgrind --leak-check=yes --track-origins=yes --expensive-definedness-checks=yes --num-callers=20 ./slim -testEidos (with Debug version)
valgrind --leak-check=yes --track-origins=yes --expensive-definedness-checks=yes --num-callers=20 ./slim -testSLiM (with Debug version)
valgrind --tool=cachegrind ./slim -seed 1 /Users/bhaller/Desktop/MK_SLiMGUIsim4.txt (with Release version)
Expand Down Expand Up @@ -79,7 +79,8 @@ reassuring the Clang analyzer that a precondition is met:
#endif

count total lines of code in the project (excluding the gsl code):
( find ./core/ ./eidos/ ./eidostool/ ./EidosScribe ./SLiMgui '(' -name '*.mm' -or -name '*.h' -or -name '*.cpp' ')' -print0 | xargs -0 cat ) | wc -l
( find ./core/ ./eidos/ ./eidostool/ ./EidosScribe ./SLiMgui ./QtSLiM '(' -name '*.mm' -or -name '*.h' -or -name '*.cpp' ')' -print0 | xargs -0 cat ) | wc -l
( find ./core/ ./eidos/ '(' -name '*.mm' -or -name '*.h' -or -name '*.cpp' ')' -print0 | xargs -0 cat ) | wc -l
or better, use cloc (available in MacPorts); see https://stackoverflow.com/a/5121125/2752221

a useful LaTeX equation editor:
Expand Down
1 change: 1 addition & 0 deletions core/interaction_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5913,6 +5913,7 @@ EidosValue_SP InteractionType::ExecuteMethod_setInteractionFunction(EidosGlobalS
if_type_ = kernel.kernel_type_;
if_param1_ = kernel.kernel_param1_;
if_param2_ = kernel.kernel_param2_;
if_param3_ = kernel.kernel_param3_;
n_2param2sq_ = kernel.n_2param2sq_;

// mark that interaction types changed, so they get redisplayed in SLiMgui
Expand Down
5 changes: 4 additions & 1 deletion core/spatial_kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ class SpatialKernel

// calculate t-distribution PDF values in our fashion, for which the function is normalized to a maximum value
// we don't use the GSL for this, because it does two gamma-function calculations that we don't need (they normalize away)
static inline double tdist(double x, double max, double nu, double tau) { double x_over_tau = x / tau; return max / pow(1.0 + x_over_tau * x_over_tau / nu, -(nu + 1.0) / 2.0); };
static inline double tdist(double x, double max, double nu, double tau) {
double x_over_tau = x / tau;
return max / pow(1.0 + x_over_tau * x_over_tau / nu, -(nu + 1.0) / 2.0);
};

public:
SpatialKernel(const SpatialKernel&) = delete; // no copying
Expand Down

0 comments on commit bf3ea73

Please sign in to comment.