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