/** * Matrix Utility Functions for Machine Learning * * Provides numerically stable operations for ML algorithms */ /** * Log-Sum-Exp trick for numerical stability * * Computes log(sum(exp(logValues))) in a numerically stable way * * @param logValues - Array of log values * @returns log(sum(exp(logValues))) * * @example * ```typescript * const result = logSumExp([-1000, -999, -1001]); // ≈ -998.59 * ``` */ export declare function logSumExp(logValues: number[]): number; /** * Normalize rows of a matrix (each row sums to 1) * * @param matrix - Input matrix * @returns Matrix with normalized rows * * @example * ```typescript * const matrix = [[1, 2, 3], [4, 5, 6]]; * const normalized = normalizeRows(matrix); * // [[0.167, 0.333, 0.5], [0.267, 0.333, 0.4]] * ``` */ export declare function normalizeRows(matrix: number[][]): number[][]; /** * Normalize an array (values sum to 1) * * @param arr - Input array * @returns Normalized array * * @example * ```typescript * const arr = [1, 2, 3, 4]; * const normalized = normalizeArray(arr); // [0.1, 0.2, 0.3, 0.4] * ``` */ export declare function normalizeArray(arr: number[]): number[]; /** * Add small noise to break symmetry * * @param matrix - Input matrix * @param noiseLevel - Level of noise (default: 1e-4) * @returns Matrix with added noise */ export declare function addNoise(matrix: number[][], noiseLevel?: number): number[][];