SPRAAK
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Typedefs | Functions | Variables
API_LowLvl::lib::sort
+ Collaboration diagram for API_LowLvl::lib::sort:

Typedefs

typedef int(* const_FuncPtr2_QSORTX_cmp )(const void *, const void *;void spr_sort_qsortX(void *const data, const ssize_t size, const int key_offset, const int el_size, _FuncPtr2_QSORTX_ cmp),...)
 

Functions

void spr_sort_swap_data (char *const ptr1, char *const ptr2, ssize_t size)
 
void spr_sort_qsort_gen1 (void *data, ssize_t size, const int key_offset, const int el_size, int(*const cmp)(const void *, const void *))
 
float * spr_sort_find_Nmax_f32 (float *dst, float *src, int size, int N)
 
float * spr_sort_find_Nmin_f32 (float *dst, float *src, int size, int N)
 
void spr_sort_down_f32 (float *restrict data, int size)
 
float * spr_sort_down2_f32 (float *restrict dst, const float *src, int size)
 
void spr_sort_up_f32 (float *restrict data, int size)
 
float * spr_sort_up2_f32 (float *restrict dst, const float *src, int size)
 
int32_t * spr_sort_set_ndx_x32 (int32_t *restrict index, int size)
 
float * spr_sort_find_Nmax_f32_x32 (float *dst, int32_t *dst_ndx, float *src, int32_t *src_ndx, int size, int N)
 
float * spr_sort_find_Nmin_f32_x32 (float *dst, int32_t *dst_ndx, float *src, int32_t *src_ndx, int size, int N)
 
void spr_sort_down_f32_x32 (float *restrict data, int size, int32_t *restrict index)
 
float * spr_sort_down2_f32_x32 (float *restrict dst, const float *src, int size, int32_t *restrict dst_ndx, const int32_t *src_ndx)
 
float * spr_sort_down3_f32_x32 (float *restrict data, int size, int32_t *restrict dst_ndx, const int32_t *src_ndx)
 
void spr_sort_up_f32_x32 (float *restrict data, int size, int32_t *restrict index)
 
float * spr_sort_up2_f32_x32 (float *restrict dst, const float *src, int size, int32_t *restrict dst_ndx, const int32_t *src_ndx)
 
float * spr_sort_up3_f32_x32 (float *restrict data, int size, int32_t *restrict dst_ndx, const int32_t *src_ndx)
 
int64_t * spr_sort_set_ndx_x64 (int64_t *restrict index, int size)
 
float * spr_sort_find_Nmax_f32_x64 (float *dst, int64_t *dst_ndx, float *src, int64_t *src_ndx, int size, int N)
 
float * spr_sort_find_Nmin_f32_x64 (float *dst, int64_t *dst_ndx, float *src, int64_t *src_ndx, int size, int N)
 
void spr_sort_down_f32_x64 (float *restrict data, int size, int64_t *restrict index)
 
float * spr_sort_down2_f32_x64 (float *restrict dst, const float *src, int size, int64_t *restrict dst_ndx, const int64_t *src_ndx)
 
float * spr_sort_down3_f32_x64 (float *restrict data, int size, int64_t *restrict dst_ndx, const int64_t *src_ndx)
 
void spr_sort_up_f32_x64 (float *restrict data, int size, int64_t *restrict index)
 
float * spr_sort_up2_f32_x64 (float *restrict dst, const float *src, int size, int64_t *restrict dst_ndx, const int64_t *src_ndx)
 
float * spr_sort_up3_f32_x64 (float *restrict data, int size, int64_t *restrict dst_ndx, const int64_t *src_ndx)
 
double * spr_sort_find_Nmax_f64 (double *dst, double *src, int size, int N)
 
double * spr_sort_find_Nmin_f64 (double *dst, double *src, int size, int N)
 
void spr_sort_down_f64 (double *restrict data, int size)
 
double * spr_sort_down2_f64 (double *restrict dst, const double *src, int size)
 
void spr_sort_up_f64 (double *restrict data, int size)
 
double * spr_sort_up2_f64 (double *restrict dst, const double *src, int size)
 
double * spr_sort_find_Nmax_f64_x32 (double *dst, int32_t *dst_ndx, double *src, int32_t *src_ndx, int size, int N)
 
double * spr_sort_find_Nmin_f64_x32 (double *dst, int32_t *dst_ndx, double *src, int32_t *src_ndx, int size, int N)
 
void spr_sort_down_f64_x32 (double *restrict data, int size, int32_t *restrict index)
 
double * spr_sort_down2_f64_x32 (double *restrict dst, const double *src, int size, int32_t *restrict dst_ndx, const int32_t *src_ndx)
 
double * spr_sort_down3_f64_x32 (double *restrict data, int size, int32_t *restrict dst_ndx, const int32_t *src_ndx)
 
void spr_sort_up_f64_x32 (double *restrict data, int size, int32_t *restrict index)
 
double * spr_sort_up2_f64_x32 (double *restrict dst, const double *src, int size, int32_t *restrict dst_ndx, const int32_t *src_ndx)
 
double * spr_sort_up3_f64_x32 (double *restrict data, int size, int32_t *restrict dst_ndx, const int32_t *src_ndx)
 
double * spr_sort_find_Nmax_f64_x64 (double *dst, int64_t *dst_ndx, double *src, int64_t *src_ndx, int size, int N)
 
double * spr_sort_find_Nmin_f64_x64 (double *dst, int64_t *dst_ndx, double *src, int64_t *src_ndx, int size, int N)
 
void spr_sort_down_f64_x64 (double *restrict data, int size, int64_t *restrict index)
 
double * spr_sort_down2_f64_x64 (double *restrict dst, const double *src, int size, int64_t *restrict dst_ndx, const int64_t *src_ndx)
 
double * spr_sort_down3_f64_x64 (double *restrict data, int size, int64_t *restrict dst_ndx, const int64_t *src_ndx)
 
void spr_sort_up_f64_x64 (double *restrict data, int size, int64_t *restrict index)
 
double * spr_sort_up2_f64_x64 (double *restrict dst, const double *src, int size, int64_t *restrict dst_ndx, const int64_t *src_ndx)
 
double * spr_sort_up3_f64_x64 (double *restrict data, int size, int64_t *restrict dst_ndx, const int64_t *src_ndx)
 
