def test_deprecated_context(self): with self.assertWarns(warnings.NutilsDeprecationWarning): with matrix.MKL(): pass
def test_matrix_mkl(self): self._test_matrix(matrix.MKL())
s = pickle.dumps(self.matrix) mat = pickle.loads(s) self.assertIsInstance(mat, type(self.matrix)) numpy.testing.assert_equal(mat.export('dense'), self.exact) with self.subTest('cross-pickle'), matrix.Numpy(): mat = pickle.loads(s) self.assertIsInstance(mat, matrix.NumpyMatrix) numpy.testing.assert_equal(mat.export('dense'), self.exact) @ifsupported def test_diagonal(self): self.assertAllEqual(self.matrix.diagonal(), numpy.diag(self.exact)) solver('numpy', backend=matrix.Numpy(), args=[{}]) solver('scipy', backend=matrix.Scipy(), args=[{}, dict(solver='gmres', atol=1e-5, restart=100, precon='spilu'), dict(solver='gmres', atol=1e-5, precon='splu'), dict(solver='cg', atol=1e-5, precon='diag')] + [ dict(solver=s, atol=1e-5) for s in ('bicg', 'bicgstab', 'cg', 'cgs', 'lgmres', 'minres') ]) for threading in matrix.MKL.Threading.SEQUENTIAL, matrix.MKL.Threading.TBB: solver('mkl:{}'.format(threading.name.lower()), backend=matrix.MKL(threading=threading), args=[{}, dict(solver='fgmres', atol=1e-8), dict(solver='fgmres', atol=1e-8, precon='diag')])