def expand_semiglobal

bend-edit-distance@0.2.2.0 · src/Myers.bend:505

import bend-edit-distance@0.2.2.0/src/Myers.bend as Myers
import Base
import bend-edit-distance@0.2.2.0/EdlibTypes.bend as E

505def expand_semiglobal(updated: UpdatedBand, rest: List<&2, Peq>, +symbol: U32,
506                       mode: E.Mode, +maximum: Nat) -> Band:
507  match updated rest:
508    case UpdatedBand{entries, +score, Carry{+positive, +negative}, _} +profile <> tail:
509      +previous = U32.sub(U32.add(score, negative), positive)
510      +eq = peq_get(profile, symbol, U32.is_ne(U32.and(symbol, 1), 0))
511      expand_semiglobal.choose(entries, profile, tail, previous, eq, Carry{positive, negative}, mode, maximum,
512        Bool.and(Nat.is_le(U32.to_nat(previous), maximum),
513          Bool.or(U32.is_ne(U32.and(eq, 1), 0), U32.is_ne(negative, 0))))
514    case UpdatedBand{entries, _, _, _} Nil{}:
515      reduce_semiglobal(trim_semiglobal(entries, Nil{}, mode, 0n, maximum))

Uses (20)

Used by (1)