int32_t * spr_sort_find_Nmax_i32 (int32_t *dst, int32_t *src, int size, int N)
 
int32_t * spr_sort_find_Nmin_i32 (int32_t *dst, int32_t *src, int size, int N)
 
void spr_sort_down_i32 (int32_t *restrict data, int size)
 
int32_t * spr_sort_down2_i32 (int32_t *restrict dst, const int32_t *src, int size)
 
void spr_sort_up_i32 (int32_t *restrict data, int size)
 
int32_t * spr_sort_up2_i32 (int32_t *restrict dst, const int32_t *src, int size)
 
int32_t * spr_sort_find_Nmax_i32_x32 (int32_t *dst, int32_t *dst_ndx, int32_t *src, int32_t *src_ndx, int size, int N)
 
int32_t * spr_sort_find_Nmin_i32_x32 (int32_t *dst, int32_t *dst_ndx, int32_t *src, int32_t *src_ndx, int size, int N)
 
void spr_sort_down_i32_x32 (int32_t *restrict data, int size, int32_t *restrict index)
 
int32_t * spr_sort_down2_i32_x32 (int32_t *restrict dst, const int32_t *src, int size, int32_t *restrict dst_ndx, const int32_t *src_ndx)
 
int32_t * spr_sort_down3_i32_x32 (int32_t *restrict data, int size, int32_t *restrict dst_ndx, const int32_t *src_ndx)
 
void spr_sort_up_i32_x32 (int32_t *restrict data, int size, int32_t *restrict index)
 
int32_t * spr_sort_up2_i32_x32 (int32_t *restrict dst, const int32_t *src, int size, int32_t *restrict dst_ndx, const int32_t *src_ndx)
 
int32_t * spr_sort_up3_i32_x32 (int32_t *restrict data, int size, int32_t *restrict dst_ndx, const int32_t *src_ndx)
 
int32_t * spr_sort_find_Nmax_i32_x64 (int32_t *dst, int64_t *dst_ndx, int32_t *src, int64_t *src_ndx, int size, int N)
 
int32_t * spr_sort_find_Nmin_i32_x64 (int32_t *dst, int64_t *dst_ndx, int32_t *src, int64_t *src_ndx, int size, int N)
 
void spr_sort_down_i32_x64 (int32_t *restrict data, int size, int64_t *restrict index)
 
int32_t * spr_sort_down2_i32_x64 (int32_t *restrict dst, const int32_t *src, int size, int64_t *restrict dst_ndx, const int64_t *src_ndx)
 
int32_t * spr_sort_down3_i32_x64 (int32_t *restrict data, int size, int64_t *restrict dst_ndx, const int64_t *src_ndx)
 
void spr_sort_up_i32_x64 (int32_t *restrict data, int size, int64_t *restrict index)
 
int32_t * spr_sort_up2_i32_x64 (int32_t *restrict dst, const int32_t *src, int size, int64_t *restrict dst_ndx, const int64_t *src_ndx)
 
int32_t * spr_sort_up3_i32_x64 (int32_t *restrict data, int size, int64_t *restrict dst_ndx, const int64_t *src_ndx)
 
int64_t * spr_sort_find_Nmax_i64 (int64_t *dst, int64_t *src, int size, int N)
 
int64_t * spr_sort_find_Nmin_i64 (int64_t *dst, int64_t *src, int size, int N)
 
void spr_sort_down_i64 (int64_t *restrict data, int size)
 
int64_t * spr_sort_down2_i64 (int64_t *restrict dst, const int64_t *src, int size)
 
void spr_sort_up_i64 (int64_t *restrict data, int size)
 
int64_t * spr_sort_up2_i64 (int64_t *restrict dst, const int64_t *src, int size)
 
int64_t * spr_sort_find_Nmax_i64_x32 (int64_t *dst, int32_t *dst_ndx, int64_t *src, int32_t *src_ndx, int size, int N)
 
int64_t * spr_sort_find_Nmin_i64_x32 (int64_t *dst, int32_t *dst_ndx, int64_t *src, int32_t *src_ndx, int size, int N)
 
void spr_sort_down_i64_x32 (int64_t *restrict data, int size, int32_t *restrict index)
 
int64_t * spr_sort_down2_i64_x32 (int64_t *restrict dst, const int64_t *src, int size, int32_t *restrict dst_ndx, const int32_t *src_ndx)
 
int64_t * spr_sort_down3_i64_x32 (int64_t *restrict data, int size, int32_t *restrict dst_ndx, const int32_t *src_ndx)
 
void spr_sort_up_i64_x32 (int64_t *restrict data, int size, int32_t *restrict index)
 
int64_t * spr_sort_up2_i64_x32 (int64_t *restrict dst, const int64_t *src, int size, int32_t *restrict dst_ndx, const int32_t *src_ndx)
 
int64_t * spr_sort_up3_i64_x32 (int64_t *restrict data, int size, int32_t *restrict dst_ndx, const int32_t *src_ndx)
 
int64_t * spr_sort_find_Nmax_i64_x64 (int64_t *dst, int64_t *dst_ndx, int64_t *src, int64_t *src_ndx, int size, int N)
 
int64_t * spr_sort_find_Nmin_i64_x64 (int64_t *dst, int64_t *dst_ndx, int64_t *src, int64_t *src_ndx, int size, int N)
 
void spr_sort_down_i64_x64 (int64_t *restrict data, int size, int64_t *restrict index)
 
int64_t * spr_sort_down2_i64_x64 (int64_t *restrict dst, const int64_t *src, int size, int64_t *restrict dst_ndx, const int64_t *src_ndx)
 
int64_t * spr_sort_down3_i64_x64 (int64_t *restrict data, int size, int64_t *restrict dst_ndx, const int64_t *src_ndx)
 
void spr_sort_up_i64_x64 (int64_t *restrict data, int size, int64_t *restrict index)
 
int64_t * spr_sort_up2_i64_x64 (int64_t *restrict dst, const int64_t *src, int size, int64_t *restrict dst_ndx, const int64_t *src_ndx)
 
int64_t * spr_sort_up3_i64_x64 (int64_t *restrict data, int size, int64_t *restrict dst_ndx, const int64_t *src_ndx)
 
float * spr_sort_quicksort (float *input, const int inputlength, int *index_in, float *output, const int outputlength, int **index_out, const char *options)
 

