← Gallery Segment recurrence — A-B-A structure

Segment recurrence — A-B-A structure

segment — recurrence heatmap + exact Ward boundaries

When music repeats itself, a recurrence plot shows the repeat as bright blocks away from the diagonal — here a planted A-B-A pattern lights up exactly where it should, and the section boundaries come back exact. The input is a 60-frame, 12-dim feature matrix planted as A(20)-B(20)-A(20) with small deterministic jitter. recurrenceMatrix(mode 'affinity', sym) must light the A↔A repeat as bright off-diagonal blocks, keep the |i−j|<width band exactly zero and the matrix exactly symmetric; the lag shear must round-trip bit-exactly; agglomerative(data, 3) must return exactly [0, 20, 40]. Same asserts as examples/node/segment-recurrence.mjs (node-verified).

recurrence (affinity, sym)
lag matrix (2t × t shear)