-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
141 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,34 @@ | ||
template <typename T, typename U> | ||
NumericVector impl_ksample_pmt( | ||
template <bool progress, typename T> | ||
RObject impl_ksample_pmt( | ||
const NumericVector data, | ||
IntegerVector group, | ||
const U& statistic_func, | ||
const T& statistic_func, | ||
const double n_permu) | ||
{ | ||
T bar; | ||
Stat<progress> statistic_container; | ||
|
||
auto statistic_closure = statistic_func(data, group); | ||
auto ksample_update = [data, group, &statistic_closure, &bar]() { | ||
return bar << statistic_closure(data, group); | ||
auto ksample_update = [data, group, &statistic_closure, &statistic_container]() { | ||
return statistic_container << statistic_closure(data, group); | ||
}; | ||
|
||
bar.init_statistic(ksample_update); | ||
statistic_container.init_statistic(ksample_update); | ||
|
||
if (!std::isnan(n_permu)) { | ||
if (n_permu == 0) { | ||
bar.init_statistic_permu(n_permutation(group)); | ||
statistic_container.init_statistic_permu(n_permutation(group)); | ||
|
||
do { | ||
ksample_update(); | ||
} while (next_permutation(group)); | ||
} else { | ||
bar.init_statistic_permu(n_permu); | ||
statistic_container.init_statistic_permu(n_permu); | ||
|
||
do { | ||
random_shuffle(group); | ||
} while (ksample_update()); | ||
} | ||
} | ||
|
||
return bar.close(); | ||
return statistic_container.close(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,45 @@ | ||
template <typename T, typename U> | ||
NumericVector impl_multcomp_pmt( | ||
template <bool progress, typename T> | ||
RObject impl_multcomp_pmt( | ||
const IntegerVector group_i, | ||
const IntegerVector group_j, | ||
const NumericVector data, | ||
IntegerVector group, | ||
const U& statistic_func, | ||
const T& statistic_func, | ||
const double n_permu) | ||
{ | ||
R_len_t n_group = group[group.size() - 1]; | ||
R_len_t n_pair = n_group * (n_group - 1) / 2; | ||
|
||
T bar(n_pair); | ||
Stat<progress> statistic_container(n_pair); | ||
|
||
auto multcomp_update = [group_i, group_j, data, group, n_pair, &statistic_func, &bar]() { | ||
auto multcomp_update = [group_i, group_j, data, group, n_pair, &statistic_func, &statistic_container]() { | ||
auto statistic_closure = statistic_func(data, group); | ||
|
||
bool flag = false; | ||
for (R_len_t k = 0; k < n_pair; k++) { | ||
flag = bar << statistic_closure(group_i[k], group_j[k]); | ||
flag = statistic_container << statistic_closure(group_i[k], group_j[k]); | ||
}; | ||
|
||
return flag; | ||
}; | ||
|
||
bar.init_statistic(multcomp_update); | ||
statistic_container.init_statistic(multcomp_update); | ||
|
||
if (!std::isnan(n_permu)) { | ||
if (n_permu == 0) { | ||
bar.init_statistic_permu(n_permutation(group)); | ||
statistic_container.init_statistic_permu(n_permutation(group)); | ||
|
||
do { | ||
multcomp_update(); | ||
} while (next_permutation(group)); | ||
} else { | ||
bar.init_statistic_permu(n_permu); | ||
statistic_container.init_statistic_permu(n_permu); | ||
|
||
do { | ||
random_shuffle(group); | ||
} while (multcomp_update()); | ||
} | ||
} | ||
|
||
return bar.close(); | ||
return statistic_container.close(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.