next up previous [pdf]

Next: sftransp: Transpose two axes Up: Main programs Previous: sfspray: Extend a dataset

sfstack: Stack a dataset over one of the dimensions.

sfstack < in.rsf > out.rsf scale= axis=2 rms=n norm=y min=n max=n prod=n
This operation is adjoint to sfspray.

int axis=2 which axis to stack
bool max=n [y/n] If y, find maximum instead of stack. Ignores rms and norm.
bool min=n [y/n] If y, find minimum instead of stack. Ignores rms and norm.
bool norm=y [y/n] If y, normalize by fold.
bool prod=n [y/n] If y, find product instead of stack. Ignores rms and norm.
bool rms=n [y/n] If y, compute the root-mean-square instead of stack.
floats scale= optionally scale before stacking [n2]

While sfspray adds a dimension to a hypercube, sfstack effectively removes one of the dimensions by stacking over it. Here are some examples:

bash$ sfmath n1=5 n2=3 output=x1+x2 > test.rsf
bash$ < test.rsf sfdisfil
   0:             0            1            2            3            4
   5:             1            2            3            4            5
  10:             2            3            4            5            6
bash$ < test.rsf sfstack axis=2 | sfdisfil
   0:           1.5            2            3            4            5
bash$ < test.rsf sfstack axis=1 | sfdisfil
   0:           2.5            3            4
Why is the first value not 1 (in the first case) or 2 (in the second case)? By default, sfstack normalizes the stack by the fold (the number of non-zero entries). To avoid normalization, use norm=n, as follows:
bash$ < test.rsf sfstack norm=n | sfdisfil 
   0:             3            6            9           12           15
sfstack can also compute root-mean-square values as well as minimum and maximum values.
bash$ < test.rsf sfstack rms=y | sfdisfil
   0:         1.581         2.16        3.109        4.082        5.066
bash$ < test.rsf sfstack min=y | sfdisfil
   0:             0            1            2            3            4
bash$ < test.rsf sfstack axis=1 max=y | sfdisfil 
   0:             4            5            6


next up previous [pdf]

Next: sftransp: Transpose two axes Up: Main programs Previous: sfspray: Extend a dataset

2012-07-19