Variables

int(* spr_sort_cmp_int )(const void *int1, const void *int2)
 
int(* spr_sort_rcmp_int )(const void *int1, const void *int2)
 
int(* spr_sort_cmp_size )(const void *size1, const void *size2)
 
int(* spr_sort_rcmp_size )(const void *size1, const void *size2)
 
int(* spr_sort_cmp_ssize )(const void *ssize1, const void *ssize2)
 
int(* spr_sort_rcmp_ssize )(const void *ssize1, const void *ssize2)
 
int(* spr_sort_cmp_long )(const void *long1, const void *long2)
 
int(* spr_sort_rcmp_long )(const void *long1, const void *long2)
 
int(* spr_sort_cmp_uint )(const void *uint1, const void *uint2)
 
int(* spr_sort_rcmp_uint )(const void *uint1, const void *uint2)
 
int(* spr_sort_cmp_ulong )(const void *ulong1, const void *ulong2)
 
int(* spr_sort_rcmp_ulong )(const void *ulong1, const void *ulong2)
 
int(* spr_sort_cmp_float )(const void *float1, const void *float2)
 
int(* spr_sort_rcmp_float )(const void *float1, const void *float2)
 
int(* spr_sort_cmp_double )(const void *double1, const void *double2)
 
int(* spr_sort_rcmp_double )(const void *double1, const void *double2)
 
int(* spr_sort_cmp_str )(const void *str1, const void *str2)
 
int(* spr_sort_rcmp_str )(const void *str1, const void *str2)
 

Detailed Description

Typedef Documentation

typedef int(* const_FuncPtr2_QSORTX_cmp)(const void *,const void *;void spr_sort_qsortX(void *const data,const ssize_t size,const int key_offset,const int el_size, _FuncPtr2_QSORTX_ cmp),...)

Function Documentation

void spr_sort_swap_data ( char *const  ptr1,
char *const  ptr2,
ssize_t  size 
)

Swap the data in two memory blocks. If the data blocks overlap and are not equal, the result is undefined.

void spr_sort_qsort_gen1 ( void *  data,
ssize_t  size,
const int  key_offset,
const int  el_size,
int(*)(const void *, const void *)  cmp 
)

Sort the array data containing size structures of size el_size from small to large using the comparison function cmp on the field at offset key_offset in the structure. The main difference with the qsort() function in C, is the key_offset argument. This argument allows you to sort on each field in a structure, without having to define special comparison functions to cope with the offset of that specific field.

float* spr_sort_find_Nmax_f32 ( float *  dst,
float *  src,
int  size,
int  N 
)

Select the N largest values from the given input array src of size size and put them in the dst array. This routine can operate in-situ (src==dst).

Returns
dst
float* spr_sort_find_Nmin_f32 ( float *  dst,
float *  src,
int  size,
int  N 
)

Select the N smallest values from the given input array src of size size and put them in the dst array. This routine can operate in-situ (src==dst).

Returns
dst.
void spr_sort_down_f32 ( float *restrict  data,
int  size 
)

Sort the array data containing size values from large to small using the quicksort algorithm.

float* spr_sort_down2_f32 ( float *restrict  dst,
const float *  src,
int  size 
)

Sort the array src containing size values from large to small and put the result in the array dst. Source and destination array must differ!

Returns
dst
void spr_sort_up_f32 ( float *restrict  data,
int  size 
)

Sort the array data containing size values from small to large using the quicksort algorithm.

float* spr_sort_up2_f32 ( float *restrict  dst,
const float *  src,
int  size 
)

Sort the array src containing size values from small to large and put the result in the array dst. Source and destination array must differ!

Returns
dst
int32_t* spr_sort_set_ndx_x32 ( int32_t *restrict  index,
int  size 
)

Initialize an index index array to the values [0..size-1].

Returns
index
float* spr_sort_find_Nmax_f32_x32 ( float *  dst,
int32_t *  dst_ndx,
float *  src,
int32_t *  src_ndx,
int  size,
int  N 
)

Select the N largest values from the given input array src of size size and put them in the dst array. The indices in src_ndx are copied to dst_ndx in the same order as the values from src are copied to dst. If src_ndx equals NULL, an index array of [0..size-1] is assumed. This routine can operate in-situ (src==dst) and/or (dst_ndx==src_ndx).

Returns
dst.
float* spr_sort_find_Nmin_f32_x32 ( float *  dst,
int32_t *  dst_ndx,
float *  src,
int32_t *  src_ndx,
int  size,
int  N 
)

Select the N smallest values from the given input array src of size size and put them in the dst array. The indices in src_ndx are copied to dst_ndx in the same order as the values from src are copied to dst. If src_ndx equals NULL, an index array of [0..size-1] is assumed. This routine can operate in-situ (src==dst) and/or (dst_ndx==src_ndx).

Returns
dst.
void spr_sort_down_f32_x32 ( float *restrict  data,
int  size,
int32_t *restrict  index 
)

Sort the array data containing size values from large to small using the quicksort algorithm. The index array index is rearanged in the same order.

float* spr_sort_down2_f32_x32 ( float *restrict  dst,
const float *  src,
int  size,
int32_t *restrict  dst_ndx,
const int32_t *  src_ndx 
)

Sort the array src containing size values from large to small and put the result in the array dst.

The indices in src_ndx are copied to dst_ndx in the same order as the floating point values from src are copied to dst. If src_ndx equals NULL, an index array of [0..size-1] is assumed.

Source and destination arrays must differ!

Returns
dst
float* spr_sort_down3_f32_x32 ( float *restrict  data,
int  size,
int32_t *restrict  dst_ndx,
const int32_t *  src_ndx 
)

Sort the array data containing size values from large to small.

The indices in src_ndx are copied to dst_ndx in the same order as the floating point values in data are rearanged. If src_ndx equals NULL, an index array of [0..size-1] is assumed.

Source and destination index array must differ!

Returns
data
void spr_sort_up_f32_x32 ( float *restrict  data,
int  size,
int32_t *restrict  index 
)
float* spr_sort_up2_f32_x32 ( float *restrict  dst,
const float *  src,
int  size,
int32_t *restrict  dst_ndx,
const int32_t *  src_ndx 
)

Sort the array src containing size values from small to large and put the result in the array dst.

