begin 

library A0, A1, A4, A5, A15;

   real procedure GPS (I, N, Z, V);
      real I, N, Z, V;
   begin 
      for I := 1 step 1 until N do 
         Z := V;
      GPS := 1
   end GPS;


   procedure GPS TEST 1 (m, n);
      value m, n; real m, n;
   begin 
   real i, j;

   array A[1:m, 1:n];

   writetext(30, {GPS _ TEST _ CASE _ 1{c}});

   comment set A[i,j] to (i+j)
   ;
   i := GPS(j, n, i, GPS(i, m, A[i,j], i+j));

   writetext(30, {A[i,j] _ should _ be _ (i+j){c}});
   for i := 1 step 1 until m do 
      begin 
         for j := 1 step 1 until n do 
            write(30, format({+d.dddddss}), A[i,j]);
         writetext(30, {{c}});
      end ;

   end GPS TEST 1;


   procedure GPS TEST 2 (m, n, p);
       value m, n, p; real m, n, p;
   begin 
   real i, j, k;

   array A[1:m, 1:n], B[1:n, 1:p], C[1:m, 1:p];

   writetext(30, {{c}{c}GPS _ TEST _ CASE _ 2{c}});

   for i := 1 step 1 until m do 
      for k := 1 step 1 until n do 
         A[i,k] := i/10.0^(k-1);

   for k := 1 step 1 until n do 
      for j := 1 step 1 until p do 
         B[k,j] := k;

   for i := 1 step 1 until m do 
      for j := 1 step 1 until p do 
         C[i,j] := -999999999;

   comment set C to AB
   ;
   i := GPS(i, 1.0, C[1,1], 0.0)
      × GPS(i,
            (m-1) ×
               GPS(j,
                   (p-1) ×
                      GPS(k, n, C[i,j], C[i,j] + A[i,k]×B[k,j]),
                   C[i,j+1],
                   0.0
                  ),
            C[i+1,1],
            0.0
           );

   writetext(30, {C[i,j] _ should _ be _ 1.234j{c}});
   for i := 1 step 1 until m do 
      begin 
         for j := 1 step 1 until p do 
            write(30, format({+d.dddddss}), C[i,j]);
         writetext(30, {{c}});
      end ;

   end  procedure GPS TEST 2;

open(30);

   GPS TEST 1(5, 3);
   GPS TEST 2(3, 4, 5);

close(30);

end 
|