You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by GitBox <gi...@apache.org> on 2020/02/17 21:48:37 UTC

[GitHub] [incubator-datasketches-cpp] AlexanderSaydakov commented on a change in pull request #87: Varopt Sampling

AlexanderSaydakov commented on a change in pull request #87: Varopt Sampling
URL: https://github.com/apache/incubator-datasketches-cpp/pull/87#discussion_r380376258
 
 

 ##########
 File path: sampling/include/var_opt_sketch.hpp
 ##########
 @@ -0,0 +1,249 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef _VAR_OPT_SKETCH_HPP_
+#define _VAR_OPT_SKETCH_HPP_
+
+#include "serde.hpp"
+
+#include <iterator>
+#include <vector>
+
+namespace datasketches {
+
+template<typename A> using AllocU8 = typename std::allocator_traits<A>::template rebind_alloc<uint8_t>;
+
+/**
+ * author Kevin Lang 
+ * author Jon Malkin
+ */
+
+/**
+ * A struct to hold the result of subset sum queries
+ */
+struct subset_summary {
+  double lower_bound;
+  double estimate;
+  double upper_bound;
+  double total_sketch_weight;
+};
+
+enum resize_factor { X1 = 0, X2, X4, X8 };
+
+template <typename T, typename S, typename A> class var_opt_union; // forward declaration
+
+template <typename T, typename S = serde<T>, typename A = std::allocator<T>>
+class var_opt_sketch {
+
+  public:
+    static const resize_factor DEFAULT_RESIZE_FACTOR = X8;
+    static const uint32_t MAX_K = ((uint32_t) 1 << 31) - 2;
+
+    var_opt_sketch(uint32_t k, resize_factor rf = DEFAULT_RESIZE_FACTOR);
 
 Review comment:
   I think this should be marked as explicit to avoid surprises

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org