The indices in src_ndx are copied to dst_ndx in the same order as the floating point values from src are copied to dst. If src_ndx equals NULL, an index array of [0..size-1] is assumed.

Source and destination arrays must differ!

Returns
dst
float* spr_sort_up3_f32_x32 ( float *restrict  data,
int  size,
int32_t *restrict  dst_ndx,
const int32_t *  src_ndx 
)

Sort the array data containing size values from small to large.

The indices in src_ndx are copied to dst_ndx in the same order as the floating point values in data are rearanged. If src_ndx equals NULL, an index array of [0..size-1] is assumed.

Source and destination index array must differ!

Returns
data
int64_t* spr_sort_set_ndx_x64 ( int64_t *restrict  index,
int  size 
)

Initialize an index index array to the values [0..size-1].

Returns
index
float* spr_sort_find_Nmax_f32_x64 ( float *  dst,
int64_t *  dst_ndx,
float *  src,
int64_t *  src_ndx,
int  size,
int  N 
)

Select the N largest values from the given input array src of size size and put them in the dst array. The indices in src_ndx are copied to dst_ndx in the same order as the values from src are copied to dst. If src_ndx equals NULL, an index array of [0..size-1] is assumed. This routine can operate in-situ (src==dst) and/or (dst_ndx==src_ndx).

Returns
dst.
float* spr_sort_find_Nmin_f32_x64 ( float *  dst,
int64_t *  dst_ndx,
float *  src,
int64_t *  src_ndx,
int  size,
int  N 
)

Select the N smallest values from the given input array src of size size and put them in the dst array. The indices in src_ndx are copied to dst_ndx in the same order as the values from src are copied to dst. If src_ndx equals NULL, an index array of [0..size-1] is assumed. This routine can operate in-situ (src==dst) and/or (dst_ndx==src_ndx).

Returns
dst.
void spr_sort_down_f32_x64 ( float *restrict  data,
int  size,
int64_t *restrict  index 
)

Sort the array data containing size values from large to small using the quicksort algorithm. The index array index is rearanged in the same order.

float* spr_sort_down2_f32_x64 ( float *restrict  dst,
const float *  src,
int  size,
int64_t *restrict  dst_ndx,
const int64_t *  src_ndx 
)

Sort the array src containing size values from large to small and put the result in the array dst.

The indices in src_ndx are copied to dst_ndx in the same order as the floating point values from src are copied to dst. If src_ndx equals NULL, an index array of [0..size-1] is assumed.

Source and destination arrays must differ!

Returns
dst
float* spr_sort_down3_f32_x64 ( float *restrict  data,
int  size,
int64_t *restrict  dst_ndx,
const int64_t *  src_ndx 
)

Sort the array data containing size values from large to small.

The indices in src_ndx are copied to dst_ndx in the same order as the floating point values in data are rearanged. If src_ndx equals NULL, an index array of [0..size-1] is assumed.

Source and destination index array must differ!

Returns
data
void spr_sort_up_f32_x64 ( float *restrict  data,
int  size,
int64_t *restrict  index 
)
float* spr_sort_up2_f32_x64 ( float *restrict  dst,
const float *  src,
int  size,
int64_t *restrict  dst_ndx,
const int64_t *  src_ndx 
)

Sort the array src containing size values from small to large and put the result in the array dst.

The indices in src_ndx are copied to dst_ndx in the same order as the floating point values from src are copied to dst. If src_ndx equals NULL, an index array of [0..size-1] is assumed.

Source and destination arrays must differ!

Returns
dst
float* spr_sort_up3_f32_x64 ( float *restrict  data,
int  size,
int64_t *restrict  dst_ndx,
const int64_t *  src_ndx 
)

Sort the array data containing size values from small to large.

The indices in src_ndx are copied to dst_ndx in the same order as the floating point values in data are rearanged. If src_ndx equals NULL, an index array of [0..size-1] is assumed.

Source and destination index array must differ!

Returns
data
double* spr_sort_find_Nmax_f64 ( double *  dst,
double *  src,
int  size,
int  N 
)

Select the N largest values from the given input array src of size size and put them in the dst array. This routine can operate in-situ (src==dst).

Returns
dst
double* spr_sort_find_Nmin_f64 ( double *  dst,
double *  src,
int  size,
int  N 
)

Select the N smallest values from the given input array src of size size and put them in the dst array. This routine can operate in-situ (src==dst).

Returns
dst.
void spr_sort_down_f64 ( double *restrict  data,
int  size 
)

Sort the array data containing size values from large to small using the quicksort algorithm.

double* spr_sort_down2_f64 ( double *restrict  dst,
const double *  src,
int  size 
)

Sort the array src containing size values from large to small and put the result in the array dst. Source and destination array must differ!

Returns
dst
void spr_sort_up_f64 ( double *restrict  data,
int  size 
)

Sort the array data containing size values from small to large using the quicksort algorithm.

double* spr_sort_up2_f64 ( double *restrict  dst,
const double *  src,
int  size 
)

Sort the array src containing size values from small to large and put the result in the array dst. Source and destination array must differ!

Returns
dst
double* spr_sort_find_Nmax_f64_x32 ( double *  dst,
int32_t *  dst_ndx,
double *  src,
int32_t *  src_ndx,
int  size,
int  N 
)

Select the N largest values from the given input array src of size size and put them in the dst array. The indices in src_ndx are copied to dst_ndx in the same order as the values from src are copied to dst. If src_ndx equals NULL, an index array of [0..size-1] is assumed. This routine can operate in-situ (src==dst) and/or (dst_ndx==src_ndx).

Returns
dst.
double* spr_sort_find_Nmin_f64_x32 ( double *  dst,
int32_t *  dst_ndx,
double *  src,
int32_t *  src_ndx,
int  size,
int  N 
)

Select the N smallest values from the given input array src of size size and put them in the dst array. The indices in src_ndx are copied to dst_ndx in the same order as the values from src are copied to dst. If src_ndx equals NULL, an index array of [0..size-1] is assumed. This routine can operate in-situ (src==dst) and/or (dst_ndx==src_ndx).

Returns
dst.
void spr_sort_down_f64_x32 ( double *restrict  data,
int  size,
int32_t *restrict  index 
)

Sort the array data containing size values from large to small using the quicksort algorithm. The index array index is rearanged in the same order.

