aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/hyperloglog
diff options
context:
space:
mode:
authorAnton Samokhvalov <pg83@yandex.ru>2022-02-10 16:45:17 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:17 +0300
commitd3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch)
treedd4bd3ca0f36b817e96812825ffaf10d645803f2 /library/cpp/hyperloglog
parent72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff)
downloadydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/hyperloglog')
-rw-r--r--library/cpp/hyperloglog/hyperloglog.cpp50
-rw-r--r--library/cpp/hyperloglog/hyperloglog.h2
-rw-r--r--library/cpp/hyperloglog/hyperloglog_ut.cpp18
3 files changed, 35 insertions, 35 deletions
diff --git a/library/cpp/hyperloglog/hyperloglog.cpp b/library/cpp/hyperloglog/hyperloglog.cpp
index c162fad798..ec8352abe1 100644
--- a/library/cpp/hyperloglog/hyperloglog.cpp
+++ b/library/cpp/hyperloglog/hyperloglog.cpp
@@ -40,7 +40,7 @@ namespace {
double EstimateBias(double e, unsigned precision) {
static const TCorrection CORRECTIONS[1 + THyperLogLog::PRECISION_MAX - THyperLogLog::PRECISION_MIN] = {
-#include "hyperloglog_corrections.inc"
+#include "hyperloglog_corrections.inc"
};
if (precision < THyperLogLog::PRECISION_MIN || precision > THyperLogLog::PRECISION_MAX) {
return 0.;
@@ -51,21 +51,21 @@ namespace {
double GetThreshold(unsigned precision) {
static const double THRESHOLD_DATA[1 + THyperLogLog::PRECISION_MAX - THyperLogLog::PRECISION_MIN] = {
- 10, // Precision 4
- 20, // Precision 5
- 40, // Precision 6
- 80, // Precision 7
- 220, // Precision 8
- 400, // Precision 9
- 900, // Precision 10
- 1800, // Precision 11
- 3100, // Precision 12
- 6500, // Precision 13
- 11500, // Precision 14
- 20000, // Precision 15
- 50000, // Precision 16
- 120000, // Precision 17
- 350000 // Precision 18
+ 10, // Precision 4
+ 20, // Precision 5
+ 40, // Precision 6
+ 80, // Precision 7
+ 220, // Precision 8
+ 400, // Precision 9
+ 900, // Precision 10
+ 1800, // Precision 11
+ 3100, // Precision 12
+ 6500, // Precision 13
+ 11500, // Precision 14
+ 20000, // Precision 15
+ 50000, // Precision 16
+ 120000, // Precision 17
+ 350000 // Precision 18
};
if (precision < THyperLogLog::PRECISION_MIN || precision > THyperLogLog::PRECISION_MAX) {
return 0.;
@@ -76,14 +76,14 @@ namespace {
double EmpiricAlpha(size_t m) {
switch (m) {
- case 16:
- return 0.673;
- case 32:
- return 0.697;
- case 64:
- return 0.709;
- default:
- return 0.7213 / (1.0 + 1.079 / m);
+ case 16:
+ return 0.673;
+ case 32:
+ return 0.697;
+ case 64:
+ return 0.709;
+ default:
+ return 0.7213 / (1.0 + 1.079 / m);
}
}
@@ -109,7 +109,7 @@ void THyperLogLogBase::Update(ui64 hash) {
const unsigned subHashBits = 8 * sizeof(hash) - Precision;
const auto subHash = hash & MaskLowerBits(subHashBits);
const auto leadingZeroes = subHash ? (subHashBits - GetValueBitCount(subHash)) : subHashBits;
- const ui8 weight = static_cast<ui8>(leadingZeroes + 1);
+ const ui8 weight = static_cast<ui8>(leadingZeroes + 1);
const size_t reg = static_cast<size_t>(hash >> subHashBits);
RegistersRef[reg] = std::max(RegistersRef[reg], weight);
diff --git a/library/cpp/hyperloglog/hyperloglog.h b/library/cpp/hyperloglog/hyperloglog.h
index d0a6e7376d..e79ee0ed77 100644
--- a/library/cpp/hyperloglog/hyperloglog.h
+++ b/library/cpp/hyperloglog/hyperloglog.h
@@ -42,7 +42,7 @@ private:
public:
THyperLogLogWithAlloc(THyperLogLogWithAlloc&&) = default;
-
+
THyperLogLogWithAlloc& operator=(THyperLogLogWithAlloc&&) = default;
static THyperLogLogWithAlloc Create(unsigned precision) {
diff --git a/library/cpp/hyperloglog/hyperloglog_ut.cpp b/library/cpp/hyperloglog/hyperloglog_ut.cpp
index 7218536bce..b987aa0fa4 100644
--- a/library/cpp/hyperloglog/hyperloglog_ut.cpp
+++ b/library/cpp/hyperloglog/hyperloglog_ut.cpp
@@ -15,15 +15,15 @@ Y_UNIT_TEST_SUITE(THyperLogLog) {
auto counter = THyperLogLog::Create(18);
static const std::pair<ui64, ui64> POINTS[] = {
- {10, 10},
- {100, 100},
- {1000, 998},
- {10000, 9978},
- {100000, 99995},
- {1000000, 997017},
- {10000000, 9983891},
- {100000000, 100315572},
- {1000000000, 998791445},
+ {10, 10},
+ {100, 100},
+ {1000, 998},
+ {10000, 9978},
+ {100000, 99995},
+ {1000000, 997017},
+ {10000000, 9983891},
+ {100000000, 100315572},
+ {1000000000, 998791445},
//1:37: {10000000000, 10015943904}
};
ui64 unique = 0;