Singular Manual: sortIntvec

| ##### 7.8.5.0. sortIntvec Procedure from library `dmodapp.lib` (see dmodapp_lib). Usage: sortIntvec(v); v an intvec Return: list of two intvecs Purpose: sorts an intvec Note: In the output list L, the first entry consists of the entries of v satisfying L[1][i] >= L[1][i+1]. The second entry is a permutation such that v[L[2]] = L[1]. Unlike in the procedure `sort`, zeros are not dismissed. Example:
    LIB "dmodapp.lib";
    ring r = 0,x,dp;
    intvec v = -1,0,1,-2,0,2;
    list L = sortIntvec(v); L;
    ==> [1]:
    ==>    2,1,0,0,-1,-2
    ==> [2]:
    ==>    6,3,2,5,1,4
    v[L[2]];
    ==> 2 1 0 0 -1 -2
    v = -3,0;
    sortIntvec(v);
    ==> [1]:
    ==>    0,-3
    ==> [2]:
    ==>    2,1
    v = 0,-3;
    sortIntvec(v);
    ==> [1]:
    ==>    0,-3
    ==> [2]:
    ==>    1,2
See also: sort.

User manual for Singular version 4-1-1p4, 2018, generated by texi2html.