double* spr_sort_down2_f64_x32 ( double *restrict  dst,
const double *  src,
int  size,
int32_t *restrict  dst_ndx,
const int32_t *  src_ndx 
)

Sort the array src containing size values from large to small and put the result in the array dst.

The indices in src_ndx are copied to dst_ndx in the same order as the floating point values from src are copied to dst. If src_ndx equals NULL, an index array of [0..size-1] is assumed.

Source and destination arrays must differ!

Returns
dst
double* spr_sort_down3_f64_x32 ( double *restrict  data,
int  size,
int32_t *restrict  dst_ndx,
const int32_t *  src_ndx 
)

Sort the array data containing size values from large to small.

The indices in src_ndx are copied to dst_ndx in the same order as the floating point values in data are rearanged. If src_ndx equals NULL, an index array of [0..size-1] is assumed.

Source and destination index array must differ!

Returns
data
void spr_sort_up_f64_x32 ( double *restrict  data,
int  size,
int32_t *restrict  index 
)
double* spr_sort_up2_f64_x32 ( double *restrict  dst,
const double *  src,
int  size,
int32_t *restrict  dst_ndx,
const int32_t *  src_ndx 
)

Sort the array src containing size values from small to large and put the result in the array dst.

The indices in src_ndx are copied to dst_ndx in the same order as the floating point values from src are copied to dst. If src_ndx equals NULL, an index array of [0..size-1] is assumed.

Source and destination arrays must differ!

Returns
dst
double* spr_sort_up3_f64_x32 ( double *restrict  data,
int  size,
int32_t *restrict  dst_ndx,
const int32_t *  src_ndx 
)

Sort the array data containing size values from small to large.

The indices in src_ndx are copied to dst_ndx in the same order as the floating point values in data are rearanged. If src_ndx equals NULL, an index array of [0..size-1] is assumed.

Source and destination index array must differ!

Returns
data
double* spr_sort_find_Nmax_f64_x64 ( double *  dst,
int64_t *  dst_ndx,
double *  src,
int64_t *  src_ndx,
int  size,
int  N 
)

Select the N largest values from the given input array src of size size and put them in the dst array. The indices in src_ndx are copied to dst_ndx in the same order as the values from src are copied to dst. If src_ndx equals NULL, an index array of [0..size-1] is assumed. This routine can operate in-situ (src==dst) and/or (dst_ndx==src_ndx).

Returns
dst.
double* spr_sort_find_Nmin_f64_x64 ( double *  dst,
int64_t *  dst_ndx,
double *  src,
int64_t *  src_ndx,
int  size,
int  N 
)

Select the N smallest values from the given input array src of size size and put them in the dst array. The indices in src_ndx are copied to dst_ndx in the same order as the values from src are copied to dst. If src_ndx equals NULL, an index array of [0..size-1] is assumed. This routine can operate in-situ (src==dst) and/or (dst_ndx==src_ndx).

Returns
dst.
void spr_sort_down_f64_x64 ( double *restrict  data,
int  size,
int64_t *restrict  index 
)

Sort the array data containing size values from large to small using the quicksort algorithm. The index array index is rearanged in the same order.

double* spr_sort_down2_f64_x64 ( double *restrict  dst,
const double *  src,
int  size,
int64_t *restrict  dst_ndx,
const int64_t *  src_ndx 
)

Sort the array src containing size values from large to small and put the result in the array dst.

The indices in src_ndx are copied to dst_ndx in the same order as the floating point values from src are copied to dst. If src_ndx equals NULL, an index array of [0..size-1] is assumed.

Source and destination arrays must differ!

Returns
dst
double* spr_sort_down3_f64_x64 ( double *restrict  data,
int  size,
int64_t *restrict  dst_ndx,
const int64_t *  src_ndx 
)

Sort the array data containing size values from large to small.

The indices in src_ndx are copied to dst_ndx in the same order as the floating point values in data are rearanged. If src_ndx equals NULL, an index array of [0..size-1] is assumed.

Source and destination index array must differ!

Returns
data
void spr_sort_up_f64_x64 ( double *restrict  data,
int  size,
int64_t *restrict  index 
)
double* spr_sort_up2_f64_x64 ( double *restrict  dst,
const double *  src,
int  size,
int64_t *restrict  dst_ndx,
const int64_t *  src_ndx 
)

Sort the array src containing size values from small to large and put the result in the array dst.

The indices in src_ndx are copied to dst_ndx in the same order as the floating point values from src are copied to dst. If src_ndx equals NULL, an index array of [0..size-1] is assumed.

Source and destination arrays must differ!

Returns
dst
double* spr_sort_up3_f64_x64 ( double *restrict  data,
int  size,
int64_t *restrict  dst_ndx,
const int64_t *  src_ndx 
)

Sort the array data containing size values from small to large.

The indices in src_ndx are copied to dst_ndx in the same order as the floating point values in data are rearanged. If src_ndx equals NULL, an index array of [0..size-1] is assumed.

Source and destination index array must differ!

Returns
data
int32_t* spr_sort_find_Nmax_i32 ( int32_t *  dst,
int32_t *  src,
int  size,
int  N 
)

Select the N largest values from the given input array src of size size and put them in the dst array. This routine can operate in-situ (src==dst).

Returns
dst
int32_t* spr_sort_find_Nmin_i32 ( int32_t *  dst,
int32_t *  src,
int  size,
int  N 
)

Select the N smallest values from the given input array src of size size and put them in the dst array. This routine can operate in-situ (src==dst).

Returns
dst.
void spr_sort_down_i32 ( int32_t *restrict  data,
int  size 
)

Sort the array data containing size values from large to small using the quicksort algorithm.

int32_t* spr_sort_down2_i32 ( int32_t *restrict  dst,
const int32_t *  src,
int  size 
)

Sort the array src containing size values from large to small and put the result in the array dst. Source and destination array must differ!

Returns
dst
void spr_sort_up_i32 ( int32_t *restrict  data,
int  size 
)

Sort the array data containing size values from small to large using the quicksort algorithm.

int32_t* spr_sort_up2_i32 ( int32_t *restrict  dst,
const int32_t *  src,
int  size 
)

Sort the array src containing size values from small to large and put the result in the array dst. Source and destination array must differ!

