Forms new matrices by adding up matrices from a file.
summats filename selection
filename is the file containing the matrices to be added. selection is a list (which can include ranges) of the numbers of the matrices to be added in the file. 0 has a special significance - it refers to a matrix whose off diagonal elements are all 1 (and whose diagonal elements are chosen to make the rows sum to 0). 0 cannot be the only element in selection or subtractionselection. subtractionselection is another optional list of matrices, which are subtracted from the result of adding the matrices in selection.
The resulting matrix is printed to standard output. It can be saved by redirecting standard output to a file. (Cutting and pasting is also possible, provided your screen is wide enough.)
summats matrices 0,3,5-9
prints the sum of the matrices numbered 3,5,6,7,8,9 and the matrix all of whose off-diagonal entries are 1, from the file matrices.
summats matrices 1,2,4 9-36
prints the sum of the matrices numbered 1,2 and 4 minus the sum of all the matrices from 9 to 36 (inclusive) in the file matrices.
summats matrices 0,5 5,1,3,8
prints the result of subtracting the sum of matrices 1,3 and 8 from the matrix all of whose off-diagonal elements are 1.
[Bug: summats ignores the first matrix in the input file. This is useful for parameter matrix files, where the line that gives the number of matrices in the file is interpreted as a matrix.]