FFPopSim  2.0
Library for Population Genetics
 All Classes Files Functions Variables Macros Pages
hypercube_highd Class Reference

Hypercube class for high-dimensional simulations. More...

#include <ffpopsim_highd.h>

Public Member Functions

 hypercube_highd ()
 
 hypercube_highd (int dim_in, int s=0)
 
virtual ~hypercube_highd ()
 
int set_up (int dim_in, int s=0)
 
unsigned int get_dim ()
 
unsigned int get_seed ()
 
double get_func (boost::dynamic_bitset<> &genotype)
 Get single value on the hypercube. More...
 
double get_additive_coefficient (int locus)
 : get the trait coefficient of a locus. More...
 
double get_func_diff (boost::dynamic_bitset<> &genotype1, boost::dynamic_bitset<> &genotype2, vector< int > &diffpos)
 Calculate difference between two hypercube points efficiently. More...
 
void reset ()
 Reset the hypercube. More...
 
void reset_additive ()
 Reset the additive part of the hypercube. More...
 
int set_additive_coefficient (double value, int locus, int expected_locus=-1)
 reset the value of an additive coefficient More...
 
int add_coefficient (double value, vector< int > loci)
 assign single- or multi-locus trait coefficients. More...
 
int set_random_epistasis_strength (double sigma)
 set the standard deviation of random epistatic fitness More...
 

Public Attributes

int rng_offset
 
int dim
 
double hypercube_mean
 
double epistatic_std
 
vector< coeff_single_locus_tcoefficients_single_locus
 
vector< coeff_tcoefficients_epistasis
 

Detailed Description

Hypercube class for high-dimensional simulations.

This class is used for representing properties of genotypes. Unlike the low-dimensional sister class, no attempt is made to monitor the whole hypercube, because the dimension the space of genotypes of length L is \(2^L\). As a consequence, no Fourier transformations are implemented.

The main use of this class is either for pointwise assigment of values (for instance, we assign fitness only for the actually observed genotypes) or for low-order Fourier coefficients, like like main fitness effects and two-site epistasis, which scale like L and \(L^2\), respectively.

Constructor & Destructor Documentation

hypercube_highd::hypercube_highd ( )
hypercube_highd::hypercube_highd ( int  dim_in,
int  s = 0 
)

Here is the call graph for this function:

hypercube_highd::~hypercube_highd ( )
virtual

Member Function Documentation

int hypercube_highd::add_coefficient ( double  value,
vector< int >  loci 
)

assign single- or multi-locus trait coefficients.

It takes a double and assigns it to a trait coefficients with index set specified in vector loci.

double hypercube_highd::get_additive_coefficient ( int  locus)

: get the trait coefficient of a locus.

Loop over the additive coefficients and return the value once the locus is found.

Here is the caller graph for this function:

unsigned int hypercube_highd::get_dim ( )
inline
double hypercube_highd::get_func ( boost::dynamic_bitset<> &  genotype)

Get single value on the hypercube.

Parameters
genotypePoint of the hypercube
Returns
the value corresponding to that point

Here is the caller graph for this function:

double hypercube_highd::get_func_diff ( boost::dynamic_bitset<> &  genotype1,
boost::dynamic_bitset<> &  genotype2,
vector< int > &  diffpos 
)

Calculate difference between two hypercube points efficiently.

Parameters
genotype1first point on the hypercube
genotype2second point on the hypercube
diffposvector of positions at which they differ
Returns
the difference between the values, f(gt1) - f(gt2)

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int hypercube_highd::get_seed ( )
inline
void hypercube_highd::reset ( )

Reset the hypercube.

Here is the call graph for this function:

Here is the caller graph for this function:

void hypercube_highd::reset_additive ( )

Reset the additive part of the hypercube.

Here is the caller graph for this function:

int hypercube_highd::set_additive_coefficient ( double  value,
int  lindex,
int  expected_locus = -1 
)

reset the value of an additive coefficient

Note: it requires the index of the coefficient and the locus it is supposed to refer to.

Here is the caller graph for this function:

int hypercube_highd::set_random_epistasis_strength ( double  sigma)

set the standard deviation of random epistatic fitness

int hypercube_highd::set_up ( int  dim_in,
int  s = 0 
)

Here is the caller graph for this function:

Member Data Documentation

vector<coeff_t> hypercube_highd::coefficients_epistasis
vector<coeff_single_locus_t> hypercube_highd::coefficients_single_locus
int hypercube_highd::dim
double hypercube_highd::epistatic_std
double hypercube_highd::hypercube_mean
int hypercube_highd::rng_offset

The documentation for this class was generated from the following files: