From 2a16ea5118dd9d347d3a28a0793007330c1f864f Mon Sep 17 00:00:00 2001 From: Yixuan Qiu Date: Fri, 26 Jul 2024 13:37:17 +0800 Subject: [PATCH] documentation fixes --- src/README.md | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/README.md b/src/README.md index 8030e90e..edbdc68e 100644 --- a/src/README.md +++ b/src/README.md @@ -2,8 +2,8 @@ C++ header file library for SIMD based 16-bit, 32-bit and 64-bit data type sorting algorithms on x86 processors. We currently have AVX-512 and AVX2 -(32-bit and 64-bit only) based implementation of quicksort, quickselect & -partialsort and AVX-512 implementations of argsort, argselect and key-value +(32-bit and 64-bit only) based implementation of quicksort, quickselect, +partialsort, argsort, argselect & key-value sort. The following API's are currently supported: #### Quicksort @@ -30,8 +30,8 @@ Equivalent to `std::nth_element` in ```cpp -void avx512_qselect(T* arr, size_t arrsize, bool hasnan = false, bool descending = false); -void avx2_qselect(T* arr, size_t arrsize, bool hasnan = false, bool descending = false); +void avx512_qselect(T* arr, size_t k, size_t arrsize, bool hasnan = false, bool descending = false); +void avx2_qselect(T* arr, size_t k, size_t arrsize, bool hasnan = false, bool descending = false); ``` Supported datatypes: `uint16_t`, `int16_t`, `_Float16`, `uint32_t`, `int32_t`, `float`, `uint64_t`, `int64_t` and `double`. AVX2 versions currently support @@ -46,8 +46,8 @@ Equivalent to `std::partial_sort` in ```cpp -void avx512_partial_qsort(T* arr, size_t arrsize, bool hasnan = false, bool descending = false) -void avx2_partial_qsort(T* arr, size_t arrsize, bool hasnan = false, bool descending = false) +void avx512_partial_qsort(T* arr, size_t k, size_t arrsize, bool hasnan = false, bool descending = false) +void avx2_partial_qsort(T* arr, size_t k, size_t arrsize, bool hasnan = false, bool descending = false) ``` Supported datatypes: `uint16_t`, `int16_t`, `_Float16`, `uint32_t`, `int32_t`, `float`, `uint64_t`, `int64_t` and `double`. AVX2 versions currently support @@ -61,8 +61,8 @@ Equivalent to `np.argsort` in [NumPy](https://numpy.org/doc/stable/reference/generated/numpy.argsort.html). ```cpp -std::vector arg = avx512_argsort(T* arr, size_t arrsize, bool hasnan = false, bool descending = false); void avx512_argsort(T* arr, size_t *arg, size_t arrsize, bool hasnan = false, bool descending = false); +void avx2_argsort(T* arr, size_t *arg, size_t arrsize, bool hasnan = false, bool descending = false); ``` Supported datatypes: `uint32_t`, `int32_t`, `float`, `uint64_t`, `int64_t` and `double`. @@ -74,8 +74,8 @@ Equivalent to `np.argselect` in [NumPy](https://numpy.org/doc/stable/reference/generated/numpy.argpartition.html). ```cpp -std::vector arg = avx512_argselect(T* arr, size_t k, size_t arrsize); void avx512_argselect(T* arr, size_t *arg, size_t k, size_t arrsize); +void avx2_argselect(T* arr, size_t *arg, size_t k, size_t arrsize); ``` Supported datatypes: `uint32_t`, `int32_t`, `float`, `uint64_t`, `int64_t` and `double`. @@ -84,9 +84,10 @@ The algorithm resorts to scalar `std::sort` if the array contains NaNs. #### Key-value sort ```cpp -void avx512_qsort_kv(T1* key, T2* value , size_t arrsize) +void avx512_qsort_kv(T1* key, T2* value, size_t arrsize); +void avx2_qsort_kv(T1* key, T2* value, size_t arrsize); ``` -Supported datatypes: `uint64_t, int64_t and double` +Supported datatypes: `uint64_t`, `int64_t` and `double`. ## Algorithm details @@ -105,6 +106,8 @@ source code associated with that paper [3]. ### Sample code `main.cpp` ```cpp +#include "src/xss-common-includes.h" +#include "src/xss-common-qsort.h" #include "src/avx512-32bit-qsort.hpp" int main() {