Esempio n. 1
0
 def assert_resnorm(self, lhs):
   res = self.residual.eval(arguments=dict(dofs=lhs))[numpy.isnan(self.cons)] if self.single \
     else numpy.concatenate([sparse.toarray(sparse.take(r, [numpy.isnan(self.cons[d])]) if d in self.cons else r)
       for d, r in zip(self.dofs, sample.eval_integrals_sparse(*self.residual, **lhs))])
   resnorm = numpy.linalg.norm(res)
   self.assertLess(resnorm, self.tol)
Esempio n. 2
0
 def test_toarray(self):
     array = sparse.toarray(self.data)
     self.assertEqual(array.tolist(), self.full.tolist())
Esempio n. 3
0
 def assert_resnorm(self, lhs):
   res, = sample.eval_integrals_sparse(self.residual, dofs=lhs)
   resnorm = numpy.linalg.norm(sparse.toarray(res)[~self.boolcons])
   self.assertLess(resnorm, self.tol)