mod bitset

module bitset

Bitset representation for marker presence/absence.

Stores depth >= min_depth as a single bit per (marker, individual), enabling group counts via popcount(row & group_mask) instead of HashMap lookups. This gives 10-16x memory reduction and eliminates all hashing overhead in the hot path.

Structs and Unions

struct BitsetRow

A fixed-width bitset row representing one marker across N individuals. Internally stored as a Vec<u64> where bit i = individual i present.

Implementations

impl BitsetRow

Functions

fn clear(&mut self)

Clear all bits to zero (for reuse).

fn count_masked(&self, mask: &GroupMask) -> u32

Count bits set in self & mask (group count via popcount).

fn count_total(&self) -> u32

Total number of set bits (n_individuals present).

fn new(n_individuals: u16) -> Self

Create a new zeroed bitset for n_individuals.

fn set(&mut self, i: usize)

Set bit i (marking individual i as present).

struct GroupMask

Pre-computed bitmask for a group (e.g. all males or all females). Bit i is set if individual i belongs to this group.

Implementations

impl GroupMask

Functions

fn count(&self) -> u32

Number of set bits (total individuals in this group).

fn from_columns(column_groups: &[String], group_name: &str, n_individuals: u16) -> Self

Build a group mask from per-column group labels. column_groups[i] is the group name for individual at column index i. Only columns matching group_name get their bit set.