Skip to content

Commit 4443c40

Browse files
committed
Divide mean number of mutations by genome length. Fixes #186.
1 parent e6137ee commit 4443c40

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

fwdpp/ts/mutate_tables.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,13 @@ namespace fwdpp
7575
return nmuts;
7676
}
7777
auto mr = mark_multiple_roots(tables, samples);
78+
const double L = tables.genome_length();
7879
for (auto &i : mr)
7980
{
8081
auto dt = tables.node_table[i.first].time;
8182
for (auto j : i.second)
8283
{
83-
double mean = dt * (j.second - j.first) * mu;
84+
double mean = dt * (j.second - j.first) * mu / L;
8485
auto nm = gsl_ran_poisson(r.get(), mean);
8586
nmuts += nm;
8687
for (unsigned m = 0; m < nm; ++m)
@@ -99,7 +100,7 @@ namespace fwdpp
99100
auto ct = tables.node_table[e.child].time;
100101
auto pt = tables.node_table[e.parent].time;
101102
auto dt = ct - pt;
102-
double mean = dt * (e.right - e.left) * mu;
103+
double mean = dt * (e.right - e.left) * mu / L;
103104
auto nm = gsl_ran_poisson(r.get(), mean);
104105
for (unsigned m = 0; m < nm; ++m)
105106
{

0 commit comments

Comments
 (0)