Returns
dst
int32_t* spr_sort_find_Nmax_i32_x32 ( int32_t *  dst,
int32_t *  dst_ndx,
int32_t *  src,
int32_t *  src_ndx,
int  size,
int  N 
)

Select the N largest values from the given input array src of size size and put them in the dst array. The indices in src_ndx are copied to dst_ndx in the same order as the values from src are copied to dst. If src_ndx equals NULL, an index array of [0..size-1] is assumed. This routine can operate in-situ (src==dst) and/or (dst_ndx==src_ndx).

Returns
dst.
int32_t* spr_sort_find_Nmin_i32_x32 ( int32_t *  dst,
int32_t *  dst_ndx,
int32_t *  src,
int32_t *  src_ndx,
int  size,
int  N 
)

Select the N smallest values from the given input array src of size size and put them in the dst array. The indices in src_ndx are copied to dst_ndx in the same order as the values from src are copied to dst. If src_ndx equals NULL, an index array of [0..size-1] is assumed. This routine can operate in-situ (src==dst) and/or (dst_ndx==src_ndx).

Returns
dst.
void spr_sort_down_i32_x32 ( int32_t *restrict  data,
int  size,
int32_t *restrict  index 
)

Sort the array data containing size values from large to small using the quicksort algorithm. The index array index is rearanged in the same order.

int32_t* spr_sort_down2_i32_x32 ( int32_t *restrict  dst,
const int32_t *  src,
int  size,
int32_t *restrict  dst_ndx,
const int32_t *  src_ndx 
)

Sort the array src containing size values from large to small and put the result in the array dst.

The indices in src_ndx are copied to dst_ndx in the same order as the floating point values from src are copied to dst. If src_ndx equals NULL, an index array of [0..size-1] is assumed.

Source and destination arrays must differ!

Returns
dst
int32_t* spr_sort_down3_i32_x32 ( int32_t *restrict  data,
int  size,
int32_t *restrict  dst_ndx,
const int32_t *  src_ndx 
)

Sort the array data containing size values from large to small.

The indices in src_ndx are copied to dst_ndx in the same order as the floating point values in data are rearanged. If src_ndx equals NULL, an index array of [0..size-1] is assumed.

Source and destination index array must differ!

Returns
data
void spr_sort_up_i32_x32 ( int32_t *restrict  data,
int  size,
int32_t *restrict  index 
)
int32_t* spr_sort_up2_i32_x32 ( int32_t *restrict  dst,
const int32_t *  src,
int  size,
int32_t *restrict  dst_ndx,
const int32_t *  src_ndx 
)

Sort the array src containing size values from small to large and put the result in the array dst.

The indices in src_ndx are copied to dst_ndx in the same order as the floating point values from src are copied to dst. If src_ndx equals NULL, an index array of [0..size-1] is assumed.

Source and destination arrays must differ!

Returns
dst
int32_t* spr_sort_up3_i32_x32 ( int32_t *restrict  data,
int  size,
int32_t *restrict  dst_ndx,
const int32_t *  src_ndx 
)

Sort the array data containing size values from small to large.

The indices in src_ndx are copied to dst_ndx in the same order as the floating point values in data are rearanged. If src_ndx equals NULL, an index array of [0..size-1] is assumed.

Source and destination index array must differ!

Returns
data
int32_t* spr_sort_find_Nmax_i32_x64 ( int32_t *  dst,
int64_t *  dst_ndx,
int32_t *  src,
int64_t *  src_ndx,
int  size,
int  N 
)

Select the N largest values from the given input array src of size size and put them in the dst array. The indices in src_ndx are copied to dst_ndx in the same order as the values from src are copied to dst. If src_ndx equals NULL, an index array of [0..size-1] is assumed. This routine can operate in-situ (src==dst) and/or (dst_ndx==src_ndx).

Returns
dst.
int32_t* spr_sort_find_Nmin_i32_x64 ( int32_t *  dst,
int64_t *  dst_ndx,
int32_t *  src,
int64_t *  src_ndx,
int  size,
int  N 
)

Select the N smallest values from the given input array src of size size and put them in the dst array. The indices in src_ndx are copied to dst_ndx in the same order as the values from src are copied to dst. If src_ndx equals NULL, an index array of [0..size-1] is assumed. This routine can operate in-situ (src==dst) and/or (dst_ndx==src_ndx).

Returns
dst.
void spr_sort_down_i32_x64 ( int32_t *restrict  data,
int  size,
int64_t *restrict  index 
)

Sort the array data containing size values from large to small using the quicksort algorithm. The index array index is rearanged in the same order.

int32_t* spr_sort_down2_i32_x64 ( int32_t *restrict  dst,
const int32_t *  src,
int  size,
int64_t *restrict  dst_ndx,
const int64_t *  src_ndx 
)

Sort the array src containing size values from large to small and put the result in the array dst.

The indices in src_ndx are copied to dst_ndx in the same order as the floating point values from src are copied to dst. If src_ndx equals NULL, an index array of [0..size-1] is assumed.

Source and destination arrays must differ!

Returns
dst
int32_t* spr_sort_down3_i32_x64 ( int32_t *restrict  data,
int  size,
int64_t *restrict  dst_ndx,
const int64_t *  src_ndx 
)

Sort the array data containing size values from large to small.

The indices in src_ndx are copied to dst_ndx in the same order as the floating point values in data are rearanged. If src_ndx equals NULL, an index array of [0..size-1] is assumed.

Source and destination index array must differ!

Returns
data
void spr_sort_up_i32_x64 ( int32_t *restrict  data,
int  size,
int64_t *restrict  index 
)
int32_t* spr_sort_up2_i32_x64 ( int32_t *restrict  dst,
const int32_t *  src,
int  size,
int64_t *restrict  dst_ndx,
const int64_t *  src_ndx 
)

Sort the array src containing size values from small to large and put the result in the array dst.

The indices in src_ndx are copied to dst_ndx in the same order as the floating point values from src are copied to dst. If src_ndx equals NULL, an index array of [0..size-1] is assumed.

Source and destination arrays must differ!

Returns
dst
int32_t* spr_sort_up3_i32_x64 ( int32_t *restrict  data,
int  size,
int64_t *restrict  dst_ndx,
const int64_t *  src_ndx 
)

Sort the array data containing size values from small to large.

