20 #ifndef THETA_HELPERS_HPP_
21 #define THETA_HELPERS_HPP_
26 #include "theta_constants.hpp"
31 static void check_value(T actual, T expected,
const char* description) {
32 if (actual != expected) {
33 throw std::invalid_argument(std::string(description) +
" mismatch: expected " + std::to_string(expected) +
", actual " + std::to_string(actual));
40 static void check_serial_version(uint8_t actual, uint8_t expected) {
41 check_value(actual, expected,
"serial version");
43 static void check_sketch_family(uint8_t actual, uint8_t expected) {
44 check_value(actual, expected,
"sketch family");
46 static void check_sketch_type(uint8_t actual, uint8_t expected) {
47 check_value(actual, expected,
"sketch type");
49 static void check_seed_hash(uint16_t actual, uint16_t expected) {
50 check_value(actual, expected,
"seed hash");
55 class theta_build_helper{
59 static uint64_t starting_theta_from_p(
float p) {
64 static uint8_t starting_sub_multiple(uint8_t lg_tgt, uint8_t lg_min, uint8_t lg_rf) {
65 return (lg_tgt <= lg_min) ? lg_min : (lg_rf == 0) ? lg_tgt : ((lg_tgt - lg_min) % lg_rf) + lg_min;
const uint64_t MAX_THETA
max theta - signed max for compatibility with Java
Definition: theta_constants.hpp:36
DataSketches namespace.
Definition: binomial_bounds.hpp:38