doh, use reduce on operator.add already
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 11 Oct 2023 11:49:11 +0000 (12:49 +0100)
committerAndrey Miroshnikov <andrey@technepisteme.xyz>
Wed, 18 Oct 2023 13:46:00 +0000 (13:46 +0000)
src/openpower/decoder/isa/test_caller_svp64_matrix.py

index 555d9df44ef9f250b0f04a13503dfc6fce5b6fd4..3a413fef24529648bd01eb225c56d78304dee51a 100644 (file)
@@ -19,10 +19,6 @@ def matmult(a, b):
     return [[sum(ele_a*ele_b for ele_a, ele_b in zip(row_a, col_b))
              for col_b in zip_b] for row_a in a]
 
-# Flatten list of lists matrix down to single list
-def flatten(l):
-    return [item for sublist in l for item in sublist]
-
 
 class DecoderTestCase(FHDLTestCase):
 
@@ -59,12 +55,12 @@ class DecoderTestCase(FHDLTestCase):
         Y = Y1
 
         expected = matmult(X, Y)
-        expected = flatten(expected)
         print("expected-matrix:")
         print(expected)
 
         xf = reduce(operator.add, X)
         yf = reduce(operator.add, Y)
+        expected = reduce(operator.add, expected)
         print("flattened X,Y,expected")
         print("\t", xf)
         print("\t", yf)