The indices in src_ndx are copied to dst_ndx in the same order as the floating point values in data are rearanged. If src_ndx equals NULL, an index array of [0..size-1] is assumed.

Source and destination index array must differ!

Returns
data
int64_t* spr_sort_find_Nmax_i64 ( int64_t *  dst,
int64_t *  src,
int  size,
int  N 
)

Select the N largest values from the given input array src of size size and put them in the dst array. This routine can operate in-situ (src==dst).

Returns
dst
int64_t* spr_sort_find_Nmin_i64 ( int64_t *  dst,
int64_t *  src,
int  size,
int  N 
)

Select the N smallest values from the given input array src of size size and put them in the dst array. This routine can operate in-situ (src==dst).

Returns
dst.
void spr_sort_down_i64 ( int64_t *restrict  data,
int  size 
)

Sort the array data containing size values from large to small using the quicksort algorithm.

int64_t* spr_sort_down2_i64 ( int64_t *restrict  dst,
const int64_t *  src,
int  size 
)

Sort the array src containing size values from large to small and put the result in the array dst. Source and destination array must differ!

Returns
dst
void spr_sort_up_i64 ( int64_t *restrict  data,
int  size 
)

Sort the array data containing size values from small to large using the quicksort algorithm.

int64_t* spr_sort_up2_i64 ( int64_t *restrict  dst,
const int64_t *  src,
int  size 
)

Sort the array src containing size values from small to large and put the result in the array dst. Source and destination array must differ!

Returns
dst
int64_t* spr_sort_find_Nmax_i64_x32 ( int64_t *  dst,
int32_t *  dst_ndx,
int64_t *  src,
int32_t *  src_ndx,
int  size,
int  N 
)

Select the N largest values from the given input array src of size size and put them in the dst array. The indices in src_ndx are copied to dst_ndx in the same order as the values from src are copied to dst. If src_ndx equals NULL, an index array of [0..size-1] is assumed. This routine can operate in-situ (src==dst) and/or (dst_ndx==src_ndx).

Returns
dst.
int64_t* spr_sort_find_Nmin_i64_x32 ( int64_t *  dst,
int32_t *  dst_ndx,
int64_t *  src,
int32_t *  src_ndx,
int  size,
int  N 
)

Select the N smallest values from the given input array src of size size and put them in the dst array. The indices in src_ndx are copied to dst_ndx in the same order as the values from src are copied to dst. If src_ndx equals NULL, an index array of [0..size-1] is assumed. This routine can operate in-situ (src==dst) and/or (dst_ndx==src_ndx).

Returns
dst.
void spr_sort_down_i64_x32 ( int64_t *restrict  data,
int  size,
int32_t *restrict  index 
)

Sort the array data containing size values from large to small using the quicksort algorithm. The index array index is rearanged in the same order.

int64_t* spr_sort_down2_i64_x32 ( int64_t *restrict  dst,
const int64_t *  src,
int  size,
int32_t *restrict  dst_ndx,
const int32_t *  src_ndx 
)

Sort the array src containing size values from large to small and put the result in the array dst.

The indices in src_ndx are copied to dst_ndx in the same order as the floating point values from src are copied to dst. If src_ndx equals NULL, an index array of [0..size-1] is assumed.

Source and destination arrays must differ!

Returns
dst
int64_t* spr_sort_down3_i64_x32 ( int64_t *restrict  data,
int  size,
int32_t *restrict  dst_ndx,
const int32_t *  src_ndx 
)

Sort the array data containing size values from large to small.

The indices in src_ndx are copied to dst_ndx in the same order as the floating point values in data are rearanged. If src_ndx equals NULL, an index array of [0..size-1] is assumed.

Source and destination index array must differ!

Returns
data
void spr_sort_up_i64_x32 ( int64_t *restrict  data,
int  size,
int32_t *restrict  index 
)
int64_t* spr_sort_up2_i64_x32 ( int64_t *restrict  dst,
const int64_t *  src,
int  size,
int32_t *restrict  dst_ndx,
const int32_t *  src_ndx 
)

Sort the array src containing size values from small to large and put the result in the array dst.

The indices in src_ndx are copied to dst_ndx in the same order as the floating point values from src are copied to dst. If src_ndx equals NULL, an index array of [0..size-1] is assumed.

Source and destination arrays must differ!

Returns
dst
int64_t* spr_sort_up3_i64_x32 ( int64_t *restrict  data,
int  size,
int32_t *restrict  dst_ndx,
const int32_t *  src_ndx 
)

Sort the array data containing size values from small to large.

The indices in src_ndx are copied to dst_ndx in the same order as the floating point values in data are rearanged. If src_ndx equals NULL, an index array of [0..size-1] is assumed.

Source and destination index array must differ!

Returns
data
int64_t* spr_sort_find_Nmax_i64_x64 ( int64_t *  dst,
int64_t *  dst_ndx,
int64_t *  src,
int64_t *  src_ndx,
int  size,
int  N 
)

Select the N largest values from the given input array src of size size and put them in the dst array. The indices in src_ndx are copied to dst_ndx in the same order as the values from src are copied to dst. If src_ndx equals NULL, an index array of [0..size-1] is assumed. This routine can operate in-situ (src==dst) and/or (dst_ndx==src_ndx).

Returns
dst.
int64_t* spr_sort_find_Nmin_i64_x64 ( int64_t *  dst,
int64_t *  dst_ndx,
int64_t *  src,
int64_t *  src_ndx,
int  size,
int  N 
)

Select the N smallest values from the given input array src of size size and put them in the dst array. The indices in src_ndx are copied to dst_ndx in the same order as the values from src are copied to dst. If src_ndx equals NULL, an index array of [0..size-1] is assumed. This routine can operate in-situ (src==dst) and/or (dst_ndx==src_ndx).

Returns
dst.
void spr_sort_down_i64_x64 ( int64_t *restrict  data,
int  size,
int64_t *restrict  index 
)

Sort the array data containing size values from large to small using the quicksort algorithm. The index array index is rearanged in the same order.

int64_t* spr_sort_down2_i64_x64 ( int64_t *restrict  dst,
const int64_t *  src,
int  size,
int64_t *restrict  dst_ndx,
const int64_t *  src_ndx 
)

Sort the array src containing size values from large to small and put the result in the array dst.

