PetscRealSortSemiOrdered — PETSc 3.22.5 documentation

Skip to main content
`Ctrl`+`K`

# PetscRealSortSemiOrdered

Sorts an array of `PetscReal` in place in increasing order.

## Synopsis

    #include "petscsys.h"
    PetscErrorCode PetscRealSortSemiOrdered(PetscInt n, PetscReal arr[])

Not Collective

## Input Parameters

- n - number of values

- arr - array of `PetscReal`

## Output Parameter

- arr - sorted array of integers

## Notes

If the array is less than 64 entries long `PetscSortReal()` is automatically used.

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

## See Also

`PetscTimSort()`, `PetscSortReal()`, `PetscSortRealWithPermutation()`

## 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