RadixSort

Lore. RadixSort

A class wrapping a radix sort for floats.

Constructor

new RadixSort()

Source:

Creates an instance of RadixSort.

Methods

initHistograms(arr, maxOffset, lastMask)

Source:

Initialize the histogram used by the algorithm.

Parameters:
Name Type Description
arr Float32Array

The array to be sorted.

maxOffset Number

The maximum offset.

lastMask Number

The last max, based on the msb (most significant bit) mask.

lsbPass(arr, aux)

Source:

The lsb (least significant bit) pass of the algorithm.

Parameters:
Name Type Description
arr Float32Array

The array.

aux Float32Array

An auxilliary array.

msbPass(arr, aux)

Source:

The msb (most significant bit) pass of the algorithm.

Parameters:
Name Type Description
arr Float32Array

The array.

aux Float32Array

An auxilliary array.

pass(arr, aux)

Source:

The main pass of the algorithm.

Parameters:
Name Type Description
arr Float32Array

The array.

aux Float32Array

An auxilliary array.

sort(arr, copyArrayopt) → {Object}

Source:

Sorts a 32-bit float array using radix sort.

Parameters:
Name Type Attributes Default Description
arr Float32Array

The array to be sorted.

copyArray Boolean <optional>
false

A boolean indicating whether to perform the sorting directly on the array or copy it.

Returns:

The result in the form { array: sortedArray, indices: sortedIndices }.

Type
Object