The following example shows how the grade down function can be used to sort a
vector in descending order:
The Q Function: Grade Down
The Q symbol is formed by overstriking the Vsymbol and the I symbol.
Monadic (One-Argument) Form: Grade Down Q
Thegrade down function result is the index values that would select the elements
of argument B in descending order. That is, the first element of the result is the
index of the largest element in argument B, the next element is the index of the
next largest element in argument B, and so on. Argument B must be
a numeric
vector. When two or more elements in the vector have the same numeric value,
their position in the vector determines their order in the result (the index value
of the first occurrence appears first in the output). The number of elements in
the result is the same as the number of elements in the argument:
h 4- :I. 4 :I. 2 1. 6 :I. 13 :I. 5 1. :I.
A I:: 9 A
3
1. El 1.0 1.5 1. 4 I. 2 1. :I,
The following example shows how equal elements are handled when using the grade
up and grade down functions:
a4
c-;
Because the indices for the equal elements are 61 the same order (first occurrence
first) for both the grade down and grade up function, the grade down function is
not the inverse of the grade up function:
Note: The result of the Q function depends on the 010 system variable (see Chap-
ter 5 for information on the 010 system variable).
Dyadic (Two-Argument) Form
There is no dyadic form.
8B
Previous Page Next Page