# Read matrices A and B from file, infer size of output matrix C.
A = pt.read(os.path.join(_SCRIPT_PATH, "data/A.mtx"), csr)
B = pt.read(os.path.join(_SCRIPT_PATH, "data/B.mtx"), csr)
-C = pt.tensor((A.shape[0], B.shape[1]), csr)
+C = pt.tensor([A.shape[0], B.shape[1]], csr)
# Define the kernel.
i, j, k = pt.get_index_vars(3)
C[i, j] = A[i, k] * B[k, j]
# Force evaluation of the kernel by writing out C.
-#
-# TODO: use sparse_tensor.out for output, so that C.tns becomes
-# a file in extended FROSTT format
-#
with tempfile.TemporaryDirectory() as test_dir:
golden_file = os.path.join(_SCRIPT_PATH, "data/gold_C.tns")
out_file = os.path.join(test_dir, "C.tns")
_ = expected_f.readline()
# Compare the two lines of meta data
- if actual_f.readline() != expected_f.readline() or actual_f.readline(
- ) != expected_f.readline():
+ if (actual_f.readline() != expected_f.readline() or
+ actual_f.readline() != expected_f.readline()):
return FALSE
actual_data = np.loadtxt(actual, np.float64, skiprows=3)