def band_step.updated

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

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

325def band_step.updated(updated: UpdatedBand, rest: List<&2, Peq>, +first: Nat,
326                      symbol: U32, +length: Nat, +target_length: Nat,
327                      +column: Nat, maximum: Nat, padding: Nat) -> BandStep:
328  match updated:
329    case UpdatedBand{entries, +score, carry, +bottom}:
330      # Completing the suffix by edits bounds the optimum. Padding can lower
331      # the stored bottom score, so add it back before tightening k.
332      +k = Nat.min(maximum, Nat.add(U32.to_nat(score),
333        Nat.add(Nat.max(Nat.sub(target_length, column), Nat.sub(length, bottom)),
334          Bool.pick(Nat, Nat.is_ge(bottom, length), padding, 0n))))
335      work = Nat.sub(Nat.div(bottom, 32n), first)
336      expand_band(entries, rest, score, carry, symbol, first, k, length, target_length,
337        column, work, Nat.is_le(Nat.add(Nat.add(bottom, U32.to_nat(score)), target_length),
338          Nat.add(Nat.add(Nat.add(k, length), column), 62n)))

Uses (16)

Used by (1)