ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/doc/man/man1/total.1
Revision: 1.9
Committed: Thu Mar 24 18:48:28 2016 UTC (9 years, 1 month ago) by greg
Branch: MAIN
Changes since 1.8: +13 -1 lines
Log Message:
Added -in options to commands for manual EOF specification

File Contents

# Content
1 .\" RCSid "$Id: total.1,v 1.8 2013/09/05 17:53:22 greg Exp $"
2 .TH TOTAL 1 2/3/95 RADIANCE
3 .SH NAME
4 total - sum up columns
5 .SH SYNOPSIS
6 .B total
7 [
8 .B \-m
9 ][
10 .B \-sE
11 |
12 .B \-p
13 |
14 .B \-u
15 |
16 .B \-l
17 ][
18 .B \-i{f|d}[N]
19 ][
20 .B \-o{f|d}
21 ][
22 .B "\-in M"
23 ][
24 .B "\-on M"
25 ][
26 .B \-tC
27 ][
28 .B \-N
29 [
30 .B \-r
31 ]]
32 [
33 file ..
34 ]
35 .SH DESCRIPTION
36 .I Total
37 sums up columns of real numbers from one or more files
38 and prints out the result on its standard output.
39 .PP
40 By default,
41 .I total
42 computes the straigt sum of each input column, but multiplication
43 can be specified instead with the
44 .I \-p
45 option.
46 Likewise, the
47 .I \-u
48 option means find the upper limit (maximum), and
49 .I \-l
50 means find the lower limit (minimum).
51 .PP
52 Sums of powers can be computed by giving an exponent with the
53 .I \-s
54 option.
55 (Note that there is no space between the
56 .I \-s
57 and the exponent.)
58 This exponent can be any real number, positive or negative.
59 The absolute value of the input is always taken before the
60 power is computed in order to avoid complex results.
61 Thus,
62 .I \-s1
63 will produce a sum of absolute values.
64 The default power (zero) is interpreted as a straight sum without
65 taking absolute values.
66 .PP
67 The
68 .I \-m
69 option can be used to compute the mean rather than the total.
70 For sums, the arithmetic mean is computed.
71 For products, the geometric mean is computed.
72 (A logarithmic sum of absolute values is used to avoid overflow, and
73 zero values are silently ignored.)
74 .PP
75 If the input data is binary, the
76 .I \-id
77 or
78 .I \-if
79 option may be given for 64-bit double or 32-bit float values, respectively.
80 Either option may be followed immediately by an optional
81 count, which defaults to 1, indicating the number of double or float
82 binary values to read per record on the input file.
83 (There can be no space between the option and this count.)\0
84 Similarly, the
85 .I \-od
86 and
87 .I \-of
88 options specify binary double or float output, respectively.
89 These options do not need a count, as this will be determined by the
90 number of input channels.
91 .PP
92 A count can be given as the number of lines to read before
93 computing a result.
94 Normally,
95 .I total
96 reads each file to its end before producing its result,
97 but this behavior may be overridden by inserting blank lines in
98 the input.
99 For each blank input line, total produces a result as if the
100 end-of-file had been reached.
101 If two blank lines immediately follow each other, total closes
102 the file and proceeds to the next one (after reporting the result).
103 The
104 .I \-N
105 option (where N is a decimal integer) tells
106 .I total
107 to produce a result and reset the calculation after
108 every N input lines.
109 In addition, the
110 .I \-r
111 option can be specified to override reinitialization and thus
112 give a running total every N lines (or every blank line).
113 If the end of file is reached, the current total is printed
114 and the calculation is reset before the next file (with or without the
115 .I \-r
116 option).
117 .PP
118 The
119 .I \-in
120 option if present, will limit the number of input records read
121 (per input file).
122 The
123 .I \-on
124 option may be used to limit the total number of outut records produced.
125 .PP
126 The
127 .I \-tC
128 option can be used to specify the input and output tab character.
129 The default tab character is TAB.
130 .PP
131 If no files are given, the standard input is read.
132 .SH EXAMPLE
133 To compute the RMS value of colon-separated columns in a file:
134 .IP "" .2i
135 total \-t: \-m \-s2 input
136 .PP
137 To produce a running product of values from a file:
138 .IP "" .2i
139 total \-p \-1 \-r input
140 .SH BUGS
141 If the input files have varying numbers of columns, mean values
142 will certainly be off.
143 .I Total
144 will ignore missing column entries if the tab separator is a non-white
145 character, but cannot tell where a missing column should have been if
146 the tab character is white.
147 .SH AUTHOR
148 Greg Ward
149 .SH "SEE ALSO"
150 cnt(1), neaten(1), rcalc(1), rcollate(1), rlam(1), tabfunc(1)