VA1 Exact evaluation of a determinant

This program is an open subroutine for the exact calculation of the determinant. The result is obtained correctly modulo p, where p is a prime number. It should be used with the interpretive subroutine A1 and A2. The method of calculation is described in other printed matter, for instance, PC-1 Document No 8.

When using this subroutine, one has to set the following parameters and to prepare the table of elements of determinant as long integers,

0n = Order of determinant,
0u = n2,
0h = 235 - p,
0q = (Location of the first element of the determinant)
0q: Table of elements of determinant, in the order;
a11, a12, ... a1n, a21, a22, ... an1, an2, ... ann
each number being followed by ign (+ or -).
(Storage locatons from 0uuq to 0uunnq - 1
are used as working spaces.)

When at the end of the subroutine, the result is in 0gL, and the instruction which closely follows this program is executed.

 Determinant (exact)

 0t:0k=131072,0r:

 0   pl 60r ┐ Set the partial product to 1 initially.
 1   tl   g ┘
 2   p  59r ┐ Set the first address of determinant initially.
 3   x  37r ┘
 4   p  56r ┐
 5   jl  7r │
 6   p  41r │ Set the address in order to set "B-register".
 7   s  58r │
 8   x  41r ┘
 9   p  37r ┐
10   s  58r │
11   s  56r │ Set addresses for pivot test and sweep out.
12   x  37r │
13   jl 16r │
14   p  38r │ ┐
15   s  56r │ │ If the pivot is zero, try next row.
16   x  22r │ ┘
17   x  34r │
18   x  38r │
19   x  45r ┘
20   s  57r ┐
21   k  66r ┘ Jump if all the elements tested are zero.
22   pl (  )┐
23   zl 14r │ Test if the pivot is zero, and if not, transfer it
24   tl   o ┘ to 0oL.
25   it     ┐
26   jl   c ┘ Jump to the interpretive subroutine.
27 | p    o ┐
28 | v    g │ Build up partial product.
29 | t    g ┘
30 | w  62r   Test end of process and set "B-register".
31 | p    o  
32 | w    d   Store the reciprocal of the pivot in 0oL.
33 | t    o  
34 | pk (  )┐ Elements of row under consideration are "divided"
35 | v    o │ by the pivot and transferred to the working spaces.
36 | tk nnuuq 
37 | nk (  )│
38 | tk (  )│ Transfer the elements of the column whoch contains
39 | c  34r ┘ the pivot.
40 | w  48r  
41 | b (   )┐
42 | n (   )│
43 | vk nnuuq Sweep out one row.
44 | ak (  )│
45 | tk (  )│
46 | c  42r │
47 | j  40r ┘
48   p  45r ┐
49   s  56r │
50   x  42r │ Subroutine to shift addresses for next row.
51   x  44r │
52   x  45r │
53   s  57r │
54   k   6r │
55   jl 19c ┘
56 |    0nn ┐
57 | tk   q │
58 | h   2  │ Constants
59 | 0uunnq │
60 |     0  │
61 |     1  ┘
62   n  41r ┐
63   z  68r │ Subroutine to set "B-register", and to test end of
64   x  16c │ procedure.
65   jl 19c ┘
66   p   2  ┐ Make the value of determinat zero.
67   tl   g ┘

    Remark (1)  0k = 131072, and instructions which have  k  as
                code letter are modified by "B-register".
           (2)  For the interpretive part of the routine, see
                the reference sheet for A1 and A2.

                               Author:   H. Takahasi
                                         Y. Ishibashi

                               Date:  60-01-10