diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/param.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/param.cpp b/src/param.cpp index e2a61ea..7e34830 100644 --- a/src/param.cpp +++ b/src/param.cpp @@ -2039,9 +2039,20 @@ void PARAM::ProcessInclusionIndicators() { } // Obtain ni_test. + // + // This used to read `for (auto &i : indicator_idv) ni_test += indicator_idv[i];' + // -- a range-for binding each *element* (0 or 1) and then using it as an + // index, so the sum was ni_test == ni_total * indicator_idv[0 or 1], i.e. 0 or + // the total number of individuals. Everything downstream then sized its + // matrices to the wrong ni_test: the covariate matrix W got ni_total rows + // while genotypes were written only at the ni_test analyzed positions, leaving + // the tail uninitialised -- which made the -r2 covariate filter compute + // v_x = infinity and therefore never drop a SNP, and made the + // "number of analyzed individuals equals 0" check fire whenever the first + // individual happened to be missing. ni_test = 0; - for(auto &i : indicator_idv) { - ni_test += indicator_idv[i]; + for (auto i : indicator_idv) { + ni_test += i; } // If subsample number is set, perform a random sub-sampling |
