MCPcopy Create free account
hub / github.com/ColmapView/Colmapview.github.io / median

Function median

src/utils/mathUtils.ts:26–30  ·  view source on GitHub ↗
(arr: number[])

Source from the content-addressed store, hash-verified

24 * @returns The median value, or 0 if array is empty
25 */
26export function median(arr: number[]): number {
27 if (arr.length === 0) return 0;
28 const sorted = [...arr].sort((a, b) => a - b);
29 return percentile(sorted, 50);
30}

Callers 3

computeCenterAtOriginFunction · 0.90
mathUtils.test.tsFile · 0.90

Calls 1

percentileFunction · 0.70

Tested by

no test coverage detected