stojkomilos commented on PR #515: URL: https://github.com/apache/datasketches-cpp/pull/515#issuecomment-5380438351
> Two problems > > 1. As you can see, Changing API need discussion first: https://github.com/apache/datasketches-cpp/blob/master/CONTRIBUTING.md#getting-your-proposed-changes-accepted > 2. It is technically wrong. > > ``` > TEST_CASE("theta sketch: get_result silently destroys exact mode", "[theta_sketch]") { > const uint32_t k = 1 << theta_constants::DEFAULT_LG_K; // 4096 > > const int n = 5000; > update_theta_sketch sketch = update_theta_sketch::builder().build(); > for (int i = 0; i < n; i++) sketch.update(i); > > REQUIRE_FALSE(sketch.is_estimation_mode()); > REQUIRE(sketch.get_num_retained() == n); > REQUIRE(sketch.get_num_retained() > k); > REQUIRE(sketch.get_estimate() == Approx(5000.0)); > REQUIRE(sketch.get_lower_bound(2) == sketch.get_upper_bound(2)); > > // --- control: compact() preserves exactness --- > compact_theta_sketch exact = sketch.compact(); > REQUIRE_FALSE(exact.is_estimation_mode()); > REQUIRE(exact.get_num_retained() == n); > REQUIRE(exact.get_lower_bound(2) == exact.get_upper_bound(2)); > > // --- branch: get_result() trades the exact answer for an estimate --- > compact_theta_sketch result = sketch.get_result(); > REQUIRE(result.is_estimation_mode()); // was exact, now estimating > REQUIRE(result.get_num_retained() == k); > REQUIRE(result.get_theta64() < theta_constants::MAX_THETA); > REQUIRE(result.get_estimate() == Approx(5000.0).epsilon(0.05)); > REQUIRE(result.get_lower_bound(2) < result.get_upper_bound(2)); > REQUIRE(result.get_lower_bound(2) < n); > REQUIRE(result.get_upper_bound(2) > n); > } > ``` Thank you for the response. I will send a mail for the API discussion. As for your **2.** point, I don't understand your point? It is is estimate mode yes, that is intentional, that is the purpose (the purpose is to have 2^lg_k=nominal_size entires used, just like .get_result() for theta union will do, so it has the same behaviour for .get_result()) -- 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]
