Chapter 3: Matrix Operations
Special Operations to Facilitate Matrix and Vector Arithmetic
These operations assume that rectangular matrices are recorded as groups of auxiliary variables,
the rows being stored end-to-end. More precisely, the special variable a' will be
associated with a matrix A of m rows, and n columns, when the location of element aij is given
by a'+ in +j, i:O(1)m-1.j:O(1)n-1. In other words, a' identifies only the starting point of the
corresponding group of auxiliary variables (see Part 2). The dimensions are specified by additional
parameters, Although in the table below, a', b', c' have been used to specify matrices A, B, C; we could
just as well have used x'. y', z' (or indeed any variables or whole numbers) to represent X, Y, Z.
The dimensions of the matrices are (with one exception) also specified by any variables or
whole numbers; u, v, w are used in the equations below. Finally, where a scalar variable is
involved, e.g., in the calculation of a determinant, we have used x for tbis purpose.
In all these equations, the matrix operands are selected from the auxiliary (magnetic drum) store,
and the resulting matrix returned there. Naturally, this involves the use of the high speed working
store, but arrangements are made to preserve the contents in a secret dump, and restore them
after the operation. (Note: this secret dump is also used in the rmp operation, to hold the
contents of the working store when converting more Autocode instructions.)
Table of Matrix operations
-
Æ8(a',u,v,m,n)
- Prints the (u × v) matrix A in a single column, each row being followed by an extra line-feed.
i.e. u blocks of v numbers.
Each element is printed in conventional fixed-point form, with provision for m, n decimal places before
and after the point.
This routine automatically switches over to floating-point style for numbers greater than about 1010 (see Part 1).
-
Æ9(a',u,v,n)
- As above, but printing in floating-decimal style, in the form a,b.
n is the number of decimal places in a; m is irrelevant, and therefore omitted.
Æ8 and Æ9 will
handle matrices of all sizes up to u = 511 or v = 511.
-
Æ10(a',u)
- Reads the vector or matrix A consisting of u elements in all, in
fixed- or floating-point form, from punched tape.
- a' = Æ11(b',c',u)
- A=B+C: Linear combination of groups vectors or matrices, i.e., each containing u elements. 1 ≤u.
- a' = Æ12(b',c',u)
- A=B-C: Linear combination of groups vectors or matrices, i.e., each containing u elements. 1 ≤u.
- a' = Æ13(b',x,c',u)
- A=B+xC: Linear combination of groups vectors or matrices, i.e., each containing u elements. 1 ≤u.
- a' = Æ14(b',x,c',u)
- A=B-xC: Linear combination of groups vectors or matrices, i.e., each containing u elements. 1 ≤u.
- a' = Æ15(b',u)
- A=B: Linear combination of groups vectors or matrices, i.e., each containing u elements. 1 ≤u.
- a' = Æ16(b',u,v)
- A = BT : Matrix transpose, A has dimensions v × u and B has dimensions u × v; u > 1, v < 480
- a' = Æ17(b',u)
- A = B + I : adds identity matrix to square matrix B (order u < 240)
- a' = Æ18(b',u)
- A = B - I : subtracts identity matrix from square matrix B (order u < 240)
- a' = Æ19(b',x,u)
- A = B + xI : adds x times identity matrix to square matrix B (order u < 240)
- a' = Æ20(b',x,u)
- A = B - xI : subtracts x times identity matrix from square matrix B (order u < 240)
- a' = Æ21(b',d',u)
- A = B + D : add the diagonal matrix D (stored as a vector) to square matrix B (order u < 240)
- a' = Æ22(b',d',u)
- A = B - D : subtract the diagonal matrix D (stored as a vector) from square matrix B (order u < 240)
- a' = Æ23(b',x,d',u)
- A = B + xD : adds x times the diagonal matrix D (stored as a vector) to square matrix B (order u < 240)
- a' = Æ24(b',x,d',u)
- A = B - xD : subtracts x times the diagonal matrix D (stored as a vector) from square matrix B (order u < 240)
- x = Æ25(a',u)
- Replaces x (any working variable) by the determinant of A, order u, 1 < u < 98. A is destroyed (see Note 2)
- a' = Æ26(b',c',u,v,w)
- A = B C : matrix multiplication, A is u × v, B is u × w, C is w × v (0 < u,v,w < 130)
- a' = Æ27(b',c',u,v,w)
- A = B CT : matrix multiplication, A is u × v, B is u × w, C is v × w (0 < u,v,w < 130)
- a' = Æ28(b',m,n)
- A = B-1 A : Matrix division, A is m × n, B is m × m, C is m × n. Here the dimensions are given by indices or whole numbers.
(This is the exceptioned mentioned in the preamble.) (1 < m < 98, 0 < n < 98).
B is destroyed and A is replaced by the result (see Note 2).
Some examples
- a' = Æ20(b',0.333333,15)
- A = B - 1/3 I, A and B are 15 × 15 matrices.
- x' = Æ26(y',z',30,40,d)
- X = Y Z where X is 30 × 40, Y is 30 × d, Z is d × 40
- a' = Æ26(b',c',30,1,30)
- Product of matrix and vector, A = B C where A is 30 × 1, B is 30 × 30, C is 30 × 1
- a' = Æ16(a',4,3)
-
Æ8(a',3,4,m,n)
- If a matrix has to be printed in array form, Æ16 may be
used to transpose the matrix on top of itself before output. In this example A, 4 × 3, is first transposed,
and then printed in 3 columns of 4 numbers with m,n layout. Always
remember to re-transpose if A is to be used for further calculations (see Note 1).
- a' = Æ17(a',20)
- If A = 0 (as would be the case if the auxiliary store were clear), then this operation sets A=I , a
20 × 20 matrix
- a' = Æ28(b',20,20)
- If A is a 20 × 20 unit matrix and B is a 20 × 20 general matrix, then this is equivalent
to A= B-1. B itself is destroyed.
Storage limitations
The size of the auxiliary store will naturally limit the size and number of matrices
which can be handled. If the highest chapter number is N, then the auxiliary storage space available
extends from location 0 to 10751 - 512N. Thus, if the programme contains chapters 0,1,2. then the last
available auxiliary location is 9727.
Further variables are obtained by using the space occupied by the main Autocode programme,
and the dumps. These correspond to negatively numbered locations:
1) Input Programme gives -1 to -1536
2) Subchapter dump gives -1537 to -2048
3) Main Chapter dump gives -2049 to -2560
4) Secret dump gives -2561 to -3072
The secret dump is listed here for reference purposes only, since it is already used as private working
space by the matrix routines themselves. It may however be used as auxiliary storage when these are not
employed, and when the rmp facility is not wanted. Note that overwriting the Autocode input programme
also means dispensing with the rmp facility.
Notes
1. Any duplication of group names on the left- and right-hand-sides of equations using
Æ16, Æ26, Æ27
must be confined to groups of not more than 160 elements,for example in:
a' = Æ26(a',b',u,u,u)
u must not be greater than 12.
2. It is assumed in Æ28
that the elements of the B matrix are all represented to approximately the same absolute accuracy.
The same applies to the A matrix in Æ25.
In Æ28 the value of the determinant is computed as an
incidental operation by building up the product of the pivots. Unfortunately this may lead to accumulator
overflow unless both sides of the equations are suitably scaled.
Thus, for example, if all the pivots are approximately 106, this would lead to accumulator
overflow after about 12 reductions.
Times of operations for square matrices of order n
Times are given in seconds.
Function |
Size n=2 |
Size n=10 |
Size n=20 |
Size n=40 |
Size n=60 |
Size n=80 |
Size n=100 |
Æ11-15 |
0.5 |
1 |
2.5 |
7 |
16 |
25 |
38 |
Æ16 |
1 |
1.5 |
2.5 |
10 |
27 |
59 |
N/A |
Æ17-24 |
1 |
2 |
3 |
6 |
10 |
14 |
25 |
Æ25 |
1 |
4 |
14 |
70 |
209 |
459 |
N/A |
Æ26-27 |
1 |
2.5 |
16 |
105 |
345 |
695 |
N/A |
Æ28 |
1 |
9 |
40 |
220 |
686 |
1560 |
N/A |