slepc-3.21.2 2024-09-25
Report Typos and Errors

# DSSort

Sorts the result of DSSolve() according to a given sorting criterion.

### Synopsis

    #include "slepcds.h"
    PetscErrorCode DSSort(DS ds,PetscScalar *eigr,PetscScalar *eigi,PetscScalar *rr,PetscScalar *ri,PetscInt *k)

Logically Collective

### Input Parameters

| ds | - the direct solver context
| rr | - (optional) array containing auxiliary values (real part)
| ri | - (optional) array containing auxiliary values (imaginary part)

### Input/Output Parameters

| eigr | - array containing the computed eigenvalues (real part)
| eigi | - array containing the computed eigenvalues (imaginary part)
| k | - (optional) number of elements in the leading group

### Notes

This routine sorts the arrays provided in eigr and eigi, and also sorts the dense system stored inside ds (assumed to be in condensed form). The sorting criterion is specified with DSSetSlepcSC().

If arrays rr and ri are provided, then a (partial) reordering based on these values rather than on the eigenvalues is performed. In symmetric problems a total order is obtained (parameter k is ignored), but otherwise the result is sorted only partially. In this latter case, it is only guaranteed that all the first k elements satisfy the comparison with any of the last n-k elements. The output value of parameter k is the final number of elements in the first set.

### See Also

DSSolve(), DSSetSlepcSC(), DSSortWithPermutation()

### Level

intermediate

### Location

src/sys/classes/ds/interface/dsops.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages