Skip to content

Latest commit

 

History

History
86 lines (59 loc) · 1.82 KB

File metadata and controls

86 lines (59 loc) · 1.82 KB

API: Common Structures

Status: Shared

Purpose

Shared matrix/vector storage and utility structures used by sketch implementations.

Type/Struct

  • Vector2D<T>
  • MatrixStorage / FastPathHasher
  • MatrixHashType
  • Nitro

Constructors

// Vector2D
fn init(rows: usize, cols: usize) -> Self
fn from_fn<F>(rows: usize, cols: usize, f: F) -> Self

// Nitro
fn init_nitro(rate: f64) -> Self

Insert/Update

// Vector2D
fn update_one_counter<F, V>(&mut self, row: usize, col: usize, op: F, value: V)
fn fast_insert<F, V>(&mut self, op: F, value: V, hashed_val: &MatrixHashType)
fn update_by_row<F, V>(&mut self, row: usize, hashed: u128, op: F, value: V)

// Nitro utility
fn draw_geometric(&mut self)
fn reduce_to_skip(&mut self)
fn reduce_to_skip_by_count(&mut self, c: usize)

Query

// Vector2D
fn rows(&self) -> usize
fn cols(&self) -> usize
fn get(&self, row: usize, col: usize) -> Option<&T>
fn row_slice(&self, row: usize) -> &[T]
fn fast_query_min<F, R>(&self, hashed_val: &MatrixHashType, op: F) -> R
fn fast_query_median<F>(&self, hashed_val: &MatrixHashType, op: F) -> f64
fn fast_query_max<F, R>(&self, hashed_val: &MatrixHashType, op: F) -> R

// Utility
fn compute_median_inline_f64(values: &mut [f64]) -> f64

Merge

Not applicable at this utility-layer boundary.

Serialization

Not applicable at this utility-layer boundary.

Examples

use asap_sketchlib::Vector2D;

let matrix = Vector2D::<i32>::init(3, 16);
assert_eq!(matrix.rows(), 3);
assert_eq!(matrix.cols(), 16);

Caveats

See Also

Status

Canonical shared structures layer.