Home Online Manual
Top
Back: isInt
Forward: dmodideal_lib
FastBack:
FastForward:
Up: dmodapp_lib
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document
7.5.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.