/** * @license * Copyright 2025 Steven Roussey * SPDX-License-Identifier: Apache-2.0 */ import type { TypedArray } from "./TypedArray"; /** * Calculates the magnitude (L2 norm) of a vector */ export declare function magnitude(arr: TypedArray | number[]): number; /** * Calculates the inner (dot) product of two vectors */ export declare function inner(arr1: TypedArray, arr2: TypedArray): number; /** * Normalizes a vector to unit length (L2 normalization) * * @param vector - The vector to normalize * @param throwOnZero - If true, throws an error for zero vectors. If false, returns the original vector. * @param float32 - If true, always returns a Float32Array regardless of input type. When false (default), * the return type matches the input type. Note: for integer typed arrays (Int8Array, Uint8Array, * Int16Array, Uint16Array), normalized float values are truncated to integers when stored back in * the original type — use `float32=true` to preserve precision for integer inputs. * @returns Normalized vector. Float arrays preserve their type. Integer arrays preserve their type * (with truncation). Pass `float32=true` to always get a Float32Array. */ export declare function normalize(vector: TypedArray, throwOnZero?: boolean, float32?: boolean): TypedArray; /** * Normalizes an array of numbers to unit length (L2 normalization) * * @param values - The array of numbers to normalize * @param throwOnZero - If true, throws an error for zero vectors. If false, returns the original array. * @returns Normalized array of numbers */ export declare function normalizeNumberArray(values: number[], throwOnZero?: boolean): number[]; //# sourceMappingURL=VectorUtils.d.ts.map