The indices in src_ndx are copied to dst_ndx in the same order as the floating point values from src are copied to dst. If src_ndx equals NULL, an index array of [0..size-1] is assumed.

Source and destination arrays must differ!

Returns
dst
int64_t* spr_sort_down3_i64_x64 ( int64_t *restrict  data,
int  size,
int64_t *restrict  dst_ndx,
const int64_t *  src_ndx 
)

Sort the array data containing size values from large to small.

The indices in src_ndx are copied to dst_ndx in the same order as the floating point values in data are rearanged. If src_ndx equals NULL, an index array of [0..size-1] is assumed.

Source and destination index array must differ!

Returns
data
void spr_sort_up_i64_x64 ( int64_t *restrict  data,
int  size,
int64_t *restrict  index 
)
int64_t* spr_sort_up2_i64_x64 ( int64_t *restrict  dst,
const int64_t *  src,
int  size,
int64_t *restrict  dst_ndx,
const int64_t *  src_ndx 
)

Sort the array src containing size values from small to large and put the result in the array dst.

The indices in src_ndx are copied to dst_ndx in the same order as the floating point values from src are copied to dst. If src_ndx equals NULL, an index array of [0..size-1] is assumed.

Source and destination arrays must differ!

Returns
dst
int64_t* spr_sort_up3_i64_x64 ( int64_t *restrict  data,
int  size,
int64_t *restrict  dst_ndx,
const int64_t *  src_ndx 
)

Sort the array data containing size values from small to large.

The indices in src_ndx are copied to dst_ndx in the same order as the floating point values in data are rearanged. If src_ndx equals NULL, an index array of [0..size-1] is assumed.

Source and destination index array must differ!

Returns
data
float* spr_sort_quicksort ( float *  input,
const int  inputlength,
int *  index_in,
float *  output,
const int  outputlength,
int **  index_out,
const char *  options 
)

Sort the input array using the quicksort algorithm. This is a wrapper function. For maximum efficiency, the low-level spr_sort_xxx(), spr_sort_set_ndx_xxx(), spr_sort_find_Nmax_xxx(), and spr_sort_find_Nmin_xxx functions should be used.

These are the items that can be set in the options string:

<
Sort from smallest to highest value.
>
Sort from highest to smallest value (default).
I
Allocate the output index array.
F
Allocate the output float array.

If index_in is NULL, the original indices are assumed to be (0,1,...,inputlength-1).
If index_out is NULL, no indexing is performed.
If output is NULL, and no allocation for the output array is requested, the input data array is used as output array.
If output is not NULL, and allocation for the output array is requested, the 'old' output data array will be deallocated first.

Returns
the (allocated) sorted float array on success and NULL on failure.
Parameters
inputarray to sort
inputlengthlength of input array
index_inoriginal index array
outputsorted array
outputlengthlength of output array
index_outresulting index array
optionsmodification options

Variable Documentation

int(* spr_sort_cmp_int)(const void *int1, const void *int2)

Pointer to a compare function for qsort and qsortX, that can be used when sorting integers from small to large.

int(* spr_sort_rcmp_int)(const void *int1, const void *int2)

Pointer to a compare function for qsort and qsortX, that can be used when sorting integers from large to small.

int(* spr_sort_cmp_size)(const void *size1, const void *size2)

Pointer to a compare function for qsort and qsortX, that can be used when sorting size_t integers from small to large.

int(* spr_sort_rcmp_size)(const void *size1, const void *size2)

Pointer to a compare function for qsort and qsortX, that can be used when sorting size_t integers from small to large.

int(* spr_sort_cmp_ssize)(const void *ssize1, const void *ssize2)

Pointer to a compare function for qsort and qsortX, that can be used when sorting ssize_t integers from small to large.

int(* spr_sort_rcmp_ssize)(const void *ssize1, const void *ssize2)

Pointer to a compare function for qsort and qsortX, that can be used when sorting ssize_t integers from small to large.

int(* spr_sort_cmp_long)(const void *long1, const void *long2)

Pointer to a compare function for qsort and qsortX, that can be used when sorting long integers from small to large.

int(* spr_sort_rcmp_long)(const void *long1, const void *long2)

Pointer to a compare function for qsort and qsortX, that can be used when sorting long integers from large to small.

int(* spr_sort_cmp_uint)(const void *uint1, const void *uint2)

Pointer to a compare function for qsort and qsortX, that can be used when sorting unsigned integers from small to large.

int(* spr_sort_rcmp_uint)(const void *uint1, const void *uint2)

Pointer to a compare function for qsort and qsortX, that can be used when sorting unsigned integers from large to small.

int(* spr_sort_cmp_ulong)(const void *ulong1, const void *ulong2)

Pointer to a compare function for qsort and qsortX, that can be used when sorting unsigned long integers from large to small.

int(* spr_sort_rcmp_ulong)(const void *ulong1, const void *ulong2)

Pointer to a compare function for qsort and qsortX, that can be used when sorting unsigned long integers from large to small.

int(* spr_sort_cmp_float)(const void *float1, const void *float2)

Pointer to a compare function for qsort and qsortX, that can be used when sorting floats from small to large.

Note
Nan's are assumed to be equal to other Nan's and larger than everything else (irrespective of the sign).
int(* spr_sort_rcmp_float)(const void *float1, const void *float2)

Pointer to a compare function for qsort and qsortX, that can be used when sorting floats from large to small.

Note
Nan's are assumed to be equal to other Nan's and larger than everything else (irrespective of the sign).
int(* spr_sort_cmp_double)(const void *double1, const void *double2)

Pointer to a compare function for qsort and qsortX, that can be used when sorting doubles from small to large.

Note
Nan's are assumed to be equal to other Nan's and larger than everything else (irrespective of the sign).
int(* spr_sort_rcmp_double)(const void *double1, const void *double2)

Pointer to a compare function for qsort and qsortX, that can be used when sorting doubles from large to small.

Note
Nan's are assumed to be equal to other Nan's and larger than everything else (irrespective of the sign).
int(* spr_sort_cmp_str)(const void *str1, const void *str2)

Pointer to a compare function for qsort and qsortX, that can be used when sorting string in alphabetical order.

int(* spr_sort_rcmp_str)(const void *str1, const void *str2)

Pointer to a compare function for qsort and qsortX, that can be used when sorting string in reversed alphabetical order.