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