petsc-main 2021-04-20
Report Typos and Errors


Sorts an array of PetscReals in place in increasing order and reorders a second array of PetscInts to match the first.


#include "petscsys.h"  
PetscErrorCode PetscRealSortSemiOrderedWithArrayInt(PetscInt n, PetscReal arr1[], PetscInt arr2[])
Not Collective

Input Parameters

n - number of values
arr1 - array of PetscReals to be sorted
arr2 - array of PetscReals to be reordered

Output Parameters

arr1 - sorted array of PetscReals
arr2 - reordered array of PetscInts


If the array to be sorted is less than 64 entries long PetscSortRealWithArrayInt() is automatically used.

This function serves as an alternative to PetscSortRealWithArray(). While this function works for any array of PetscReals it is significantly faster if the array is not totally random. There are exceptions to this and so it is __highly__ recomended that the user benchmark their code to see which routine is fastest.

See Also

PetscTimSortWithArray(), PetscSortRealWithArrayInt(), PetscSortRealWithPermutation()




Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages