clang format everything with new house style

This commit is contained in:
Hans Dembinski
2018-07-19 22:19:01 +02:00
parent b584eea0f2
commit 2198ff883f
33 changed files with 1173 additions and 858 deletions

View File

@@ -31,7 +31,8 @@ std::unique_ptr<double[]> random_array(unsigned n, int type) {
return r;
}
template<class T> void ignore( const T& ) { }
template <class T>
void ignore(const T&) {}
double baseline(unsigned n) {
auto r = random_array(n, 0);
@@ -49,7 +50,8 @@ double baseline(unsigned n) {
return best;
}
template <typename Histogram> double compare_1d(unsigned n, int distrib) {
template <typename Histogram>
double compare_1d(unsigned n, int distrib) {
auto r = random_array(n, distrib);
auto best = std::numeric_limits<double>::max();
@@ -65,14 +67,15 @@ template <typename Histogram> double compare_1d(unsigned n, int distrib) {
return best;
}
template <typename Histogram> double compare_2d(unsigned n, int distrib) {
template <typename Histogram>
double compare_2d(unsigned n, int distrib) {
auto r = random_array(n, distrib);
auto best = std::numeric_limits<double>::max();
for (unsigned k = 0; k < 20; ++k) {
auto h = Histogram(axis::regular<>(100, 0, 1), axis::regular<>(100, 0, 1));
auto t = clock();
for (unsigned i = 0; i < n/2; ++i)
for (unsigned i = 0; i < n / 2; ++i)
h(r[2 * i], r[2 * i + 1]);
t = clock() - t;
best = std::min(best, double(t) / CLOCKS_PER_SEC);
@@ -81,7 +84,8 @@ template <typename Histogram> double compare_2d(unsigned n, int distrib) {
return best;
}
template <typename Histogram> double compare_3d(unsigned n, int distrib) {
template <typename Histogram>
double compare_3d(unsigned n, int distrib) {
auto r = random_array(n, distrib);
auto best = std::numeric_limits<double>::max();
@@ -89,7 +93,7 @@ template <typename Histogram> double compare_3d(unsigned n, int distrib) {
auto h = Histogram(axis::regular<>(100, 0, 1), axis::regular<>(100, 0, 1),
axis::regular<>(100, 0, 1));
auto t = clock();
for (unsigned i = 0; i < n/3; ++i)
for (unsigned i = 0; i < n / 3; ++i)
h(r[3 * i], r[3 * i + 1], r[3 * i + 2]);
t = clock() - t;
best = std::min(best, double(t) / CLOCKS_PER_SEC);
@@ -98,7 +102,8 @@ template <typename Histogram> double compare_3d(unsigned n, int distrib) {
return best;
}
template <typename Histogram> double compare_6d(unsigned n, int distrib) {
template <typename Histogram>
double compare_6d(unsigned n, int distrib) {
auto r = random_array(n, distrib);
auto best = std::numeric_limits<double>::max();
@@ -108,9 +113,9 @@ template <typename Histogram> double compare_6d(unsigned n, int distrib) {
axis::regular<>(10, 0, 1), axis::regular<>(10, 0, 1));
auto t = clock();
for (unsigned i = 0; i < n/6; ++i) {
h(r[6 * i], r[6 * i + 1], r[6 * i + 2],
r[6 * i + 3], r[6 * i + 4], r[6 * i + 5]);
for (unsigned i = 0; i < n / 6; ++i) {
h(r[6 * i], r[6 * i + 1], r[6 * i + 2], r[6 * i + 3], r[6 * i + 4],
r[6 * i + 5]);
}
t = clock() - t;
best = std::min(best, double(t) / CLOCKS_PER_SEC);
@@ -131,19 +136,19 @@ int main() {
else
printf("normal distribution\n");
printf("hs_ss %.3f\n",
compare_1d<static_histogram<mp_list<axis::regular<>>,
array_storage<int>>>(
compare_1d<
static_histogram<mp_list<axis::regular<>>, array_storage<int>>>(
nfill, itype));
printf("hs_sd %.3f\n",
compare_1d<static_histogram<mp_list<axis::regular<>>,
adaptive_storage>>(nfill, itype));
compare_1d<
static_histogram<mp_list<axis::regular<>>, adaptive_storage>>(
nfill, itype));
printf("hd_ss %.3f\n",
compare_1d<dynamic_histogram<axis::types,
array_storage<int>>>(
compare_1d<dynamic_histogram<axis::types, array_storage<int>>>(
nfill, itype));
printf("hd_sd %.3f\n",
compare_1d<dynamic_histogram<axis::types, adaptive_storage>>(
nfill, itype));
compare_1d<dynamic_histogram<axis::types, adaptive_storage>>(nfill,
itype));
}
printf("2D\n");
@@ -152,21 +157,20 @@ int main() {
printf("uniform distribution\n");
else
printf("normal distribution\n");
printf("hs_ss %.3f\n",
compare_2d<static_histogram<
mp_list<axis::regular<>, axis::regular<>>,
array_storage<int>>>(nfill, itype));
printf("hs_sd %.3f\n",
compare_2d<static_histogram<
mp_list<axis::regular<>, axis::regular<>>,
adaptive_storage>>(nfill, itype));
printf(
"hs_ss %.3f\n",
compare_2d<static_histogram<mp_list<axis::regular<>, axis::regular<>>,
array_storage<int>>>(nfill, itype));
printf(
"hs_sd %.3f\n",
compare_2d<static_histogram<mp_list<axis::regular<>, axis::regular<>>,
adaptive_storage>>(nfill, itype));
printf("hd_ss %.3f\n",
compare_2d<dynamic_histogram<axis::types,
array_storage<int>>>(
compare_2d<dynamic_histogram<axis::types, array_storage<int>>>(
nfill, itype));
printf("hd_sd %.3f\n",
compare_2d<dynamic_histogram<axis::types, adaptive_storage>>(
nfill, itype));
compare_2d<dynamic_histogram<axis::types, adaptive_storage>>(nfill,
itype));
}
printf("3D\n");
@@ -184,12 +188,11 @@ int main() {
mp_list<axis::regular<>, axis::regular<>, axis::regular<>>,
adaptive_storage>>(nfill, itype));
printf("hd_ss %.3f\n",
compare_3d<dynamic_histogram<axis::types,
array_storage<int>>>(
compare_3d<dynamic_histogram<axis::types, array_storage<int>>>(
nfill, itype));
printf("hd_sd %.3f\n",
compare_3d<dynamic_histogram<axis::types, adaptive_storage>>(
nfill, itype));
compare_3d<dynamic_histogram<axis::types, adaptive_storage>>(nfill,
itype));
}
printf("6D\n");
@@ -201,19 +204,18 @@ int main() {
printf("hs_ss %.3f\n",
compare_6d<static_histogram<
mp_list<axis::regular<>, axis::regular<>, axis::regular<>,
axis::regular<>, axis::regular<>, axis::regular<>>,
axis::regular<>, axis::regular<>, axis::regular<>>,
array_storage<int>>>(nfill, itype));
printf("hs_sd %.3f\n",
compare_6d<static_histogram<
mp_list<axis::regular<>, axis::regular<>, axis::regular<>,
axis::regular<>, axis::regular<>, axis::regular<>>,
axis::regular<>, axis::regular<>, axis::regular<>>,
adaptive_storage>>(nfill, itype));
printf("hd_ss %.3f\n",
compare_6d<dynamic_histogram<axis::types,
array_storage<int>>>(
compare_6d<dynamic_histogram<axis::types, array_storage<int>>>(
nfill, itype));
printf("hd_sd %.3f\n",
compare_6d<dynamic_histogram<axis::types, adaptive_storage>>(
nfill, itype));
compare_6d<dynamic_histogram<axis::types, adaptive_storage>>(nfill,
itype));
}
}