Skip to main content

gestalt_edge_with_ms

Function gestalt_edge_with_ms 

Source
pub fn gestalt_edge_with_ms(
    a: &[char],
    b: &[char],
    sam_b: &Sam,
    fstate: &[u32],
    fmatch: &[u32],
    threshold: f64,
) -> Option<f64>
Expand description

Stage-4b helper: same recursion + early-exit as gestalt_edge, but operates on a caller-provided (fstate, fmatch) instead of running matching_stats_into inline.

The GPU dispatch produces these arrays in batch for many pairs at once; the CPU side then does the small stack walk per pair via this entry point. Keeping the recursion on the CPU is the right split because longest_in’s suffix-link walk has data-dependent depth (poor GPU fit), while matching_stats_into is a wide independent per-pair walk (great GPU fit).

fstate / fmatch must be a.len() long and have been filled for THIS exact (a, sam_b) pair — passing arrays computed for a different a or b is a logic bug, no runtime check.