Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 4ca0b570 authored by hhakim's avatar hhakim
Browse files

Add a small unit test for pyfaust slicing.

parent d3d3cc21
No related branches found
No related tags found
No related merge requests found
...@@ -208,6 +208,15 @@ class TestFaustPy(unittest.TestCase): ...@@ -208,6 +208,15 @@ class TestFaustPy(unittest.TestCase):
self.assertEqual(prod[i, rand_j], 0) self.assertEqual(prod[i, rand_j], 0)
else: else:
self.assertLessEqual(abs(col[i,0]-(prod[i,rand_j]))/prod[i,rand_j],10**-6) self.assertLessEqual(abs(col[i,0]-(prod[i,rand_j]))/prod[i,rand_j],10**-6)
# test that the sliced Faust is consistent with the sliced full matrix
# of the Faust
rand_ii, rand_jj = self.r.randint(0,self.F.shape[0]),self.r.randint(0,self.F.shape[1])
si1 = min(rand_i,rand_ii)
si2 = max(rand_i,rand_ii)
sj1 = min(rand_j,rand_jj)
sj2 = max(rand_j,rand_jj)
sF = self.F[si1:si2,sj1:sj2]
self.assertTrue((sF.todense() == self.F.todense()[si1:si2,sj1:sj2]).all())
def testToDense(self): def testToDense(self):
print("testToDense()") print("testToDense()")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment