| 96 |
|
to the same input matrix. |
| 97 |
|
.PP |
| 98 |
|
If present, the second and subsequent matrices on the command |
| 99 |
< |
line are concatenated to the result, unless separated by a plus ('+'), |
| 99 |
> |
line are concatenated together, unless separated by a plus ('+'), |
| 100 |
|
asterisk ('*'), or forward slash ('/') symbol, |
| 101 |
|
in which case the individual matrix elements are added, |
| 102 |
< |
multiplied, or divided together, respectively. |
| 103 |
< |
(Note that the asterisk must be quoted or escaped in most shells.)\0 |
| 102 |
> |
multiplied, or divided, respectively. |
| 103 |
> |
The concatenation operator ('.') is the default and need not be specified. |
| 104 |
> |
Note also that the asterisk must be quoted or escaped in most shells. |
| 105 |
|
In the case of addition, the two matrices involved must have the same number |
| 106 |
|
of components. |
| 107 |
|
If subtraction is desired, use addition ('+') with a scaling parameter of -1 |
| 115 |
|
matrix will result in a warning and the corresponding component(s) in the |
| 116 |
|
first matrix will be set to zero. |
| 117 |
|
.PP |
| 118 |
+ |
Evaluation proceeds from left to right, and all operations have |
| 119 |
+ |
the same precedence. |
| 120 |
+ |
If a different evaluation order is desired, pipe the result of one |
| 121 |
+ |
.I rmtxop |
| 122 |
+ |
command into another, as shown in one of the examples below. |
| 123 |
+ |
.PP |
| 124 |
|
The number of components in the new matrix after applying any |
| 125 |
|
.I -c |
| 126 |
|
transform must agree with the prior result. |
| 166 |
|
.IP "" .2i |
| 167 |
|
rmtxop -fc blinds.xml > blinds.hdr |
| 168 |
|
.PP |
| 169 |
+ |
To extract the luminance values from a picture as an ASCII matrix: |
| 170 |
+ |
.IP "" .2i |
| 171 |
+ |
rmtxop -fa -c .265 .670 .065 image.hdr > image_lum.mtx |
| 172 |
+ |
.PP |
| 173 |
|
To scale a matrix by 4 and add it to the transpose of another matrix: |
| 174 |
|
.IP "" .2i |
| 175 |
< |
rmtxop -s 4 left.mtx + -t right.mtx > result.mtx |
| 175 |
> |
rmtxop -s 4 first.mtx + -t second.mtx > result.mtx |
| 176 |
|
.PP |
| 177 |
+ |
To multiply elements of two matrices, then concatenate with a third, |
| 178 |
+ |
applying a final transpose to the result: |
| 179 |
+ |
.IP "" .2i |
| 180 |
+ |
rmtxop first.mtx \\* second.mtx . third.mtx -t > result.mtx |
| 181 |
+ |
.PP |
| 182 |
|
To left-multiply the element-wise division of two matrices: |
| 183 |
|
.IP "" .2i |
| 184 |
|
rmtxop -fd numerator.mtx / denominator.mtx | rmtxop left.mtx - > result.mtx |
| 189 |
|
.IP "" .2i |
| 190 |
|
rmtxop -fa orig.mtx | rcollate -ho -oc 1 | rcalc [operations] |
| 191 |
|
.SH NOTES |
| 192 |
< |
Matrix multiplication is associative but not commutative, so order |
| 192 |
> |
Matrix concatenation is associative but not commutative, so order |
| 193 |
|
matters to the result. |
| 194 |
|
.I Rmtxop |
| 195 |
< |
takes advantage of the associative property to evaluate the |
| 196 |
< |
implicit equation from right to left when this reduces the |
| 181 |
< |
number of basic operations. |
| 195 |
> |
takes advantage of this associative property to concatenate |
| 196 |
> |
from right to left when it reduces the number of basic operations. |
| 197 |
|
If the rightmost matrix is a column vector for example, it is |
| 198 |
< |
much faster to concatenate from the right, and the result should |
| 198 |
> |
much faster to concatenate from the right, and the result will |
| 199 |
|
be the same. |
| 200 |
< |
This only applies to matrix multiplication. |
| 201 |
< |
Element-wise addition, multiplication, and division are still |
| 200 |
> |
Note that this only applies to concatenation; |
| 201 |
> |
element-wise addition, multiplication, and division are always |
| 202 |
|
evaluated from left to right. |
| 203 |
|
.SH AUTHOR |
| 204 |
|
Greg Ward |