| 1 |
greg |
1.5 |
.\" RCSid "$Id: rcollate.1,v 1.4 2013/09/18 21:24:36 greg Exp $"
|
| 2 |
greg |
1.1 |
.TH RCOLLATE 1 7/8/97 RADIANCE
|
| 3 |
|
|
.SH NAME
|
| 4 |
|
|
rcollate - resize or transpose matrix data
|
| 5 |
|
|
.SH SYNOPSIS
|
| 6 |
|
|
.B rcollate
|
| 7 |
|
|
[
|
| 8 |
|
|
.B \-h
|
| 9 |
|
|
][
|
| 10 |
greg |
1.3 |
.B \-w
|
| 11 |
|
|
][
|
| 12 |
greg |
1.1 |
.B \-f[afdb][N]]
|
| 13 |
|
|
][
|
| 14 |
|
|
.B \-t
|
| 15 |
|
|
][
|
| 16 |
|
|
.B "\-ic in_col"
|
| 17 |
|
|
][
|
| 18 |
|
|
.B "\-ir in_row"
|
| 19 |
|
|
][
|
| 20 |
|
|
.B "\-oc out_col"
|
| 21 |
|
|
][
|
| 22 |
|
|
.B "\-or out_row"
|
| 23 |
|
|
]
|
| 24 |
|
|
[
|
| 25 |
|
|
.B input.dat
|
| 26 |
|
|
]
|
| 27 |
|
|
.SH DESCRIPTION
|
| 28 |
|
|
.I Rcollate
|
| 29 |
|
|
reads in a single matrix file (table) and reshapes it to have
|
| 30 |
|
|
the number of columns specified by the
|
| 31 |
|
|
.I \-oc
|
| 32 |
|
|
option.
|
| 33 |
|
|
By default, the file is assumed to include an information header, which
|
| 34 |
|
|
is copied to the standard output along with the command name, but the
|
| 35 |
|
|
.I \-h
|
| 36 |
|
|
option may be used to turn this behavior off.
|
| 37 |
greg |
1.3 |
The
|
| 38 |
|
|
.I \-w
|
| 39 |
|
|
option turns off non-fatal warning messages, such as unexpected EOD.
|
| 40 |
greg |
1.1 |
.PP
|
| 41 |
|
|
The input format is assumed to be ASCII, with three white-space separated words
|
| 42 |
|
|
(typically numbers) in each record.
|
| 43 |
|
|
A different input format may be specified with the
|
| 44 |
|
|
.I \-f
|
| 45 |
|
|
option.
|
| 46 |
|
|
The suboptions are
|
| 47 |
|
|
.I \-fa,
|
| 48 |
|
|
.I \-ff,
|
| 49 |
|
|
.I \-fd,
|
| 50 |
|
|
and
|
| 51 |
|
|
.I \-fb
|
| 52 |
|
|
for ASCII, float, double, and binary, respectively.
|
| 53 |
|
|
An optional count may be attached to specify the number of data elements per
|
| 54 |
|
|
record, which defaults to 1.
|
| 55 |
|
|
Thus, the default setting is
|
| 56 |
|
|
.I \-fa3.
|
| 57 |
|
|
Since
|
| 58 |
|
|
.I rcollate
|
| 59 |
|
|
does not interpret the fields, all binary options of the same
|
| 60 |
|
|
length have the same result.
|
| 61 |
|
|
On most architectures,
|
| 62 |
|
|
.I \-ff6,
|
| 63 |
|
|
.I \-fd3,
|
| 64 |
|
|
and
|
| 65 |
|
|
.I \-fb24
|
| 66 |
|
|
would all be equivalent.
|
| 67 |
greg |
1.2 |
Note that the lack of row separators in binary files means that
|
| 68 |
greg |
1.1 |
.I rcollate
|
| 69 |
|
|
does not actually do anything for binary files unless the transpose
|
| 70 |
|
|
option is given, also.
|
| 71 |
|
|
.PP
|
| 72 |
greg |
1.5 |
If an input header is present, it may contain the format, number of components
|
| 73 |
|
|
and matrix dimensions.
|
| 74 |
|
|
In such cases, the
|
| 75 |
|
|
.I \-ic,
|
| 76 |
|
|
.I \-ir
|
| 77 |
|
|
and
|
| 78 |
|
|
.I \-f
|
| 79 |
|
|
options are not required, but will be checked against the header
|
| 80 |
|
|
information if provided.
|
| 81 |
|
|
.PP
|
| 82 |
greg |
1.1 |
The transpose option,
|
| 83 |
|
|
.I \-t
|
| 84 |
|
|
swaps rows and columns on the input.
|
| 85 |
|
|
For binary files, the user must specify at least one input or output
|
| 86 |
|
|
dimension to define the matrix size.
|
| 87 |
|
|
For ASCII files,
|
| 88 |
|
|
.I rcollate
|
| 89 |
|
|
will automatically determine the number of columns based on the
|
| 90 |
|
|
position of the first EOL (end-of-line) character, and the number
|
| 91 |
greg |
1.2 |
of rows based on the total count of records in the file.
|
| 92 |
greg |
1.1 |
The user may override these determinations, allowing the matrix to
|
| 93 |
|
|
be resized as well as transposed.
|
| 94 |
|
|
If input and output dimensions are given, the number of input rows
|
| 95 |
|
|
must equal the number of output columns,
|
| 96 |
greg |
1.2 |
and the number of input columns must equal the number of output rows.
|
| 97 |
|
|
For large transpose operations on Unix systems, it is most efficient
|
| 98 |
greg |
1.1 |
to specify the input file on the command line, rather than reading
|
| 99 |
|
|
from the standard input, since
|
| 100 |
|
|
.I rcollate
|
| 101 |
greg |
1.4 |
can map the file directly into virtual memory.
|
| 102 |
greg |
1.1 |
.SH EXAMPLE
|
| 103 |
|
|
To change put 8760 color triplets per row in a matrix with no header:
|
| 104 |
|
|
.IP "" .2i
|
| 105 |
|
|
rcollate -h \-oc 8760 input.dat > col8760.dat
|
| 106 |
|
|
.PP
|
| 107 |
|
|
To transpose a binary file with 145 float triplets per input row:
|
| 108 |
|
|
.IP "" .2i
|
| 109 |
|
|
rcollate -ff3 -ic 145 -t orig.flt > transpose.flt
|
| 110 |
|
|
.SH AUTHOR
|
| 111 |
|
|
Greg Ward
|
| 112 |
|
|
.SH NOTES
|
| 113 |
|
|
The
|
| 114 |
|
|
.I rcollate
|
| 115 |
|
|
command is rather inflexible when it comes to output field and record
|
| 116 |
|
|
separators for ASCII data.
|
| 117 |
greg |
1.2 |
It accepts any amount of white space between fields
|
| 118 |
greg |
1.1 |
on input, but only produces spaces as field separators
|
| 119 |
greg |
1.2 |
between words and tabs as record separators on output.
|
| 120 |
greg |
1.1 |
Output row separtors will always be an EOL, which may differ between systems.
|
| 121 |
|
|
.PP
|
| 122 |
|
|
If no options are given on the command line, or a binary file is specified
|
| 123 |
|
|
without a transpose,
|
| 124 |
|
|
.I rcollate
|
| 125 |
greg |
1.2 |
issues a warning and simply copies its input to its standard output.
|
| 126 |
greg |
1.1 |
.SH "SEE ALSO"
|
| 127 |
|
|
cnt(1), histo(1), neaten(1), rcalc(1), rlam(1), tabfunc(1), total(1)
|