A library for working with phylogenetic data.
v0.25.0
common.cpp File Reference
#include "genesis/utils/math/common.hpp"
#include <array>
#include <cassert>
#include <iostream>
#include <limits>
#include <sstream>
#include <stdexcept>
#include <string>

Go to the source code of this file.

Namespaces

 genesis
 Container namespace for all symbols of genesis in order to keep them separate when used as a library.
 
 genesis::utils
 

Functions

size_t binomial_coefficient (size_t n, size_t k)
 Compute the binomial coefficient, that is n choose k, for two integer numbers. More...
 
double binomial_coefficient_approx (size_t n, size_t k)
 Compute the binomial coefficient, that is n choose k, for two integer numbers, for large numbers. More...
 
double log_factorial (size_t n)
 Return the logarithm (base e) of the factorial of n, that is log(n!). More...
 
std::vector< double > log_factorial_lookup_generator_ ()
 Helper function to generate above lookup table. More...
 

Variables

static const std::array< double, 1024 > log_factorial_lookup_
 Log-factorial log(x!) lookup table for fast computation of binomial coefficients. See binomial_coefficient_approx() for usage, and see log_factorial_lookup_generator_() for the generator function. More...