Skip to content

@saehrimnir/druidjs / quickselectByAxis

Function: quickselectByAxis()

ts
function quickselectByAxis<T>(
   arr: T[], 
   randomizer: Randomizer, 
   k: number, 
   axis: number, 
   start_left?: number, 
   start_right?: number): T;

Defined in: util/quickselect.js:87

QuickSelect by specific dimension axis for spatial trees (KDTree, BallTree). Partitions array in-place along arr[i].element[axis].

Type Parameters

Type ParameterDescription
T extends { element: number[] | Float64Array<ArrayBufferLike>; }

Parameters

ParameterTypeDefault valueDescription
arrT[]undefinedArray to partition in-place
randomizerRandomizerundefinedSeeded source of randomness for pivot selection.
knumberundefinedTarget 0-indexed rank to select
axisnumberundefinedDimension coordinate index
start_left?number0Start index (inclusive)
start_right?number...End index (inclusive)

Returns

T

The k-th element along specified axis