diff options
author | jacob <jacob@yandex-team.ru> | 2022-02-10 16:49:53 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:53 +0300 |
commit | 085a76cb8fd1fd01e9483d056938f022970cb4f0 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 | |
parent | 1bf57447b8a115cd60bb6f8509b9b148e1b6debd (diff) | |
download | ydb-085a76cb8fd1fd01e9483d056938f022970cb4f0.tar.gz |
Restoring authorship annotation for <jacob@yandex-team.ru>. Commit 2 of 2.
-rw-r--r-- | library/cpp/on_disk/chunks/chunked_helpers.h | 2 | ||||
-rw-r--r-- | library/cpp/string_utils/levenshtein_diff/levenshtein_diff.h | 32 | ||||
-rw-r--r-- | util/generic/vector_ut.cpp | 2 | ||||
-rw-r--r-- | util/generic/ymath.cpp | 6 | ||||
-rw-r--r-- | util/generic/ymath.h | 6 | ||||
-rw-r--r-- | util/generic/ymath_ut.cpp | 24 |
6 files changed, 36 insertions, 36 deletions
diff --git a/library/cpp/on_disk/chunks/chunked_helpers.h b/library/cpp/on_disk/chunks/chunked_helpers.h index 927d79faa9..5fa96afdca 100644 --- a/library/cpp/on_disk/chunks/chunked_helpers.h +++ b/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 { diff --git a/library/cpp/string_utils/levenshtein_diff/levenshtein_diff.h b/library/cpp/string_utils/levenshtein_diff/levenshtein_diff.h index 1303fc7557..8a240bfed8 100644 --- a/library/cpp/string_utils/levenshtein_diff/levenshtein_diff.h +++ b/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); } - } -} + } +} diff --git a/util/generic/vector_ut.cpp b/util/generic/vector_ut.cpp index 4f13bbae51..0f6b4037a0 100644 --- a/util/generic/vector_ut.cpp +++ b/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. */ diff --git a/util/generic/ymath.cpp b/util/generic/ymath.cpp index 18a9f61a23..31270728f4 100644 --- a/util/generic/ymath.cpp +++ b/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; -} +} diff --git a/util/generic/ymath.h b/util/generic/ymath.h index edf992caa0..9ff9ae2abe 100644 --- a/util/generic/ymath.h +++ b/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 diff --git a/util/generic/ymath_ut.cpp b/util/generic/ymath_ut.cpp index f7ff2298ba..29190b55eb 100644 --- a/util/generic/ymath_ut.cpp +++ b/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); |