Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/hll/aux_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
//! Stores slot-value pairs for values that don't fit in the 4-bit main array.
//! Uses open addressing with stride-based probing for collision resolution.

use crate::hll::{RESIZE_DENOM, RESIZE_NUMER, get_slot, get_value, pack_coupon};
use crate::hll::{RESIZE_DENOM, RESIZE_NUMERATOR, get_slot, get_value, pack_coupon};

const ENTRY_EMPTY: u32 = 0;

Expand Down Expand Up @@ -175,7 +175,7 @@ impl AuxMap {
/// Check if we need to grow the hash table (75% load factor)
fn check_grow(&mut self) {
let size = 1 << self.lg_size;
if (RESIZE_DENOM * self.count) > (RESIZE_NUMER * size) {
if (RESIZE_DENOM * self.count) > (RESIZE_NUMERATOR * size) {
self.grow();
}
}
Expand Down
16 changes: 8 additions & 8 deletions src/hll/cubic_interpolation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,20 +122,20 @@ fn cubic_interpolate(
y3: f64,
x: f64,
) -> f64 {
let l0_numer = (x - x1) * (x - x2) * (x - x3);
let l1_numer = (x - x0) * (x - x2) * (x - x3);
let l2_numer = (x - x0) * (x - x1) * (x - x3);
let l3_numer = (x - x0) * (x - x1) * (x - x2);
let l0_numerator = (x - x1) * (x - x2) * (x - x3);
let l1_numerator = (x - x0) * (x - x2) * (x - x3);
let l2_numerator = (x - x0) * (x - x1) * (x - x3);
let l3_numerator = (x - x0) * (x - x1) * (x - x2);

let l0_denom = (x0 - x1) * (x0 - x2) * (x0 - x3);
let l1_denom = (x1 - x0) * (x1 - x2) * (x1 - x3);
let l2_denom = (x2 - x0) * (x2 - x1) * (x2 - x3);
let l3_denom = (x3 - x0) * (x3 - x1) * (x3 - x2);

let term0 = y0 * l0_numer / l0_denom;
let term1 = y1 * l1_numer / l1_denom;
let term2 = y2 * l2_numer / l2_denom;
let term3 = y3 * l3_numer / l3_denom;
let term0 = y0 * l0_numerator / l0_denom;
let term1 = y1 * l1_numerator / l1_denom;
let term2 = y2 * l2_numerator / l2_denom;
let term3 = y3 * l3_numerator / l3_denom;

term0 + term1 + term2 + term3
}
Expand Down
2 changes: 1 addition & 1 deletion src/hll/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const KEY_MASK_26: u32 = (1 << KEY_BITS_26) - 1;
const COUPON_RSE_FACTOR: f64 = 0.409; // At transition point not the asymptote
const COUPON_RSE: f64 = COUPON_RSE_FACTOR / (1 << 13) as f64;

const RESIZE_NUMER: u32 = 3; // Resize at 3/4 = 75% load factor
const RESIZE_NUMERATOR: u32 = 3; // Resize at 3/4 = 75% load factor
const RESIZE_DENOM: u32 = 4;

/// Extract slot number (low 26 bits) from coupon
Expand Down
4 changes: 2 additions & 2 deletions src/hll/sketch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use crate::hll::container::Container;
use crate::hll::hash_set::HashSet;
use crate::hll::list::List;
use crate::hll::serialization::*;
use crate::hll::{HllType, NumStdDev, RESIZE_DENOM, RESIZE_NUMER, coupon};
use crate::hll::{HllType, NumStdDev, RESIZE_DENOM, RESIZE_NUMERATOR, coupon};

/// Current sketch mode
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
Expand Down Expand Up @@ -120,7 +120,7 @@ impl HllSketch {
Mode::Set { set, hll_type } => {
set.update(coupon);
let should_promote = RESIZE_DENOM as usize * set.container().len()
> RESIZE_NUMER as usize * set.container().capacity();
> RESIZE_NUMERATOR as usize * set.container().capacity();
if should_promote {
self.mode = if set.container().lg_size() == self.lg_config_k as usize - 3 {
promote_container_to_array(set.container(), *hll_type, self.lg_config_k)
Expand Down
2 changes: 1 addition & 1 deletion typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# under the License.

[default.extend-words]
"NUMER" = "NUMER"
"PREINTS" = "PREINTS"

[files]
extend-exclude = []