File: gsort.cat

package info (click to toggle)
scilab 2.4-1
  • links: PTS
  • area: non-free
  • in suites: potato, slink
  • size: 55,196 kB
  • ctags: 38,019
  • sloc: ansic: 231,970; fortran: 148,976; tcl: 7,099; makefile: 4,585; sh: 2,978; csh: 154; cpp: 101; asm: 39; sed: 5
file content (55 lines) | stat: -rw-r--r-- 1,898 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55

gsort(1)                       Scilab Function                       gsort(1)
NAME
  gsort - decreasing order sorting

CALLING SEQUENCE
  [s, [k]]=gsort(v )
  [s, [k]]=gsort(v,flag1)
  [s, [k]]=gsort(v,flag1,flag2)

PARAMETERS

  v,s  : real vector/matrix; character string vector/matrix

  flag1
       : a string 'r', 'c','g','lr' and 'lc'.

  flag2
       : a string 'i' for increasing and 'd' for decreasing order.  k : vec-
       tor or matrix of integers

DESCRIPTION
  gsort is similar to sort with additional properties. The third argument can
  be used to chose between increasing or decreasing order. The second argu-
  ment can be used for lexical orders.

  [s,k]=gsort(a,'g') and [s,k]=gsort(a,'g','d') are  the same as
  [s,k]=gsort(a). They perform a sort of the entries of matrix a, a being
  seen as the stacked vector a(:) (columnwise). [s,k]=gsort(a,'g','i') per-
  forms the same operation but in increasing order.

  [s,k]=gsort(a,'lr') sort the rows of the matrix int(a) ( if a is a real
  matrix) or a (if a is a character string matrix) in lexical decreasing
  order. s is obtained by a permutation of the rows of matrix int(a) (or a)
  given by the column vector k) in such a way that the rows of s verify
  s(i,:) > s(j,:) if i<j. [s,k]=gsort(a,'lr','i') performs the same operation
  for increasing lexical order

  [s,k]=gsort(a,'lc') sort the columns of the matrix int(a) ( if a is a real
  matrix) or a (if a is a character string matrix) in lexical decreasing
  order. s is obtained by a permutation of the columns of matrix int(a) (or
  a) given by the row vector k) in such a way that the columns of s verify
  s(:,i) > s(:,j) if i<j. [s,k]=gsort(a,'lc','i') performs the same operation
  for increasing lexical order

EXAMPLE
  alr=[1,2,2;
       1,2,1;
       1,1,2;
       1,1,1];
  [alr1,k]=gsort(alr,'lr','i')
  [alr1,k]=gsort(alr,'lc','i')

SEE ALSO
  find