|
ʻOhana
Population structure, admixture history, and selection using learning methods.
|
7 #ifndef JADE_VERIFICATION_HPP__
8 #define JADE_VERIFICATION_HPP__
10 #include "jade.genotype_matrix.hpp"
18 template <
typename TValue>
48 <<
" does not contain any components";
50 for (
size_t y = 0; y < rk; y++)
51 for (
size_t x = y + 1; x < rk; x++)
52 if (std::fabs(c(y, x) - c(x, y)) >
epsilon)
54 <<
"invalid C matrix cell [" << y+1 <<
","
55 << x+1 <<
"] (" << c(y, x)
56 <<
") is not equal to symmetric cell ["
57 << x+1 <<
"," << y+1 <<
"] (" << c(x, y) <<
")";
64 throw error(
"invalid C matrix is not positive semidefinite");
85 <<
" does not contain any components";
89 <<
" does not contain any markers";
91 for (
size_t k = 0; k < K; k++)
93 for (
size_t j = 0; j < J; j++)
95 const auto f_kj = f(k, j);
97 if (f_kj >= min && f_kj <= max)
101 <<
"invalid F matrix cell [" << k+1 <<
"," << j+1
102 <<
"] (" << f_kj <<
") is not between 0 and 1";
141 <<
"inconsistent marker count (" << j
142 <<
") and width of matrix specified for --fin-force "
143 <<
"option (" << fif_width <<
")";
147 <<
"inconsistent component count (" << k <<
") and "
148 <<
"height of matrix specified for --fin-force "
149 <<
"option (" << fif_height <<
")";
163 <<
" does not contain any individuals";
167 <<
" does not contain any markers";
233 <<
" does not contain any individuals";
237 <<
" does not contain any components";
239 for (
size_t i = 0; i < I; i++)
243 for (
size_t k = 0; k < K; k++)
245 const auto q_ik = q(i, k);
249 <<
"invalid Q matrix cell [" << i+1 <<
"," << k+1
250 <<
"] (" << q_ik <<
") is not between 0 and 1";
256 throw error() <<
"invalid Q matrix row " << i+1
257 <<
" does not sum to 1 (" << sum <<
")";
282 #endif // JADE_VERIFICATION_HPP__
static constexpr value_type epsilon
The epsilon value.
TValue value_type
The value type.
A template for a class that performs validation on various types of matrices.
static bool validate_c(const matrix_type &c)
Validates the C matrix and throws an exception if validation fails.
static bool validate_qf_sizes(const matrix_type &q, const matrix_type &f)
Validates the sizes of the Q and F matrices and throws an exception if validation fails.
static bool validate_gf_sizes(const genotype_matrix_type &g, const matrix_type &f)
Validates the sizes of the G and F matrices and throws an exception if validation fails.
virtual std::string get_size_str() const =0
basic_matrix< value_type > matrix_type
The matrix type.
A template for an abstract class implementing operations for a genotype matrix.
static bool validate_fc_sizes(const matrix_type &f, const matrix_type &c)
Validates the sizes of the F and C matrices and throws an exception if validation fails.
virtual size_t get_width() const =0
std::string get_size_str() const
static bool validate_f(const matrix_type &f)
Validates the F matrix and throws an exception if validation fails.
bool potrf_lower()
Forms the Cholesky factorization of a symmetric positive-definite matrix: [A = L * L^T] where L is th...
size_t get_height() const
static bool validate_gqf_sizes(const genotype_matrix_type &g, const matrix_type &q, const matrix_type &f)
Validates the sizes of the G, Q, and F matrices and throws an exception if validation fails.
static bool validate_gq_sizes(const genotype_matrix_type &g, const matrix_type &q)
Validates the sizes of the G and Q matrices and throws an exception if validation fails.
static bool validate_q(const matrix_type &q)
Validates the Q matrix and throws an exception if validation fails.
virtual size_t get_height() const =0
static bool validate_g(const genotype_matrix_type &g)
Validates the G matrix and throws an exception if validation fails.
basic_genotype_matrix< value_type > genotype_matrix_type
The genotype matrix type.
A template for a class representing an exception thrown from this namespace.
static bool validate_fif_size(const matrix_type &fif, const size_t k, const size_t j)
Validates the size of the Fin-force matrix and throws an exception if validation fails.
bool potri_lower()
Computes the inverse inv(A) of a symmetric positive definite matrix A. Before calling this routine,...