PartMC  2.6.1
Functions
sort.c File Reference

Wrapper routines for C qsort. More...

Include dependency graph for sort.c:

Go to the source code of this file.

Functions

int pair_compare (const void *a, const void *b)
 Helper function for integer_sort_c() More...
 
int integer_sort_c (int n, int *data, int *perm)
 Sort the given data array and return the permutation. More...
 

Detailed Description

Wrapper routines for C qsort.

Definition in file sort.c.

Function Documentation

◆ integer_sort_c()

int integer_sort_c ( int  n,
int *  data,
int *  perm 
)

Sort the given data array and return the permutation.

On return the data array is sorted and the perm array contains the permutation, so that new_data[i] = data[perm[i]], where data is the original data and new_data is the sorted data.

Parameters
nThe length of data and perm.
dataThe data array (sorted on return).
permThe permutation on return: new_data[i] = data[perm[i]].

Definition at line 40 of file sort.c.

◆ pair_compare()

int pair_compare ( const void *  a,
const void *  b 
)

Helper function for integer_sort_c()

Definition at line 14 of file sort.c.