sfsort sorts the input by absolute value.
It takes either floating-point or complex input. Here is a quick example:
bash$ sfspike n1=10 | sfnoise rep=y seed=2016 > random.rsf bash$ < random.rsf sfdisfil 0: -0.3485 -0.3108 0.7928 0.01292 -0.5301 5: -0.4556 -0.2901 -0.7167 -1.209 -0.2871 bash$ < random.rsf sfsort | sfdisfil 0: 1.209 0.7928 0.7167 0.5301 0.4556 5: 0.3485 0.3108 0.2901 0.2871 0.01292
To sort in reverse (ascending) order, use ascmode=y:
bash$ < random.rsf sfsort ascmode=y | sfdisfil 0: 0.01292 0.2871 0.2901 0.3108 0.3485 5: 0.4556 0.5301 0.7167 0.7928 1.209
sfsort tries to perform sorting in memory but, if the input is too large, it switches to slower out-of-core operations. To control the amount of available memory, use memsize= parameter.
If the input is multidimensional, and you want to sort data only up to a certain dimension, use dim= parameter. In the following example, each of the two rows is sorted independently:
bash$ < random.rsf sfput n1=5 n2=2 | sfsort dim=1 | sfdisfil 0: 0.7928 0.5301 0.3485 0.3108 0.01292 5: 1.209 0.7167 0.4556 0.2901 0.2871
sfsort was contributed to Madagascar by Gilles Hennenfent and Henryk Modzelewski from SLIM, UBC. They provide the following test example in slim/slimUserManual/sfsort:
code
more code
~~~~