Sorting

In oneDAL sorting is an algorithm to sort the observations by each feature (column) in the ascending order.

The result of the sorting algorithm applied to the matrix \(X = (x_{ij})_{n \times p}\) is the matrix \(Y = (y_{ij})_{n \times p}\) where the \(j\)-th column \((Y)_j = ( y_{ij} )\), \(i = 1, \ldots, n\), is the column \((X)_j = ( x_{ij} )\), \(i = 1, \ldots, n\), sorted in the ascending order.

Batch Processing

Algorithm Input

The sorting algorithm accepts the input described below. Pass the Input ID as a parameter to the methods that provide input for your algorithm. For more details, see Algorithms.

Algorithm Input for Sorting (Batch Processing)

Input ID

Input

data

Pointer to the \(n \times p\) numeric table that contains the input data set.

This table can be an object of any class derived from NumericTable except PackedSymmetricMatrix, PackedTriangularMatrix, and CSRNumericTable.

Algorithm Parameters

The sorting algorithm has the following parameters:

Algorithm Parameters for Sorting (Batch Processing)

Parameter

Default Value

Description

algorithmFPType

float

The floating-point type that the algorithm uses for intermediate computations. Can be float or double.

method

defaultDense

The radix method for sorting a data set, the only method supported by the algorithm.

Algorithm Output

The sorting algorithm function calculates the result described below. Pass the Result ID as a parameter to the methods that access the results of your algorithm. For more details, see Algorithms.

Algorithm Output for Sorting (Batch Processing)

Result ID

Result

sortedData

Pointer to the \(n \times p\) numeric table that stores the results of sorting.

Note

If the number of feature vectors is greater than or equal to \(2^{31}\), the library uses the quick sort method instead of radix sort.

Examples