/** * Compute a recurrence (self-similarity) matrix from a feature matrix. * * @param {Array|Float32Array|Float64Array} data - features, shape (d, n) as a * 2D matrix, or flat with explicit `options.nFeatures`/`options.nFrames`. * @param {Object} [options] * @param {number|null} [options.k=null] - neighbors per sample * (default 2*ceil(sqrt(t - 2*width + 1))). * @param {number} [options.width=1] - |i - j| < width links are removed. * @param {string} [options.metric='euclidean'] * @param {boolean} [options.sym=false] - keep only MUTUAL nearest neighbors. * @param {string} [options.mode='connectivity'] - 'connectivity' | 'distance' | 'affinity'. * @param {number|string|null} [options.bandwidth=null] - affinity bandwidth * (positive scalar or 'med_k_scalar'; other estimators throw). * @param {boolean} [options.self=false] - populate the main diagonal. * @param {boolean} [options.full=false] - full distance/affinity matrix. * @param {number|null} [options.nFeatures], [options.nFrames] - shape for flat input. * @returns {Float64Array[]} rec - (t, t) matrix, rows are Float64Array. * rec[i][j] non-zero means data[:, i] is a k-NN of data[:, j] * (the transposed-graph orientation). */ export function recurrenceMatrix(data: any[] | Float32Array | Float64Array, options?: { k?: number | null; width?: number; metric?: string; sym?: boolean; mode?: string; bandwidth?: number | string | null; self?: boolean; full?: boolean; nFeatures?: number | null; }): Float64Array[]; /** * Cross-similarity between a comparison sequence and a reference sequence. * * @param {Array|Float32Array|Float64Array} data - comparison features (d, n). * @param {Array|Float32Array|Float64Array} dataRef - reference features (d, n_ref). * @param {Object} [options] - { k, metric, mode, bandwidth, full, * nFeatures, nFrames, nFramesRef } (flat inputs need explicit shapes). * @returns {Float64Array[]} xsim - (n_ref, n): xsim[i][j] non-zero when * dataRef[:, i] is a k-NN of data[:, j]. */ export function crossSimilarity(data: any[] | Float32Array | Float64Array, dataRef: any[] | Float32Array | Float64Array, options?: any): Float64Array[]; /** * Convert a recurrence matrix into a lag matrix: * `lag[i][j] = rec[(i + j) mod H][j]` (a shear with factor=-1, axis=1). * * @param {Array|Float32Array|Float64Array>} rec - square (n, n). * @param {Object} [options] * @param {boolean} [options.pad=true] - pad with n zero rows before shearing * (output (2n, n)); pad=false assumes indefinite repetition (output (n, n)). * @returns {Float64Array[]} lag matrix. */ export function recurrenceToLag(rec: Array | Float32Array | Float64Array>, { pad }?: { pad?: boolean; }): Float64Array[]; /** * Convert a lag matrix back into a recurrence matrix: * shear with factor=+1 (`out[i][j] = lag[(i - j) mod H][j]`), then keep the * first t rows (t = number of columns). * * @param {Array|Float32Array|Float64Array>} lag - (t, t) or (2t, t). * @returns {Float64Array[]} rec - (t, t). */ export function lagToRecurrence(lag: Array | Float32Array | Float64Array>): Float64Array[]; /** * Bottom-up temporal segmentation: partition frames into k contiguous * segments by temporally-constrained agglomerative clustering. * Mirrors sklearn's AgglomerativeClustering with Ward linkage on a chain * connectivity graph: * repeatedly merge the ADJACENT pair of segments with minimum Ward increment * d²(A, B) = (nA·nB / (nA + nB)) · ||centroid(A) − centroid(B)||² * until k segments remain. * * @param {Array|Float32Array|Float64Array} data - features, shape (d, n) 2D, * or flat with explicit `options.nFeatures`/`options.nFrames`. * @param {number} k - number of segments (1 <= k <= n_frames). * @param {Object} [options] - { nFeatures, nFrames } for flat input. * @returns {Uint32Array} left-boundary frame indices (always starts with 0). */ export function agglomerative(data: any[] | Float32Array | Float64Array, k: number, options?: any): Uint32Array; export { laplacianSegmentation } from "./laplacian-segmentation.js";