Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 80efa41b authored by hhakim's avatar hhakim
Browse files

Add a pyfaust unit test of a single factor BSR Faust.

parent 340a3818
No related branches found
No related tags found
No related merge requests found
...@@ -1684,6 +1684,18 @@ class TestFaustFactory(unittest.TestCase): ...@@ -1684,6 +1684,18 @@ class TestFaustFactory(unittest.TestCase):
err = norm(F.toarray()-DFT)/norm(DFT) err = norm(F.toarray()-DFT)/norm(DFT)
self.assertLessEqual(err, 1e-6) self.assertLessEqual(err, 1e-6)
def test_single_bsr_Faust(self):
from scipy.sparse import bsr_matrix
from pyfaust import Faust
from numpy import allclose
from numpy.random import rand
nzblocks = rand(3, 2, 3) # 3 blocks of size 2x3
# create a scipy BSR matrix
B = bsr_matrix((nzblocks, [0, 1, 2], [0, 1, 2, 3, 3, 3]), shape=(10,9))
# create the single factor Faust
F = Faust(B)
self.assertTrue(allclose(F.toarray(), B.toarray()))
def test_bsr_Faust(self): def test_bsr_Faust(self):
from random import randint from random import randint
from scipy.sparse import random from scipy.sparse import random
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment