/** * Recurrence quantification analysis (RQA). * * Implements the methods of Serrà, Serra & Andrzejak (2009): dynamic * programming over a self- or cross-similarity matrix, maximizing alignment * value, with optional chess-knight moves and gap penalties. * * Unlike DTW, alignment paths here are MAXIMIZED, so the input must measure * similarity, not distance. * * Validated against committed reference fixtures * (exact path agreement + score max). * * @param {Array|Float32Array|Float64Array>} sim * Similarity matrix, shape (N, M), non-negative, N ≥ 2 and M ≥ 2. * @param {Object} [options] * @param {number} [options.gapOnset=1] - penalty for introducing a gap (must be ≥ 0) * @param {number} [options.gapExtend=1] - penalty for extending a gap (must be ≥ 0) * @param {boolean} [options.knightMoves=true] - allow (−1,−2)/(−2,−1) moves * @param {boolean} [options.backtrack=true] - also return the optimal path * @returns {{score: Float64Array[], path?: number[][]}} * `score[n][m]` is the cumulative value of the best alignment ending at * (n, m). When `backtrack` is true, `path` is an array of [n, m] pairs * (possibly empty when there is no positive alignment at all). */ export function rqa(sim: Array | Float32Array | Float64Array>, { gapOnset, gapExtend, knightMoves, backtrack }?: { gapOnset?: number; gapExtend?: number; knightMoves?: boolean; backtrack?: boolean; }): { score: Float64Array[]; path?: number[][]; };