|
ʻOhana
Population structure, admixture history, and selection using learning methods.
|
7 #ifndef JADE_GENOTYPE_MATRIX_HPP__
8 #define JADE_GENOTYPE_MATRIX_HPP__
10 #include "jade.matrix.hpp"
14 template <
typename TValue>
15 class basic_discrete_genotype_matrix;
17 template <
typename TValue>
18 class basic_likelihood_genotype_matrix;
24 template <
typename TValue>
47 #define JADE_CREATE_CASTS_TO_TYPE(TYPE, AS_TYPE, IS_TYPE, TO_TYPE) \
48 inline virtual const TYPE * AS_TYPE() const { \
51 inline virtual TYPE * AS_TYPE() { \
54 inline bool IS_TYPE() const { \
55 return nullptr != AS_TYPE(); \
57 inline const TYPE & TO_TYPE() const { \
58 const auto out = AS_TYPE(); \
59 assert(nullptr != out); \
62 inline TYPE & TO_TYPE() { \
63 const auto out = AS_TYPE(); \
64 assert(nullptr != out); \
68 JADE_CREATE_CASTS_TO_TYPE(
dgm_type, as_dgm, is_dgm, to_dgm)
69 JADE_CREATE_CASTS_TO_TYPE(
lgm_type, as_lgm, is_lgm, to_lgm)
71 #undef JADE_CREATE_CASTS_TO_TYPE
139 virtual std::string
str()
const = 0;
151 #endif // JADE_GENOTYPE_MATRIX_HPP__
basic_matrix< TValue > matrix_type
The matrix type.
A template class implementing operations for a likelihood genotype matrix type.
virtual std::string get_size_str() const =0
A template for an abstract class implementing operations for a genotype matrix.
basic_genotype_matrix()
Initializes a new instance of the class.
virtual size_t get_width() const =0
virtual matrix_type create_mu(const value_type f_epsilon) const =0
basic_discrete_genotype_matrix< value_type > dgm_type
The discrete genotype matrix type.
virtual value_type compute_lle(const matrix_type &q, const matrix_type &fa, const matrix_type &fb, const matrix_type &qfa, const matrix_type &qfb) const =0
A template for a class implementing operations for a discrete genotype matrix.
virtual ~basic_genotype_matrix()
Reclaims resources used by the class and derived classes.
basic_likelihood_genotype_matrix< value_type > lgm_type
The likelihood genotype matrix type.
virtual size_t get_height() const =0
virtual std::string str() const =0
TValue value_type
The value type.
virtual void compute_derivatives_q(const matrix_type &q, const matrix_type &fa, const matrix_type &fb, const matrix_type &qfa, const matrix_type &qfb, const size_t i, matrix_type &d_vec, matrix_type &h_mat) const =0
Computes the derivative vector and hessian matrix for a specified individual of the Q matrix.
A template class for a matrix.
virtual void compute_derivatives_f(const matrix_type &q, const matrix_type &fa, const matrix_type &fb, const matrix_type &qfa, const matrix_type &qfb, const size_t j, matrix_type &d_vec, matrix_type &h_mat) const =0
Computes the derivative vector and hessian matrix for a specified marker of the F matrix.