| 1 |
.\" RCSid "$Id: rcollate.1,v 1.9 2019/11/08 02:10:38 greg Exp $"
|
| 2 |
.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[io]
|
| 9 |
][
|
| 10 |
.B \-w
|
| 11 |
][
|
| 12 |
.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 |
.B "\-o RxC[xR1xC2..]"
|
| 25 |
]
|
| 26 |
[
|
| 27 |
.B input.dat
|
| 28 |
]
|
| 29 |
.SH DESCRIPTION
|
| 30 |
.I Rcollate
|
| 31 |
reads in a single matrix file (table) and reshapes it to have
|
| 32 |
the number of columns specified by the
|
| 33 |
.I \-oc
|
| 34 |
option.
|
| 35 |
The number of rows may be specified with a
|
| 36 |
.I \-or
|
| 37 |
option, or may be determined automatically from the size of the input if
|
| 38 |
it is an even multiple of the number of columns (as it should be).
|
| 39 |
Alternatively, both may be specified using a
|
| 40 |
.I \-o
|
| 41 |
option with the number of rows and columns separated by an 'x', as in "30x14"
|
| 42 |
for 30 rows by 14 columns.
|
| 43 |
.I Rcollate
|
| 44 |
can also reorder the input into nested blocks by continuing the output size
|
| 45 |
string, "3x10X7x2" would order output data with a 3x10 super-array of 7x2
|
| 46 |
subblocks.
|
| 47 |
This is a convenient way to visualize tensor data.
|
| 48 |
.PP
|
| 49 |
By default, the file is assumed to include an information header, which
|
| 50 |
is copied to the standard output along with the command name.
|
| 51 |
The
|
| 52 |
.I \-hi
|
| 53 |
option may be used to turn off the expectation of a header on input.
|
| 54 |
The
|
| 55 |
.I \-ho
|
| 56 |
option turns off header output, and
|
| 57 |
.I \-h
|
| 58 |
by itself turns off both input and output headers.
|
| 59 |
The
|
| 60 |
.I \-w
|
| 61 |
option turns off non-fatal warning messages, such as unexpected EOD.
|
| 62 |
.PP
|
| 63 |
The input format is assumed to be ASCII, with three white-space separated words
|
| 64 |
(typically numbers) in each record.
|
| 65 |
A different input format may be specified with the
|
| 66 |
.I \-f
|
| 67 |
option.
|
| 68 |
The suboptions are
|
| 69 |
.I \-fa,
|
| 70 |
.I \-ff,
|
| 71 |
.I \-fd,
|
| 72 |
and
|
| 73 |
.I \-fb
|
| 74 |
for ASCII, float, double, and binary, respectively.
|
| 75 |
An optional count may be attached to specify the number of data elements per
|
| 76 |
record, which defaults to 1.
|
| 77 |
Thus, the default setting is
|
| 78 |
.I \-fa3.
|
| 79 |
Since
|
| 80 |
.I rcollate
|
| 81 |
does not interpret the fields, all binary options of the same
|
| 82 |
length have the same result.
|
| 83 |
On most architectures,
|
| 84 |
.I \-ff6,
|
| 85 |
.I \-fd3,
|
| 86 |
and
|
| 87 |
.I \-fb24
|
| 88 |
would all be equivalent.
|
| 89 |
Note that the lack of row separators in binary files means that
|
| 90 |
.I rcollate
|
| 91 |
does not actually do anything for binary files unless the transpose
|
| 92 |
option is given, also.
|
| 93 |
.PP
|
| 94 |
If an input header is present, it may contain the format, number of components
|
| 95 |
and matrix dimensions.
|
| 96 |
In such cases, the
|
| 97 |
.I \-ic,
|
| 98 |
.I \-ir
|
| 99 |
and
|
| 100 |
.I \-f
|
| 101 |
options are not required, but will be checked against the header
|
| 102 |
information if provided.
|
| 103 |
.PP
|
| 104 |
The transpose option,
|
| 105 |
.I \-t
|
| 106 |
swaps rows and columns on the input.
|
| 107 |
For binary files, the user must specify at least one input or output
|
| 108 |
dimension to define the matrix size.
|
| 109 |
For ASCII files,
|
| 110 |
.I rcollate
|
| 111 |
will automatically determine the number of columns based on the
|
| 112 |
position of the first EOL (end-of-line) character, and the number
|
| 113 |
of rows based on the total count of records in the file.
|
| 114 |
The user may override these determinations, allowing the matrix to
|
| 115 |
be resized as well as transposed.
|
| 116 |
If input and output dimensions are given, the number of input rows
|
| 117 |
must equal the number of output columns,
|
| 118 |
and the number of input columns must equal the number of output rows.
|
| 119 |
For large transpose operations on Unix systems, it is most efficient
|
| 120 |
to specify the input file on the command line, rather than reading
|
| 121 |
from the standard input, since
|
| 122 |
.I rcollate
|
| 123 |
can map the file directly into virtual memory.
|
| 124 |
If the
|
| 125 |
.I \-o
|
| 126 |
option is also given with multiple block levels, the transpose operation
|
| 127 |
will logically precede the reblocking operation.
|
| 128 |
.SH EXAMPLES
|
| 129 |
To change put 8760 color triplets per row in a matrix with no header:
|
| 130 |
.IP "" .2i
|
| 131 |
rcollate -h \-oc 8760 input.dat > col8760.dat
|
| 132 |
.PP
|
| 133 |
To transpose a binary file with 145 float triplets per input row:
|
| 134 |
.IP "" .2i
|
| 135 |
rcollate -ff3 -ic 145 -t orig.flt > transpose.flt
|
| 136 |
.PP
|
| 137 |
To create an appropriate header for a binary float matrix as required by
|
| 138 |
.I rmtxop(1)\:
|
| 139 |
.IP "" .2i
|
| 140 |
rcollate -hi -ff3 -or 145 -oc 8760 input.smx | rmtxop dcoef.dmx - > res.txt
|
| 141 |
.PP
|
| 142 |
To visualize a Shirley-Chiu BTDF matrix where the interior resolution is
|
| 143 |
64x64 and the exterior resolution is 32x32:
|
| 144 |
.IP "" .2i
|
| 145 |
rcollate -o 64x64X32x32 s-c_bsdf.mtx | rmtxop -fc - > s-c_bsdf.hdr
|
| 146 |
.SH AUTHOR
|
| 147 |
Greg Ward
|
| 148 |
.SH NOTES
|
| 149 |
The
|
| 150 |
.I rcollate
|
| 151 |
command is rather inflexible when it comes to output field and record
|
| 152 |
separators for ASCII data.
|
| 153 |
It accepts any amount of white space between fields
|
| 154 |
on input, but only produces spaces as field separators
|
| 155 |
between words and tabs as record separators on output.
|
| 156 |
Output row separtors will always be an EOL, which may differ between systems.
|
| 157 |
.PP
|
| 158 |
If no options are given on the command line, or a binary file is specified
|
| 159 |
without a transpose,
|
| 160 |
.I rcollate
|
| 161 |
issues a warning and simply copies its input to its standard output.
|
| 162 |
.SH "SEE ALSO"
|
| 163 |
cnt(1), histo(1), neaten(1), rcalc(1), rlam(1), rmtxop(1),
|
| 164 |
rsplit(1), tabfunc(1), total(1)
|