const Language* Config::findLanguage(const std::string &filepath) const { const Language* lang = nullptr; namespace fs = boost::filesystem; fs::path path(filepath); std::wstring filename = path.filename().wstring(); std::wstring extension = path.extension().wstring(); // remove dot extension.erase(0, 1); // search auto langIt = boost::find_if(languages, [extension, filename](const Language &lang){ auto extIt = boost::find_if(lang.extensions, [extension, filename](const std::string &ext){ std::wstring wext(ext.begin(), ext.end()); return wext == extension || wext == filename; }); return extIt != std::end(lang.extensions); }); if (langIt != std::end(languages)) { lang = &(*langIt); } return lang; }
/* * AS R63 Appl. Statist. (1986) Vol. 35, No.2 * * A remark on AS 181 * * Calculates Sheppard Cdhc_corrected version of W test. * * Auxiliary functions required: Cdhc_alnorm = algorithm AS 66, and PPND = * algorithm AS 111 (or Cdhc_ppnd7 from AS 241). */ void Cdhc_wgp(double x[], int n, double ssq, double gp, double h, double a[], int n2, double eps, double w, double u, double p, int *ifault) { double zbar, zsd, an1, hh; zbar = 0.0; zsd = 1.0; *ifault = 1; if (n < 7) return; if (gp > 0.0) { /* No Cdhc_correction applied if gp=0. */ an1 = (double)(n - 1); /* Cdhc_correct ssq and find standardized grouping interval (h) */ ssq = ssq - an1 * gp * gp / 12.0; h = gp / sqrt(ssq / an1); *ifault = 4; if (h > 1.5) return; } wext(x, n, ssq, a, n2, eps, &w, &p, ifault); if (*ifault != 0) return; if (!(p > 0.0 && p < 1.0)) { u = 5.0 - 10.0 * p; return; } if (gp > 0.0) { /* Cdhc_correct u for grouping interval (n<=100 and n>100 separately) */ hh = sqrt(h); if (n <= 100) { zbar = -h * (1.07457 + hh * (-2.8185 + hh * 1.8898)); zsd = 1.0 + h * (0.50933 + hh * (-0.98305 + hh * 0.7408)); } else { zbar = -h * (0.96436 + hh * (-2.1300 + hh * 1.3196)); zsd = 1.0 + h * (0.2579 + h * 0.15225); } } /* ppnd is AS 111 (Beasley and Springer, 1977) */ u = (-ppnd16(p) - zbar) / zsd; /* Cdhc_alnorm is AS 66 (Hill, 1973) */ p = Cdhc_alnorm(u, 1); return; }