Skip to main content
`Ctrl`+`K`

# DSSort

Sort 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

DS: Direct Solver (or Dense System), `DSSolve()`, `DSSetSlepcSC()`, `DSSortWithPermutation()`

## Level

intermediate

## Location

src/sys/classes/ds/interface/dsops.c

## Implementations

DSSort_GHEP() in src/sys/classes/ds/impls/ghep/dsghep.c
DSSort_GHIEP() in src/sys/classes/ds/impls/ghiep/dsghiep.c
DSSort_GNHEP() in src/sys/classes/ds/impls/gnhep/dsgnhep.c
DSSort_GSVD() in src/sys/classes/ds/impls/gsvd/dsgsvd.c
DSSort_HEP() in src/sys/classes/ds/impls/hep/dshep.c
DSSort_HSVD() in src/sys/classes/ds/impls/hsvd/dshsvd.c
DSSort_NEP() in src/sys/classes/ds/impls/nep/dsnep.c
DSSort_NHEP() in src/sys/classes/ds/impls/nhep/dsnhep.c
DSSort_NHEPTS() in src/sys/classes/ds/impls/nhepts/dsnhepts.c
DSSort_PEP() in src/sys/classes/ds/impls/pep/dspep.c
DSSort_SVD() in src/sys/classes/ds/impls/svd/dssvd.c

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