next up previous [pdf]

Next: Transforms Up: Utilities Previous: sfthr: Threshold float/complex inputs

sfsort: Sort a float/complex vector by absolute values.

sfsort < in.rsf > out.rsf memsize=sf_memsize() ascmode=n dim=dim
Written by: Gilles Hennenfent & Henryk Modzelewski, UBC
Created: February 2006

bool ascmode=n [y/n] y=ascending; n=descending
int dim=dim maximum dimension
int memsize=sf_memsize() Max amount of RAM (in Mb) to be used

sfsort is useful for sorting Madagascar vectors either in ascending or descending order with respect to their amplitudes. The sorting is done using qsort from stdlib.h. This function is an implementation of the quicksort algorithm. sfsort has two modes: 1) in-core if the user-specified memsize is big enough to load the full dataset in memory and sort it, and else 2) out-of-core. In the latter case, we implemented a divide and conquer approach. The large dataset is first divided into pieces that fit in memory. These pieces are sorted and written to disk in temporary files. The second step is a merge process of the temporary files.

datasort incore outofcore
datasort,incore,outofcore
Figure 3.
Sorting example.
[pdf] [pdf] [pdf] [png] [png] [png] [scons]


next up previous [pdf]

Next: Transforms Up: Utilities Previous: sfthr: Threshold float/complex inputs

2016-02-16