next up previous contents index
Next: sus2plot Up: sus2text Previous: Filtering.   Contents   Index

Conversion and Addition of Data.

The option --add=<label>=<expression> adds a data entry with label <label> and value <expression> to each row.

$\Rightarrow$ Tutorial 26:
(1) Add an additional label superior to each row indicating whether (1) or not (0) the selection sort algorithm (T0) is faster than the insertion sort algorithm (T1). (2) Same as (1) but use an iff(exp, then, else) to indicate the superiority with yes or no. (3) Compute the difference diff in running time between T0 and T1. Hint: Since all values in a sus file are interpreted as strings you will have to convert them to a number type, e.g., float, before arithmetic operations can be used. (4) Use the built-in string formatting to format diff such that the output is an absolute value of (3) width 6 rounded up after the first decimal place.

Solution:

(1) sus2text superior='float(T0)<float(T1)' n T0 T1 type < out.sus
(2) sus2text 'superior=iff(float(T0)<float(T1),"yes","no")'
                            n T0 T1 type < out.sus

(3) sus2text 'diff=float(T0)-float(T1)' n T0 T1 type < out.sus
(4) sus2text --add 'diff="%6.1f"%abs(float(T0)-float(T1))'
                            n T0 T1 type < out.sus

The --add in the last line is not necessary. It's just to show a variation.


next up previous contents index
Next: sus2plot Up: sus2text Previous: Filtering.   Contents   Index
Tobias Polzin 2002-11-18