File haploid_genome_cleaner.hpp¶
↰ Parent directory (fwdpp/internal)
Contents
Definition (fwdpp/internal/haploid_genome_cleaner.hpp)¶
Detailed Description¶
This file handles the “pruning” of fixations from haploid_genomes. Whether or not any pruning happens depends on policies. Version 0.4.7 of the library made a major change resulting in improved run-time performance, especially for low mutation rates. Consider the case of neutral mutations occurring at rate mu (per site, per generation). The rate of fixation is also mu. Thus, when mu is low, the rate of fixation is low, and the expected time in generations between fixations is 1/mu. In other words, calling haploid_genome_cleaner every generation is an unnecessary run-time cost. Now, we check if any fixations exist, and return if there are none. We check separately for neutral- and non-neutral fixations. Naively, we could simply scan the mutations container of the entire simulation for fixations. But, we can do better than that because:
Fixations are, by definition, found in all haploid_genomes. Thus, it suffices to check the first (extant) haploid_genome.
When we find the first fixation in a haploid_genome, it is by definition the fixation with the smallest position, out of all fixations. We can store its value and use it to look up the first fixation in all of the remaining haploid_genomes. Searching for the first fixation in this way avoids cache misses that are unavoidable when we do out-of-order lookups in “mcounts” for the remaining fixations.
Includes¶
algorithm(File compact_mutations.hpp)fwdpp/forward_types.hpp(File forward_types.hpp)fwdpp/fwd_functional.hpp(File fwd_functional.hpp)limitstype_traits(File type_traits.hpp)utilityvector