Esempio n. 1
0
 def test_csr2trid(self):
     #for scalar
     print 'Testing for conversion between ScalarTridMatrix and CSR.'
     a=self.strid.tocsr()
     smat=sr2trid(a)
     smat2=arr2trid(self.strid.toarray())
     a2=smat.toarray()
     assert_allclose(a.toarray(),a2,atol=1e-10)
     #for block
     print 'Testing for conversion between BlockTridMatrix and CSR.'
     a=self.btrid.tocsr()
     smat=sr2trid(a,p=self.p)
     a2=smat.toarray()
     assert_allclose(a.toarray(),a2,atol=1e-10)
Esempio n. 2
0
 def test_csr2trid(self):
     #for scalar
     print 'Testing for conversion between ScalarTridMatrix and CSR.'
     a = self.strid.tocsr()
     smat = sr2trid(a)
     smat2 = arr2trid(self.strid.toarray())
     a2 = smat.toarray()
     assert_allclose(a.toarray(), a2, atol=1e-10)
     #for block
     print 'Testing for conversion between BlockTridMatrix and CSR.'
     a = self.btrid.tocsr()
     smat = sr2trid(a, p=self.p)
     a2 = smat.toarray()
     assert_allclose(a.toarray(), a2, atol=1e-10)
Esempio n. 3
0
 def test_bsr2trid(self):
     print 'Testing for conversion between BlockTridMatrix and BSR.'
     a=self.btrid.tobsr()
     smat=sr2trid(a,p=self.p)
     a2=smat.toarray()
     assert_allclose(a.toarray(),a2,atol=1e-10)
Esempio n. 4
0
 def test_bsr2trid(self):
     print 'Testing for conversion between BlockTridMatrix and BSR.'
     a = self.btrid.tobsr()
     smat = sr2trid(a, p=self.p)
     a2 = smat.toarray()
     assert_allclose(a.toarray(), a2, atol=1e-10)