diff options
| author | reverie <[email protected]> | 2022-02-10 16:50:56 +0300 | 
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:50:56 +0300 | 
| commit | a53448e7a898701b4411c68f0d438e703872f1a1 (patch) | |
| tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp | |
| parent | 715969815532bc3ecdd5169efec8fc265e700a8b (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'library/cpp')
| -rw-r--r-- | library/cpp/histogram/adaptive/fixed_bin_histogram.cpp | 28 | ||||
| -rw-r--r-- | library/cpp/histogram/adaptive/fixed_bin_histogram.h | 20 | ||||
| -rw-r--r-- | library/cpp/histogram/adaptive/protos/histo.proto | 42 | ||||
| -rw-r--r-- | library/cpp/histogram/adaptive/protos/ya.make | 14 | ||||
| -rw-r--r-- | library/cpp/histogram/adaptive/ya.make | 22 | 
5 files changed, 63 insertions, 63 deletions
diff --git a/library/cpp/histogram/adaptive/fixed_bin_histogram.cpp b/library/cpp/histogram/adaptive/fixed_bin_histogram.cpp index d7760e60b58..558aba9e2d1 100644 --- a/library/cpp/histogram/adaptive/fixed_bin_histogram.cpp +++ b/library/cpp/histogram/adaptive/fixed_bin_histogram.cpp @@ -1,14 +1,14 @@ -#include "fixed_bin_histogram.h"  +#include "fixed_bin_histogram.h"  #include "auto_histogram.h" -  +  #include <library/cpp/histogram/adaptive/protos/histo.pb.h> -  +  #include <util/generic/algorithm.h>  #include <util/generic/yexception.h>  #include <util/generic/ymath.h>  #include <util/string/printf.h> -namespace NKiwiAggr {  +namespace NKiwiAggr {      TFixedBinHistogram::TFixedBinHistogram(size_t intervals, ui64 id, size_t trainingSetSize)          : TrainingSetSize(trainingSetSize)          , IsInitialized(false) @@ -37,7 +37,7 @@ namespace NKiwiAggr {      {          FromProto(histo);      } -  +      TFixedBinHistogram::TFixedBinHistogram(IHistogram* histo, size_t defaultIntervals, ui64 defaultId, size_t trainingSetSize)          : TrainingSetSize(trainingSetSize)          , IsInitialized(false) @@ -203,7 +203,7 @@ namespace NKiwiAggr {                  }              }          } -    }  +    }      void TFixedBinHistogram::Multiply(double factor) {          if (!IsValidFloat(factor) || factor <= 0) { @@ -252,8 +252,8 @@ namespace NKiwiAggr {              }              Sum += Freqs[i];          } -    }  -  +    } +      void TFixedBinHistogram::ToProto(THistogram& histo) {          histo.Clear();          if (!IsInitialized) { @@ -286,9 +286,9 @@ namespace NKiwiAggr {      bool TFixedBinHistogram::Empty() {          if (!IsInitialized) {              Initialize(); -        }  +        }          return IsEmpty; -    }  +    }      double TFixedBinHistogram::GetMinValue() {          if (!IsInitialized) { @@ -296,18 +296,18 @@ namespace NKiwiAggr {          }          return MinValue;      } -  +      double TFixedBinHistogram::GetMaxValue() {          if (!IsInitialized) {              Initialize();          }          return MaxValue; -    }  +    }      double TFixedBinHistogram::GetSum() {          return Sum; -    }  -  +    } +      double TFixedBinHistogram::GetSumInRange(double leftBound, double rightBound) {          if (!IsInitialized) {              Initialize(); diff --git a/library/cpp/histogram/adaptive/fixed_bin_histogram.h b/library/cpp/histogram/adaptive/fixed_bin_histogram.h index a14e9606e72..bd380bd94a5 100644 --- a/library/cpp/histogram/adaptive/fixed_bin_histogram.h +++ b/library/cpp/histogram/adaptive/fixed_bin_histogram.h @@ -1,26 +1,26 @@ -#pragma once  -  +#pragma once +  #include "histogram.h"  #include <library/cpp/histogram/adaptive/protos/histo.pb.h>  #include <util/generic/ptr.h> -#include <util/generic/vector.h>  +#include <util/generic/vector.h>  #include <utility> -  -namespace NKiwiAggr {  + +namespace NKiwiAggr {      class TFixedBinHistogram: private TNonCopyable, public IHistogram {      private:          static const size_t DEFAULT_TRAINING_SET_SIZE = 10000;          static const size_t DEFAULT_INTERVALS = 100; -  +          typedef std::pair<double, double> TWeightedValue; // value, weight          THolder<TVector<TWeightedValue>> TrainingSet;          size_t TrainingSetSize;          bool IsInitialized;          bool IsEmpty; -  +          ui64 Id;          double MinValue;          double MaxValue; @@ -34,15 +34,15 @@ namespace NKiwiAggr {          i32 FirstUsedBin;          i32 LastUsedBin;          i32 BaseIndex; -  +      public:          TFixedBinHistogram(size_t intervals, ui64 id = 0, size_t trainingSetSize = DEFAULT_TRAINING_SET_SIZE);          TFixedBinHistogram(const THistogram& histo, size_t defaultIntervals = DEFAULT_INTERVALS, ui64 defaultId = 0, size_t trainingSetSize = DEFAULT_TRAINING_SET_SIZE);          TFixedBinHistogram(IHistogram* histo, size_t defaultIntervals = DEFAULT_INTERVALS, ui64 defaultId = 0, size_t trainingSetSize = DEFAULT_TRAINING_SET_SIZE); -  +          virtual ~TFixedBinHistogram() {          } -  +          virtual void Clear();          virtual void Add(double value, double weight); diff --git a/library/cpp/histogram/adaptive/protos/histo.proto b/library/cpp/histogram/adaptive/protos/histo.proto index 55099fbf74c..8961fef0227 100644 --- a/library/cpp/histogram/adaptive/protos/histo.proto +++ b/library/cpp/histogram/adaptive/protos/histo.proto @@ -1,17 +1,17 @@ -package NKiwiAggr;  -  -  -// THistoRec represents a value record added to a multihistogram  -message THistoRec {  -    optional uint64 Id = 1; // Current histogram identifier  -    optional double Value = 2;  +package NKiwiAggr; + + +// THistoRec represents a value record added to a multihistogram +message THistoRec { +    optional uint64 Id = 1; // Current histogram identifier +    optional double Value = 2;      optional double Weight = 3 [default = 1.0]; // You can set a certain weight to each record or just skip records using Weight=0 -}  -  -message THistoRecs {  -    repeated THistoRec HistoRecs = 1;  -}  -  +} + +message THistoRecs { +    repeated THistoRec HistoRecs = 1; +} +  enum EHistogramType {      HT_FIXED_BIN_HISTOGRAM = 1;      HT_ADAPTIVE_DISTANCE_HISTOGRAM = 2; @@ -20,17 +20,17 @@ enum EHistogramType {      HT_ADAPTIVE_WARD_HISTOGRAM = 5;  } -message THistogram {  -    optional uint64 Id = 1;  -    optional double MinValue = 2;  +message THistogram { +    optional uint64 Id = 1; +    optional double MinValue = 2;      optional double BinRange = 4; // for FIXED_BIN_HISTOGRAM only. And it's OK that it is 4 after 2      repeated float Freq = 5;      repeated float Position = 6;  // for ADAPTIVE histograms only      optional double MaxValue = 7;      optional EHistogramType Type = 8;  // Empty field means FIXED_BIN_HISTOGRAM -}  -  -// Multihistogam  -message THistograms {  -    repeated THistogram HistoRecs = 1;  +} + +// Multihistogam +message THistograms { +    repeated THistogram HistoRecs = 1;  } diff --git a/library/cpp/histogram/adaptive/protos/ya.make b/library/cpp/histogram/adaptive/protos/ya.make index 8a9e578a5fd..7635cfcb8cd 100644 --- a/library/cpp/histogram/adaptive/protos/ya.make +++ b/library/cpp/histogram/adaptive/protos/ya.make @@ -1,13 +1,13 @@  PROTO_LIBRARY() -  +  OWNER(g:crawl) -  -SRCS(  -    histo.proto  -)  -  + +SRCS( +    histo.proto +) +  IF (NOT PY_PROTOS_FOR)      EXCLUDE_TAGS(GO_PROTO)  ENDIF() -END()  +END() diff --git a/library/cpp/histogram/adaptive/ya.make b/library/cpp/histogram/adaptive/ya.make index ad323495361..b589801b272 100644 --- a/library/cpp/histogram/adaptive/ya.make +++ b/library/cpp/histogram/adaptive/ya.make @@ -1,20 +1,20 @@ -LIBRARY()  -  +LIBRARY() +  OWNER(      zosimov      svirg  ) -  -SRCS(  + +SRCS(      common.cpp      adaptive_histogram.cpp      block_histogram.cpp -    fixed_bin_histogram.cpp  -)  -  -PEERDIR(  +    fixed_bin_histogram.cpp +) + +PEERDIR(      contrib/libs/protobuf      library/cpp/histogram/adaptive/protos -)  -  -END()  +) + +END()  | 
