def test_lu(self): tm,tmr,tma=self.tm,self.tmr,self.tma print 'checking for LU decomposition.' t0=time.time() lusys=lin.trilu(tm) L,U=lusys.L,lusys.U t1=time.time() L1,U=L.tocsr(),U.tocsc() lures=L1.dot(U) diff=abs(lures-tmr).toarray() print 'err -> %s, Elapse -> %s'%(diff.sum(),t1-t0) assert_allclose(diff,0,atol=1e-10)
def test_lu(self): tm, tmr, tma = self.tm, self.tmr, self.tma print 'checking for LU decomposition.' t0 = time.time() lusys = lin.trilu(tm) L, U = lusys.L, lusys.U t1 = time.time() L1, U = L.tocsr(), U.tocsc() lures = L1.dot(U) diff = abs(lures - tmr).toarray() print 'err -> %s, Elapse -> %s' % (diff.sum(), t1 - t0) assert_allclose(diff, 0, atol=1e-10)
def test_ul(self): print 'checking for UL decomposition.' tm,tmr,tma=self.tm,self.tmr,self.tma lusys=lin.trilu(tm) t0=time.time() ulsys=lin.triul(tm) U,L=lusys.L,lusys.U t1=time.time() U2,L=U.tocsr(),L.tocsc() ulres=U2.dot(L) diff=abs(ulres-tmr).toarray() print 'err -> %s, Elapse -> %s'%(diff.sum(),t1-t0) assert_allclose(diff,0,atol=1e-10)
def test_ul(self): print 'checking for UL decomposition.' tm, tmr, tma = self.tm, self.tmr, self.tma lusys = lin.trilu(tm) t0 = time.time() ulsys = lin.triul(tm) U, L = lusys.L, lusys.U t1 = time.time() U2, L = U.tocsr(), L.tocsc() ulres = U2.dot(L) diff = abs(ulres - tmr).toarray() print 'err -> %s, Elapse -> %s' % (diff.sum(), t1 - t0) assert_allclose(diff, 0, atol=1e-10)