55 const int n =
static_cast<int>(pValues.size());
58 std::vector<std::pair<double, int>> indexed(n);
59 for (
int i = 0; i < n; ++i) {
60 indexed[i] = {pValues.data()[i], i};
64 std::sort(indexed.begin(), indexed.end());
67 std::vector<double> adjusted(n);
68 for (
int i = 0; i < n; ++i) {
69 adjusted[i] = indexed[i].first *
static_cast<double>(n - i);
73 for (
int i = 1; i < n; ++i) {
74 adjusted[i] = std::max(adjusted[i], adjusted[i - 1]);
78 MatrixXd corrected(pValues.rows(), pValues.cols());
79 for (
int i = 0; i < n; ++i) {
80 corrected.data()[indexed[i].second] = std::min(adjusted[i], 1.0);
90 const int n =
static_cast<int>(pValues.size());
92 std::vector<std::pair<double, int>> indexed(n);
93 for (
int i = 0; i < n; ++i)
94 indexed[i] = {pValues.data()[i], i};
95 std::sort(indexed.begin(), indexed.end());
98 double harmonic = 1.0;
101 for (
int k = 1; k <= n; ++k)
105 std::vector<double> adjusted(n);
106 int lastRejected = -1;
107 for (
int i = 0; i < n; ++i) {
108 const double factor = (i + 1) / (
static_cast<double>(n) * harmonic);
109 adjusted[i] = indexed[i].first / factor;
110 if (indexed[i].first < factor * alpha)
113 for (
int i = n - 2; i >= 0; --i)
114 adjusted[i] = std::min(adjusted[i], adjusted[i + 1]);
116 MatrixXd corrected(pValues.rows(), pValues.cols());
118 *reject = RejectMask::Constant(pValues.rows(), pValues.cols(),
false);
119 for (
int i = 0; i < n; ++i) {
120 corrected.data()[indexed[i].second] = std::min(adjusted[i], 1.0);
122 reject->data()[indexed[i].second] = i <= lastRejected;