more useful print output in remap matrix example
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 6 Jul 2021 08:43:58 +0000 (09:43 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 6 Jul 2021 08:44:04 +0000 (09:44 +0100)
openpower/sv/remapmatrix.py

index 8418864919f71758097c19520feee5c623239d2d..f256cc54be735c15c3ce125c67c83d809d153484 100644 (file)
@@ -46,8 +46,8 @@ def matrix_demo():
         [4,5,9,1,2]]
 
     # pick one of the above (crude, non-automated, but it works, hey)
-    X = X3
-    Y = Y3
+    X = X2
+    Y = Y2
 
     # get the dimensions of the 2 matrices
     xdim1 = len(X[0])
@@ -106,7 +106,7 @@ def matrix_demo():
     # now create the schedule. we use three generators, zipped
     # together
 
-    print ("ydim2 xdim2 ydim1", ydim2, xdim2, ydim1)
+    print ("xdim2 ydim1 ydim2", xdim2, ydim1, ydim2)
 
     class SVSHAPE:
         pass
@@ -143,9 +143,11 @@ def matrix_demo():
     for i, idxs in enumerate(iterate_triple(SVSHAPE0, SVSHAPE1, SVSHAPE2)):
         if i == VL:
             break
-        print ("idxs", i, idxs, len(result2), len(xf), len(yf))
         r_idx, x_idx, y_idx = idxs
-        result2[r_idx] += xf[x_idx] * yf[y_idx]
+        new_result = result2[r_idx] + xf[x_idx] * yf[y_idx]
+        print ("idxs", i, idxs, len(result2), len(xf), len(yf),
+               "  results  ", result2[r_idx], xf[x_idx], yf[y_idx], new_result)
+        result2[r_idx] = new_result
 
     # now print out sections of result array, assuming elements of a "row"
     # are in sequence (inner loop), columns are outer