aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/histogram/adaptive
diff options
context:
space:
mode:
authoryazevnul <yazevnul@yandex-team.ru>2022-02-10 16:46:46 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:46 +0300
commit8cbc307de0221f84c80c42dcbe07d40727537e2c (patch)
tree625d5a673015d1df891e051033e9fcde5c7be4e5 /library/cpp/histogram/adaptive
parent30d1ef3941e0dc835be7609de5ebee66958f215a (diff)
downloadydb-8cbc307de0221f84c80c42dcbe07d40727537e2c.tar.gz
Restoring authorship annotation for <yazevnul@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/histogram/adaptive')
-rw-r--r--library/cpp/histogram/adaptive/adaptive_histogram.cpp30
-rw-r--r--library/cpp/histogram/adaptive/auto_histogram.h10
-rw-r--r--library/cpp/histogram/adaptive/block_histogram.cpp28
-rw-r--r--library/cpp/histogram/adaptive/fixed_bin_histogram.cpp2
4 files changed, 35 insertions, 35 deletions
diff --git a/library/cpp/histogram/adaptive/adaptive_histogram.cpp b/library/cpp/histogram/adaptive/adaptive_histogram.cpp
index cbfc494021..ce204de6fd 100644
--- a/library/cpp/histogram/adaptive/adaptive_histogram.cpp
+++ b/library/cpp/histogram/adaptive/adaptive_histogram.cpp
@@ -80,7 +80,7 @@ namespace NKiwiAggr {
histo.GetType() == HT_ADAPTIVE_WARD_HISTOGRAM ||
histo.GetType() == HT_ADAPTIVE_HISTOGRAM)
{
- Y_VERIFY(histo.FreqSize() == histo.PositionSize(), "Corrupted histo");
+ Y_VERIFY(histo.FreqSize() == histo.PositionSize(), "Corrupted histo");
for (size_t j = 0; j < histo.FreqSize(); ++j) {
double value = histo.GetPosition(j);
double weight = histo.GetFreq(j);
@@ -350,7 +350,7 @@ namespace NKiwiAggr {
}
double TAdaptiveHistogram::CalcUpperBound(double sum) {
- Y_VERIFY(sum >= 0, "Sum must be >= 0");
+ Y_VERIFY(sum >= 0, "Sum must be >= 0");
if (sum == 0.0) {
return MinValue;
}
@@ -391,7 +391,7 @@ namespace NKiwiAggr {
}
double TAdaptiveHistogram::CalcLowerBound(double sum) {
- Y_VERIFY(sum >= 0, "Sum must be >= 0");
+ Y_VERIFY(sum >= 0, "Sum must be >= 0");
if (sum == 0.0) {
return MaxValue;
}
@@ -509,13 +509,13 @@ namespace NKiwiAggr {
++rightBin;
TWeightedValue newBin(value, weight + currentBin->second);
if (rightBin != Bins.end()) {
- Y_VERIFY(BinsByQuality.erase(CalcQuality(*currentBin, *rightBin)) == 1, "Erase failed");
+ Y_VERIFY(BinsByQuality.erase(CalcQuality(*currentBin, *rightBin)) == 1, "Erase failed");
BinsByQuality.insert(CalcQuality(newBin, *rightBin));
}
if (currentBin != Bins.begin()) {
TPairSet::iterator leftBin = currentBin;
--leftBin;
- Y_VERIFY(BinsByQuality.erase(CalcQuality(*leftBin, *currentBin)) == 1, "Erase failed");
+ Y_VERIFY(BinsByQuality.erase(CalcQuality(*leftBin, *currentBin)) == 1, "Erase failed");
BinsByQuality.insert(CalcQuality(*leftBin, newBin));
}
Bins.erase(currentBin);
@@ -530,7 +530,7 @@ namespace NKiwiAggr {
if (rightBin == Bins.end()) {
BinsByQuality.insert(CalcQuality(*leftBin, weightedValue));
} else {
- Y_VERIFY(BinsByQuality.erase(CalcQuality(*leftBin, *rightBin)) == 1, "Erase failed");
+ Y_VERIFY(BinsByQuality.erase(CalcQuality(*leftBin, *rightBin)) == 1, "Erase failed");
BinsByQuality.insert(CalcQuality(*leftBin, weightedValue));
BinsByQuality.insert(CalcQuality(weightedValue, *rightBin));
}
@@ -543,20 +543,20 @@ namespace NKiwiAggr {
void TAdaptiveHistogram::Erase(double value) {
TPairSet::iterator currentBin = Bins.lower_bound(TWeightedValue(value, -1.0));
- Y_VERIFY(currentBin != Bins.end() && currentBin->first == value, "Can't find bin that should be erased");
+ Y_VERIFY(currentBin != Bins.end() && currentBin->first == value, "Can't find bin that should be erased");
TPairSet::iterator rightBin = currentBin;
++rightBin;
if (currentBin == Bins.begin()) {
- Y_VERIFY(rightBin != Bins.end(), "No right bin for the first bin");
- Y_VERIFY(BinsByQuality.erase(CalcQuality(*currentBin, *rightBin)) != 0, "Erase failed");
+ Y_VERIFY(rightBin != Bins.end(), "No right bin for the first bin");
+ Y_VERIFY(BinsByQuality.erase(CalcQuality(*currentBin, *rightBin)) != 0, "Erase failed");
} else {
TPairSet::iterator leftBin = currentBin;
--leftBin;
if (rightBin == Bins.end()) {
- Y_VERIFY(BinsByQuality.erase(CalcQuality(*leftBin, *currentBin)) != 0, "Erase failed");
+ Y_VERIFY(BinsByQuality.erase(CalcQuality(*leftBin, *currentBin)) != 0, "Erase failed");
} else {
- Y_VERIFY(BinsByQuality.erase(CalcQuality(*leftBin, *currentBin)) != 0, "Erase failed");
- Y_VERIFY(BinsByQuality.erase(CalcQuality(*currentBin, *rightBin)) != 0, "Erase failed");
+ Y_VERIFY(BinsByQuality.erase(CalcQuality(*leftBin, *currentBin)) != 0, "Erase failed");
+ Y_VERIFY(BinsByQuality.erase(CalcQuality(*currentBin, *rightBin)) != 0, "Erase failed");
BinsByQuality.insert(CalcQuality(*leftBin, *rightBin));
}
}
@@ -565,12 +565,12 @@ namespace NKiwiAggr {
void TAdaptiveHistogram::Shrink() {
TPairSet::iterator worstBin = BinsByQuality.begin();
- Y_VERIFY(worstBin != BinsByQuality.end(), "No right bin for the first bin");
+ Y_VERIFY(worstBin != BinsByQuality.end(), "No right bin for the first bin");
TPairSet::iterator leftBin = Bins.lower_bound(TWeightedValue(worstBin->second, -1.0));
- Y_VERIFY(leftBin != Bins.end() && leftBin->first == worstBin->second, "Can't find worst bin");
+ Y_VERIFY(leftBin != Bins.end() && leftBin->first == worstBin->second, "Can't find worst bin");
TPairSet::iterator rightBin = leftBin;
++rightBin;
- Y_VERIFY(rightBin != Bins.end(), "Can't find right bin");
+ Y_VERIFY(rightBin != Bins.end(), "Can't find right bin");
TWeightedValue newBin((leftBin->first * leftBin->second + rightBin->first * rightBin->second) / (leftBin->second + rightBin->second), leftBin->second + rightBin->second);
if (Bins.size() > 2) {
diff --git a/library/cpp/histogram/adaptive/auto_histogram.h b/library/cpp/histogram/adaptive/auto_histogram.h
index 9fdf0b9abe..08e4e3d9d4 100644
--- a/library/cpp/histogram/adaptive/auto_histogram.h
+++ b/library/cpp/histogram/adaptive/auto_histogram.h
@@ -20,8 +20,8 @@ namespace NKiwiAggr {
public:
TAutoHistogram(size_t intervals, ui64 id = 0) {
- Y_UNUSED(intervals);
- Y_UNUSED(id);
+ Y_UNUSED(intervals);
+ Y_UNUSED(id);
ythrow yexception() << "Empty constructor is not defined for TAutoHistogram";
}
@@ -33,9 +33,9 @@ namespace NKiwiAggr {
}
TAutoHistogram(IHistogram* histo, size_t defaultIntervals = DEFAULT_INTERVALS, ui64 defaultId = 0) {
- Y_UNUSED(histo);
- Y_UNUSED(defaultIntervals);
- Y_UNUSED(defaultId);
+ Y_UNUSED(histo);
+ Y_UNUSED(defaultIntervals);
+ Y_UNUSED(defaultId);
ythrow yexception() << "IHistogram constructor is not defined for TAutoHistogram";
}
diff --git a/library/cpp/histogram/adaptive/block_histogram.cpp b/library/cpp/histogram/adaptive/block_histogram.cpp
index 6586d13ff6..7003255916 100644
--- a/library/cpp/histogram/adaptive/block_histogram.cpp
+++ b/library/cpp/histogram/adaptive/block_histogram.cpp
@@ -149,7 +149,7 @@ namespace NKiwiAggr {
histo.GetType() == HT_ADAPTIVE_WARD_HISTOGRAM ||
histo.GetType() == HT_ADAPTIVE_HISTOGRAM)
{
- Y_VERIFY(histo.FreqSize() == histo.PositionSize(), "Corrupted histo");
+ Y_VERIFY(histo.FreqSize() == histo.PositionSize(), "Corrupted histo");
for (size_t j = 0; j < histo.FreqSize(); ++j) {
double value = histo.GetPosition(j);
double weight = histo.GetFreq(j);
@@ -189,7 +189,7 @@ namespace NKiwiAggr {
}
void TBlockHistogram::Merge(TVector<IHistogramPtr> histogramsToMerge) {
- Y_UNUSED(histogramsToMerge);
+ Y_UNUSED(histogramsToMerge);
ythrow yexception() << "IHistogram::Merge(TVector<IHistogramPtr>) is not defined for TBlockHistogram";
}
@@ -286,7 +286,7 @@ namespace NKiwiAggr {
}
void TBlockHistogram::SortAndShrink(size_t intervals, bool final) {
- Y_VERIFY(intervals > 0);
+ Y_VERIFY(intervals > 0);
if (Bins.size() <= intervals) {
return;
@@ -382,7 +382,7 @@ namespace NKiwiAggr {
ui32 a = (ui32)(bins[b].Prev() - bins);
ui32 c = (ui32)(bins[b].Next() - bins);
ui32 d = (ui32)(bins[b].Next()->Next() - bins);
- Y_VERIFY(Bins[c].second != -1);
+ Y_VERIFY(Bins[c].second != -1);
double mass = Bins[b].second + Bins[c].second;
Bins[c].first = (Bins[b].first * Bins[b].second + Bins[c].first * Bins[c].second) / mass;
@@ -411,48 +411,48 @@ namespace NKiwiAggr {
Bins.resize(pos);
PrevSize = pos;
- Y_VERIFY(pos == intervals);
+ Y_VERIFY(pos == intervals);
}
double TBlockHistogram::GetSumInRange(double leftBound, double rightBound) {
- Y_UNUSED(leftBound);
- Y_UNUSED(rightBound);
+ Y_UNUSED(leftBound);
+ Y_UNUSED(rightBound);
ythrow yexception() << "Method is not implemented for TBlockHistogram";
return 0;
}
double TBlockHistogram::GetSumAboveBound(double bound) {
- Y_UNUSED(bound);
+ Y_UNUSED(bound);
ythrow yexception() << "Method is not implemented for TBlockHistogram";
return 0;
}
double TBlockHistogram::GetSumBelowBound(double bound) {
- Y_UNUSED(bound);
+ Y_UNUSED(bound);
ythrow yexception() << "Method is not implemented for TBlockHistogram";
return 0;
}
double TBlockHistogram::CalcUpperBound(double sum) {
- Y_UNUSED(sum);
+ Y_UNUSED(sum);
ythrow yexception() << "Method is not implemented for TBlockHistogram";
return 0;
}
double TBlockHistogram::CalcLowerBound(double sum) {
- Y_UNUSED(sum);
+ Y_UNUSED(sum);
ythrow yexception() << "Method is not implemented for TBlockHistogram";
return 0;
}
double TBlockHistogram::CalcUpperBoundSafe(double sum) {
- Y_UNUSED(sum);
+ Y_UNUSED(sum);
ythrow yexception() << "Method is not implemented for TBlockHistogram";
return 0;
}
double TBlockHistogram::CalcLowerBoundSafe(double sum) {
- Y_UNUSED(sum);
+ Y_UNUSED(sum);
ythrow yexception() << "Method is not implemented for TBlockHistogram";
return 0;
}
@@ -528,7 +528,7 @@ namespace NKiwiAggr {
}
void TBlockWardHistogram::FastGreedyShrink(size_t intervals) {
- Y_VERIFY(intervals > 0);
+ Y_VERIFY(intervals > 0);
if (Bins.size() <= intervals) {
return;
diff --git a/library/cpp/histogram/adaptive/fixed_bin_histogram.cpp b/library/cpp/histogram/adaptive/fixed_bin_histogram.cpp
index 558aba9e2d..aa33174f2d 100644
--- a/library/cpp/histogram/adaptive/fixed_bin_histogram.cpp
+++ b/library/cpp/histogram/adaptive/fixed_bin_histogram.cpp
@@ -512,7 +512,7 @@ namespace NKiwiAggr {
}
void TFixedBinHistogram::Shrink(double newReferencePoint, double newMaxValue) {
- Y_VERIFY(newReferencePoint < newMaxValue, "Invalid Shrink()");
+ Y_VERIFY(newReferencePoint < newMaxValue, "Invalid Shrink()");
memset(&(ReserveFreqs[0]), 0, ReserveFreqs.size() * sizeof(double));
double newBinRange = CalcBinRange(newReferencePoint, newMaxValue);