Class CLALibSort
java.lang.Object
org.apache.sysds.runtime.compress.lib.CLALibSort
-
Method Summary
Modifier and TypeMethodDescriptionstatic MatrixBlocksort(CompressedMatrixBlock mb, SortIndex fn) Sort (order) a compressed matrix in place of theorderbuilt-in, while keeping the result compressed.static MatrixBlocksort(CompressedMatrixBlock mb, MatrixValue weights, MatrixBlock result, int k) Compute the sorted value/weight table used by the quantile/median/IQM operations (thesort/ qsort lop), exploiting compression to sort the few distinct values instead of all rows.
-
Method Details
-
sort
Sort (order) a compressed matrix in place of theorderbuilt-in, while keeping the result compressed. The compressed fast-path only supports the case the user can benefit from: a single column held in a single column group, sorted ascending and returning the sorted values (not the index permutation). For everything else (multiple columns, multiple column groups, descending order, index return, or a column-group encoding without a sort implementation) this returnsnullso the caller can fall back to a decompressed reorg.- Parameters:
mb- the compressed matrix to sortfn- the sort specification carried by the reorg operator- Returns:
- the sorted compressed matrix, or
nullif the compressed fast-path does not apply
-
sort
public static MatrixBlock sort(CompressedMatrixBlock mb, MatrixValue weights, MatrixBlock result, int k) Compute the sorted value/weight table used by the quantile/median/IQM operations (thesort/ qsort lop), exploiting compression to sort the few distinct values instead of all rows. The compressed fast-path applies to an unweighted sort of a single column held in a single column group. The produced table is bit-for-bit identical toMatrixBlock.sortOperations(MatrixValue, MatrixBlock, int): a(1 + nnz) x 2matrix holding one row per non-zero value (weight 1) plus a single collapsed row for the zeros (weight = number of zeros), sorted ascending by value. For every other case (weights present, multiple columns or groups, or an encoding without a sort implementation) it falls back to a decompressed sort.- Parameters:
mb- the compressed matrix to sortweights- optional per-row weights, ornullresult- the result matrix (reused by the fallback)k- the parallelization degree- Returns:
- the sorted value/weight table
-