petsc-3.14.6 2021-03-30
Report Typos and Errors

PetscIntSortSemiOrderedWithArray

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

Synopsis

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

Input Parameters

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

Output Parameters

arr1 - sorted array of integers
arr2 - reordered array of integers

Notes

The arrays CANNOT overlap.

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

This function serves as an alternative to PetscSortIntWithArray(). While this function works for any array of integers 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(), PetscSortIntWithArray(), PetscSortIntWithPermutation()

Level

intermediate

Location

src/sys/utils/sortso.c
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages