def test01(self): """ Check diagonal content of M """ md = get_diagonal(self.M) bi = Function(self.V) for index, ii in enumerate(md): b = bi.vector().copy() b[index] = 1.0 Mb = (self.M*b).inner(b) self.assertTrue(abs(ii - Mb)/abs(Mb) < 1e-16)
def test11(self): """ Check diagonal content of K """ kd = get_diagonal(self.K) bi = Function(self.V) for index, ii in enumerate(kd): b = bi.vector().copy() b[index] = 1.0 Kb = (self.K*b).inner(b) self.assertTrue(abs(ii - Kb)/abs(Kb) < 1e-16)
def test11(self): """ Check diagonal content of K """ kd = get_diagonal(self.K) bi = Function(self.V) for index, ii in enumerate(kd): b = bi.vector().copy() b[index] = 1.0 Kb = (self.K * b).inner(b) self.assertTrue(abs(ii - Kb) / abs(Kb) < 1e-16)
def test01(self): """ Check diagonal content of M """ md = get_diagonal(self.M) bi = Function(self.V) for index, ii in enumerate(md): b = bi.vector().copy() b[index] = 1.0 Mb = (self.M * b).inner(b) self.assertTrue(abs(ii - Mb) / abs(Mb) < 1e-16)
def _assemble_invMw(self): """ Assemble inverse of matrix Mw, weighted mass matrix in dual space """ # WARNING: only works if Mw is diagonal (e.g, DG0) Mw = assemble(self.massw) Mwd = get_diagonal(Mw) as_backend_type(self.invMwd).vec().pointwiseDivide(\ as_backend_type(self.one).vec(),\ as_backend_type(Mwd).vec()) self.invMwMat.set_diagonal(self.invMwd)
def test10(self): """ Get diagonal of K """ kd = get_diagonal(self.K)
def test00(self): """ Get diagonal of M """ md = get_diagonal(self.M)