MeatAxe
2.4
|
zmu [Options] [-r Row[/NRows]] [-c Col[/NCols]] A B Result
This program reads two matrices or permutations and writes their product to Result.
The input files must contain two compatible objects, i.e., their product must be defined. Currently, zmu can handle the following data types:
| 1 1 | | 2 2 | (1 2 3) * | 2 2 | = | 3 3 | | 3 3 | | 1 1 |
With these conventions, products between matrices and permutations are defined in a consistent way. The associative law a(bc)=(ab)c holds whenever ab and bc are defined (a,b,c being matrices or permutations). A permutation matrix created with zcv or zcf, if multiplied with another matrix, produces the same result as the original permutation.
In the case of two matrices, a blockwise multiplication can be performed using the "-r" and "-c" options. If one or both of these options are specified on the command line, zmu will read only some rows of A and/or some columns of B. Multiplying the two pieces together yields a rectangular piece of the result. By default the result is divided into 4 pieces of (almost) equal size. To calculate the 4 pieces successively, type
zmu -r 1 -c 1 m1 m2 tmp11 zmu -r 1 -c 2 m1 m2 tmp12 zmu -r 2 -c 1 m1 m2 tmp21 zmu -r 2 -c 2 m1 m2 tmp22
The resulting matrices ‘tmpXX’ can then be pasted together using zpt:
zpt -R 2 -C 2 result tmp
This procedure can be used in a multi-processor environment where each piece of the result is computed on a separate machine.
By adding an additional parameter to "-r" and/or "-c" you can control the number of vertical or horizontal slices. For example,
zmu -r 3/5
means to cut A horizontally into five slices and use the third slice for multiplication. The number of slice must not be greater than the number of rows.