This is an automated email from the ASF dual-hosted git repository.
alsay pushed a commit to branch cleanup-before-5.0.0
in repository https://gitbox.apache.org/repos/asf/datasketches-cpp.git
The following commit(s) were added to refs/heads/cleanup-before-5.0.0 by this
push:
new c5a8067 more cleanup
c5a8067 is described below
commit c5a80670a63def65a1c7766b8cfd72a0c4a83a3d
Author: AlexanderSaydakov <[email protected]>
AuthorDate: Tue Oct 31 17:38:23 2023 -0700
more cleanup
---
cpc/include/cpc_common.hpp | 10 +++++++---
sampling/include/var_opt_union.hpp | 7 +++----
sampling/include/var_opt_union_impl.hpp | 8 ++++----
theta/include/theta_constants.hpp | 14 ++++++++++----
4 files changed, 24 insertions(+), 15 deletions(-)
diff --git a/cpc/include/cpc_common.hpp b/cpc/include/cpc_common.hpp
index fdf06b5..4b94975 100644
--- a/cpc/include/cpc_common.hpp
+++ b/cpc/include/cpc_common.hpp
@@ -26,10 +26,14 @@
namespace datasketches {
+/// CPC constants
namespace cpc_constants {
- const uint8_t MIN_LG_K = 4;
- const uint8_t MAX_LG_K = 26;
- const uint8_t DEFAULT_LG_K = 11;
+ /// min log2 of K
+ const uint8_t MIN_LG_K = 4;
+ /// max log2 of K
+ const uint8_t MAX_LG_K = 26;
+ /// default log2 of K
+ const uint8_t DEFAULT_LG_K = 11;
}
// forward declaration
diff --git a/sampling/include/var_opt_union.hpp
b/sampling/include/var_opt_union.hpp
index f91377e..0e4f76d 100644
--- a/sampling/include/var_opt_union.hpp
+++ b/sampling/include/var_opt_union.hpp
@@ -52,7 +52,6 @@ template<
class var_opt_union {
public:
- static const uint32_t MAX_K = ((uint32_t) 1 << 31) - 2;
explicit var_opt_union(uint32_t max_k, const A& allocator = A());
var_opt_union(const var_opt_union& other);
@@ -152,9 +151,9 @@ public:
string<A> to_string() const;
private:
- typedef typename std::allocator_traits<A>::template
rebind_alloc<var_opt_sketch<T, A>> AllocSketch;
- typedef typename std::allocator_traits<A>::template rebind_alloc<double>
AllocDouble;
- typedef typename std::allocator_traits<A>::template rebind_alloc<bool>
AllocBool;
+ using AllocSketch = typename std::allocator_traits<A>::template
rebind_alloc<var_opt_sketch<T, A>>;
+ using AllocDouble = typename std::allocator_traits<A>::template
rebind_alloc<double>;
+ using AllocBool = typename std::allocator_traits<A>::template
rebind_alloc<bool>;
static const uint8_t PREAMBLE_LONGS_EMPTY = 1;
static const uint8_t PREAMBLE_LONGS_NON_EMPTY = 4;
diff --git a/sampling/include/var_opt_union_impl.hpp
b/sampling/include/var_opt_union_impl.hpp
index ebd6f68..1d25224 100644
--- a/sampling/include/var_opt_union_impl.hpp
+++ b/sampling/include/var_opt_union_impl.hpp
@@ -146,7 +146,7 @@ var_opt_union<T, A> var_opt_union<T,
A>::deserialize(std::istream& is, const Ser
check_preamble_longs(preamble_longs, flags);
check_family_and_serialization_version(family_id, serial_version);
- if (max_k == 0 || max_k > MAX_K) {
+ if (max_k == 0 || max_k > var_opt_constants::MAX_K) {
throw std::invalid_argument("k must be at least 1 and less than 2^31 - 1");
}
@@ -190,7 +190,7 @@ var_opt_union<T, A> var_opt_union<T, A>::deserialize(const
void* bytes, size_t s
check_preamble_longs(preamble_longs, flags);
check_family_and_serialization_version(family_id, serial_version);
- if (max_k == 0 || max_k > MAX_K) {
+ if (max_k == 0 || max_k > var_opt_constants::MAX_K) {
throw std::invalid_argument("k must be at least 1 and less than 2^31 - 1");
}
@@ -448,7 +448,7 @@ var_opt_sketch<T, A> var_opt_union<T, A>::get_result()
const {
/**
* When there are no marked items in H, the gadget is mathematically
equivalent to a valid
- * varopt sketch. This method simply returns a copy (without perserving marks).
+ * varopt sketch. This method simply returns a copy (without preserving marks).
*
* @return A shallow copy of the gadget as valid varopt sketch
*/
@@ -549,7 +549,7 @@ void var_opt_union<T,
A>::mark_moving_gadget_coercer(var_opt_sketch<T, A>& sk) c
if (result_h + result_r != result_k) throw std::logic_error("H + R counts
must equal k");
if (std::abs(transferred_weight - outer_tau_numer_) > 1e-10) {
- throw std::logic_error("uexpected mismatch in transferred weight");
+ throw std::logic_error("unexpected mismatch in transferred weight");
}
const double result_r_weight = gadget_.total_wt_r_ + transferred_weight;
diff --git a/theta/include/theta_constants.hpp
b/theta/include/theta_constants.hpp
index e47457b..fc97e35 100644
--- a/theta/include/theta_constants.hpp
+++ b/theta/include/theta_constants.hpp
@@ -25,15 +25,21 @@
namespace datasketches {
+/// Theta constants
namespace theta_constants {
+ /// hash table resize factor
using resize_factor = datasketches::resize_factor;
- //enum resize_factor { X1, X2, X4, X8 };
- const uint64_t MAX_THETA = LLONG_MAX; // signed max for compatibility with
Java
+ /// default resize factor
+ const resize_factor DEFAULT_RESIZE_FACTOR = resize_factor::X8;
+
+ /// max theta - signed max for compatibility with Java
+ const uint64_t MAX_THETA = LLONG_MAX;
+ /// min log2 of K
const uint8_t MIN_LG_K = 5;
+ /// max log2 of K
const uint8_t MAX_LG_K = 26;
-
+ /// default log2 of K
const uint8_t DEFAULT_LG_K = 12;
- const resize_factor DEFAULT_RESIZE_FACTOR = resize_factor::X8;
}
} /* namespace datasketches */
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]