import { Matrix, Vector, Coordinates, Vectors, DistanceMetric } from './type-declarations'; /** * Asserts a condition by throwing an Error. * * @export * @param {boolean} [condition=false] Condition to assert. * @param {string} [message='Assertion error.'] Message to output. * @throws {Error} */ export declare function assert(condition?: boolean, message?: string): void; /** * Creates new two-dimensional array and fills it with the value given. * * @param {number} dimension1 The first dimension of the coordinates (number of rows). * @param {number} dimension2 The second dimension of the coordinates (number of columns). * @param {number} [fill=0] A value to fill the coordinates with. * @return {Coordinates} A two-dimensional filled with the value given. * @todo Might be slow since used Array.map. Probably needs performance revision. */ export declare function initCoordinates(dimension1: number, dimension2: number, fill?: number): Coordinates; /** * Transpose matrix. * * @export * @param {Matrix} matrix The matrix to be transposed. * @return {Matrix} Transposed matrix. * @todo Might be slow since used Array.map. Probably needs performance revision. */ export declare function transposeMatrix(matrix: Matrix): Matrix; /** * Adds two vectors with the second one to be multiplied by the given ratio. * * @export * @param {Vector} p The first vector to add. * @param {Vector} q The second vector to add. * @param {number} [multiplier=1] A multiplier to be used before the second vector is added. * @return {Vector} New vector contained the result of operation p+multiplier*q. */ export declare function vectorAdd(p: Vector, q: Vector, multiplier?: number): Vector; export declare function vectorLength(v: Vector): number; export declare function vectorDotProduct(v1: Vector, v2: Vector): number; /** * Creates a matrix filled with random floating point values. * * @export * @param {number} dimension1 The first dimension of the matrix. * @param {number} dimension2 The second dimension of the matrix. * @param {number} [scale=1.] Max value given by random generator. * @return {Matrix} A new matrix filled with random floating point values. */ export declare function fillRandomMatrix(dimension1: number, dimension2: number, scale?: number): Matrix; /** * Calculates Euclidean distance between two vectors. * * @export * @param {Vector} p The first vector. * @param {Vector} q The second vector. * @return {number} Euclidean distance between the given vectors. */ export declare function calculateEuclideanDistance(p: Vector, q: Vector): number; /** * Creates a distance matrix using a custom distance function. * * @export * @param {Vectors} data Input vectors to calculate distances. * @param {DistanceMetric} distance Custom distance function. * @return {Matrix} Calculated custom distance matrix. */ export declare function calcDistanceMatrix(data: Vectors, distance: DistanceMetric): Matrix; /** * Creates a distance matrix using a custom distance function. * * @export * @param {Vectors} data Input vectors to calculate distances. * @param {DistanceMetric} distance Custom distance function. * @return {Matrix} Calculated custom distance matrix. */ export declare function calcNormalizedDistanceMatrix(data: Vectors, distance: DistanceMetric): Matrix; /** Generates array from a range [begin; end] or [begin; end) if endExclusive. **/ export declare function genRange(begin: number, end: number, endExclusive?: boolean): Int32Array; /** * Returns order of values as if they are sorted. * * @export * @param {any[]} values Input array. * @param {boolean} [reverse=false] Whether to return reversed order. * @return {number[]} The order computed. */ export declare function argSort(values: any[], reverse?: boolean): number[]; /** * Returns the indexes of the most diverse objects according to the dist function * @param {number} length total number of objects * @param {number} n number of diverse elements to find * @param {(i1: number, i2: number) => number} dist a function which calculates distance between * two objects using their indexes * @returns {number[]} The indexes of the most diverse objects */ export declare function getDiverseSubset(length: number, n: number, dist: (i1: number, i2: number) => number): number[]; /** * Returns normalized vector. * * @export * @param {Vector} data numerical array */ export declare function normalize(data: Vector): Vector; /** * Finds set difference between two lists. * @param {any[]} a The first list. * @param {any[]} b The second list. * @return {any[]} */ export declare function setDifference(a: any[], b: any[]): any[]; //# sourceMappingURL=vector-operations.d.ts.map