jmalkin commented on code in PR #324:
URL: https://github.com/apache/datasketches-cpp/pull/324#discussion_r1064868895


##########
sampling/include/var_opt_sketch_impl.hpp:
##########
@@ -752,18 +752,16 @@ string<A> var_opt_sketch<T, A>::items_to_string(bool 
print_gap) const {
   std::ostringstream os;
   os << "### Sketch Items" << std::endl;
   const uint32_t array_length = (n_ < k_ ? n_ : k_ + 1);
-  for (uint32_t i = 0, display_idx = 0; i < array_length; ++i) {

Review Comment:
   Both
   
   Not sure if you found this using this sketch or when compiling the library. 
The way it works, which isn't a necessary thing but helps simplify the algo, is 
that there's an array of size k+1, with a gap of size 1 between two portions of 
the sampling array that get slightly different treatment (heavy items vs items 
treated more like uniform reservoir sample). `to_string()` methods are largely 
just for debugging so providing an option to more easily track where that gap 
lives is useful -- but it changes indexing for items after the gap.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to