Browse Source

Restoring authorship annotation for <jacob@yandex-team.ru>. Commit 1 of 2.

jacob 3 years ago
parent
commit
1bf57447b8

+ 1 - 1
library/cpp/on_disk/chunks/chunked_helpers.h

@@ -554,7 +554,7 @@ public:
     }
 
     size_t GetSize() const {
-        return (size_t)(SizeofOffsets - 1);
+        return (size_t)(SizeofOffsets - 1); 
     }
 
     size_t GetLength(ui64 index) const {

+ 16 - 16
library/cpp/string_utils/levenshtein_diff/levenshtein_diff.h

@@ -1,13 +1,13 @@
 #pragma once
-
+ 
 #include <util/draft/matrix.h>
-#include <util/generic/algorithm.h>
-#include <util/generic/vector.h>
+#include <util/generic/algorithm.h> 
+#include <util/generic/vector.h> 
 #include <util/system/yassert.h>
 
 #include <type_traits>
 #include <utility>
-
+ 
 namespace NLevenshtein {
     enum EEditMoveType {
         EMT_SPECIAL,
@@ -16,11 +16,11 @@ namespace NLevenshtein {
         EMT_DELETE,
         EMT_INSERT
     };
-
+ 
     inline bool IsImportantEditMove(EEditMoveType p) {
         return (p != EMT_SPECIAL && p != EMT_PRESERVE);
     }
-
+ 
     inline void MakeMove(EEditMoveType t, int& p1, int& p2) {
         switch (t) {
             case EMT_PRESERVE:
@@ -37,10 +37,10 @@ namespace NLevenshtein {
             default:
                 break;
         }
-    }
-
+    } 
+ 
     using TEditChain = TVector<EEditMoveType>;
-
+ 
     template <typename TArgType>
     struct TWeightOneUnaryGetter {
         int operator()(const TArgType&) const {
@@ -76,10 +76,10 @@ namespace NLevenshtein {
         ma[0][0] = std::make_pair(0, EMT_SPECIAL);                 // starting point
         for (int i = 1; i <= l1; i++) {
             ma[i][0] = std::make_pair(ma[i - 1][0].first + deleteWeigher(str1[i - 1]), EMT_DELETE);
-        }
+        } 
         for (int i = 1; i <= l2; i++) {
             ma[0][i] = std::make_pair(ma[0][i - 1].first + insertWeigher(str2[i - 1]), EMT_INSERT);
-        }
+        } 
         // Here goes basic Levestein's algorithm
         for (int i = 1; i <= l1; i++) {
             for (int j = 1; j <= l2; j++) {
@@ -137,8 +137,8 @@ namespace NLevenshtein {
         if (weight != nullptr) {
             *weight = ma[l1][l2].first;
         }
-    }
-
+    } 
+ 
     template <class TStringType>
     size_t Distance(const TStringType& str1, const TStringType& str2) {
         TEditChain editChain;
@@ -160,7 +160,7 @@ namespace NLevenshtein {
             , MisspelledOffset(0)
             , MisspelledLength(0)
         {
-        }
+        } 
         TReplacement(int correctOffset, int correctLength, int misspelledOffset, int misspelledLength)
             : CorrectOffset(correctOffset)
             , CorrectLength(correctLength)
@@ -188,5 +188,5 @@ namespace NLevenshtein {
             }
             MakeMove(*it, c1, c2);
         }
-    }
-}
+    } 
+} 

+ 1 - 1
util/generic/vector_ut.cpp

@@ -427,7 +427,7 @@ private:
         v.shrink_to_fit();
         UNIT_ASSERT_EQUAL(v.capacity(), 11);
     }
-
+ 
     /* This test check a potential issue with empty base class
          * optimization. Some compilers (VC6) do not implement it
          * correctly resulting ina wrong behavior. */

+ 3 - 3
util/generic/ymath.cpp

@@ -27,7 +27,7 @@ double Erf(double x) {
 }
 
 #endif // _MSC_VER
-
+ 
 double LogGammaImpl(double x) {
     static constexpr double lnSqrt2Pi = 0.91893853320467274178; // log(sqrt(2.0 * PI))
     static constexpr double coeff9 = 1.0 / 1188.0;
@@ -35,7 +35,7 @@ double LogGammaImpl(double x) {
     static constexpr double coeff5 = 1.0 / 1260.0;
     static constexpr double coeff3 = -1.0 / 360.0;
     static constexpr double coeff1 = 1.0 / 12.0;
-
+ 
     if ((x == 1.0) || (x == 2.0)) {
         return 0.0; // 0! = 1
     }
@@ -53,4 +53,4 @@ double LogGammaImpl(double x) {
     res /= x;
     res += x * lnX - x + lnSqrt2Pi - 0.5 * lnX;
     return res + bonus;
-}
+} 

+ 3 - 3
util/generic/ymath.h

@@ -99,7 +99,7 @@ inline double Erf(double x) {
     return erf(x);
 }
 #endif
-
+ 
 /**
  * @returns                             Natural logarithm of the absolute value
  *                                      of the gamma function of provided argument.
@@ -114,8 +114,8 @@ inline double LogGamma(double x) noexcept {
 #elif defined(__GNUC__)
     return __builtin_lgamma(x);
 #elif defined(_unix_)
-    return lgamma(x);
-#else
+    return lgamma(x); 
+#else 
     extern double LogGammaImpl(double);
     return LogGammaImpl(x);
 #endif

+ 12 - 12
util/generic/ymath_ut.cpp

@@ -149,19 +149,19 @@ void TMathTest::TestErf() {
         UNIT_ASSERT_DOUBLES_EQUAL(f, values[i], 1e-7);
     }
 }
-
-void TMathTest::TestLogGamma() {
-    double curVal = 0.0;
-    for (int i = 1; i <= 20; i++) {
-        curVal += log((double)i);
+ 
+void TMathTest::TestLogGamma() { 
+    double curVal = 0.0; 
+    for (int i = 1; i <= 20; i++) { 
+        curVal += log((double)i); 
         UNIT_ASSERT_DOUBLES_EQUAL(curVal, LogGamma((double)(i + 1)), 1e-6);
-    }
-    curVal = log(M_PI) / 2.0;
-    for (int i = 1; i <= 20; i++) {
-        UNIT_ASSERT_DOUBLES_EQUAL(curVal, LogGamma(i - 0.5), 1e-6);
-        curVal += log(i - 0.5);
-    }
-}
+    } 
+    curVal = log(M_PI) / 2.0; 
+    for (int i = 1; i <= 20; i++) { 
+        UNIT_ASSERT_DOUBLES_EQUAL(curVal, LogGamma(i - 0.5), 1e-6); 
+        curVal += log(i - 0.5); 
+    } 
+} 
 
 void TMathTest::TestAbs() {
     UNIT_ASSERT_VALUES_EQUAL(Abs(1), 1);