zmu - Multiply

See also:
zpt - Paste

Command Line

zmu [Options] [-r Row[/NRows]] [-c Col[/NCols]] A B Result 

Options
Standard options, see Standard Command Line Options
-r Row[/NRows]
Divide the matrix A horizontally into NRows slices (default: 2) and use the Row-th slice as the left factor. NRows must not be larger than the number of rows of A.
-c Col[/NCols]
Divide the matrix B vertically into NCols slices (default: 2) and use the Col-th slice as right factor. NCols must not be larger than the number of columns of B.
A
Left factor.
B
Right factor.
Result
Product.

Input Files

A
Left factor.
B
Right factor.

Output Files

Result
Product.

Description

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:

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.

Blockwise Matrix Multiplication

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.

MeatAxe 2.4 documentation, generated on Tue May 12 01:29:54 2009