Struct state_matrix

Struct Documentation

struct fwdpp::state_matrix

Simplistic matrix representation of mutations This type uses std::vector<std::int8_t> to hold a matrix representing the genotypes for a set of diploids.

For a haplotype matrix of n individuals, the data represent 2n columns with a 0/1 encoding representing ancestral/derived.

For a genotype matrix of n individuals, the data represent n columns with a 0/1/2 encoding for the number of copies of the derived mutation.

The data layout is row-major (aka “C-style”) ordering, facilitating compatibility with GSL matrix types, NumPy 2D arrays, etc. Note that GSL matrices may be constructed using gsl_matrix_view_array or gsl_matrix_const_view_array for cases where a matrix of only neutral or only selected mutations is needed.

We use the 8-bit integer type to save space. In practice, one may convert (via copy) to other types for operations like regression.

Note

This type is not constructed directly, but rather returned by other functions.

Public Functions

state_matrix()

Construct an empty object.

template<typename T, typename P>
state_matrix(T &&t, P &&p)

Perfect-forwarding constructor.

Public Members

std::vector<std::int8_t> data

The state data.

std::vector<double> positions

Positions of variable sites.