A template for a class that performs validation on various types of matrices.
More...
#include <jade.verification.hpp>
|
static bool | validate_c (const matrix_type &c) |
| Validates the C matrix and throws an exception if validation fails. More...
|
|
static bool | validate_f (const matrix_type &f) |
| Validates the F matrix and throws an exception if validation fails. More...
|
|
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. More...
|
|
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. More...
|
|
static bool | validate_g (const genotype_matrix_type &g) |
| Validates the G matrix and throws an exception if validation fails. More...
|
|
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. More...
|
|
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. More...
|
|
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. More...
|
|
static bool | validate_q (const matrix_type &q) |
| Validates the Q matrix and throws an exception if validation fails. More...
|
|
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. More...
|
|
template<typename TValue>
class jade::basic_verification< TValue >
A template for a class that performs validation on various types of matrices.
Definition at line 19 of file jade.verification.hpp.
◆ genotype_matrix_type
template<typename TValue >
◆ matrix_type
template<typename TValue >
◆ value_type
template<typename TValue >
◆ validate_c()
template<typename TValue >
Validates the C matrix and throws an exception if validation fails.
- Returns
- True.
- Parameters
-
c | The C matrix to validate. |
Definition at line 38 of file jade.verification.hpp.
42 throw error() <<
"invalid C matrix size " << c.get_size_str()
45 const auto rk = c.get_height();
47 throw error() <<
"invalid C matrix size " << c.get_size_str()
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) <<
")";
63 if (!cholesky.potrf_lower() || !cholesky.potri_lower())
64 throw error(
"invalid C matrix is not positive semidefinite");
◆ validate_f()
template<typename TValue >
Validates the F matrix and throws an exception if validation fails.
- Returns
- True.
- Parameters
-
f | The F matrix to validate. |
Definition at line 73 of file jade.verification.hpp.
80 const auto K = f.get_height();
81 const auto J = f.get_width();
84 throw error() <<
"invalid F matrix size " << f.get_size_str()
85 <<
" does not contain any components";
88 throw error() <<
"invalid F matrix size " << f.get_size_str()
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";
◆ validate_fc_sizes()
template<typename TValue >
Validates the sizes of the F and C matrices and throws an exception if validation fails.
- Returns
- True.
- Parameters
-
f | The F matrix to validate. |
c | The C matrix to validate. |
Definition at line 114 of file jade.verification.hpp.
118 if (f.get_height() != c.get_height() + 1)
120 <<
"inconsistent F matrix size " << f.get_size_str()
121 <<
" and C matrix size " << c.get_size_str();
◆ validate_fif_size()
template<typename TValue >
Validates the size of the Fin-force matrix and throws an exception if validation fails.
- Returns
- True.
- Parameters
-
fif | The Fin-force matrix. |
k | The component count. |
j | The marker count. |
Definition at line 131 of file jade.verification.hpp.
136 const auto fif_height = fif.get_height();
137 const auto fif_width = fif.get_width();
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 <<
")";
◆ validate_g()
template<typename TValue >
Validates the G matrix and throws an exception if validation fails.
- Returns
- True.
- Parameters
-
g | The G matrix to validate. |
Definition at line 158 of file jade.verification.hpp.
161 if (0 == g.get_height())
162 throw error() <<
"invalid G matrix size " << g.get_size_str()
163 <<
" does not contain any individuals";
165 if (0 == g.get_width())
166 throw error() <<
"invalid G matrix size " << g.get_size_str()
167 <<
" does not contain any markers";
◆ validate_gf_sizes()
template<typename TValue >
Validates the sizes of the G and F matrices and throws an exception if validation fails.
- Returns
- True.
- Parameters
-
g | The G matrix to validate. |
f | The F matrix to validate. |
Definition at line 177 of file jade.verification.hpp.
181 if (g.get_width() != f.get_width())
183 <<
"inconsistent G matrix size " << g.get_size_str()
184 <<
" and F matrix size " << f.get_size_str();
◆ validate_gq_sizes()
template<typename TValue >
Validates the sizes of the G and Q matrices and throws an exception if validation fails.
- Returns
- True.
- Parameters
-
g | The G matrix to validate. |
q | The Q matrix to validate. |
Definition at line 194 of file jade.verification.hpp.
198 if (g.get_height() != q.get_height())
200 <<
"inconsistent G matrix size " << g.get_size_str()
201 <<
" and Q matrix size " << q.get_size_str();
◆ validate_gqf_sizes()
template<typename TValue >
Validates the sizes of the G, Q, and F matrices and throws an exception if validation fails.
- Returns
- True.
- Parameters
-
g | The G matrix to validate. |
q | The Q matrix to validate. |
f | The F matrix to validate. |
Definition at line 211 of file jade.verification.hpp.
◆ validate_q()
template<typename TValue >
Validates the Q matrix and throws an exception if validation fails.
- Returns
- True.
- Parameters
-
q | The Q matrix to validate. |
Definition at line 225 of file jade.verification.hpp.
228 const auto I = q.get_height();
229 const auto K = q.get_width();
232 throw error() <<
"invalid Q matrix size " << q.get_size_str()
233 <<
" does not contain any individuals";
236 throw error() <<
"invalid Q matrix size " << q.get_size_str()
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 <<
")";
◆ validate_qf_sizes()
template<typename TValue >
Validates the sizes of the Q and F matrices and throws an exception if validation fails.
- Returns
- True.
- Parameters
-
q | The Q matrix to validate. |
f | The F matrix to validate. |
Definition at line 268 of file jade.verification.hpp.
272 if (q.get_width() != f.get_height())
274 <<
"inconsistent Q matrix size " << q.get_size_str()
275 <<
" and F matrix size " << f.get_size_str();
◆ epsilon
template<typename TValue >
The documentation for this class was generated from the following file: