def test_bary__empty(self): null = (None, None) self.assertEquals(bary(np.array([]), np.array([]), *null).size, 0) self.assertEquals(bary(np.array([.1]), np.array([]), *null).size, 0) self.assertEquals(bary(np.array([]), np.array([.1]), *null).size, 0) self.assertEquals(bary(self.pts, np.array([]), *null).size, 0) self.assertEquals(bary(np.array([]), self.pts, *null).size, 0) self.assertNotEquals(bary(np.array([.1]), np.array([.1]), *null).size, 0)
def evalTester(method, fun, evalpts, chebpts): x = evalpts xk = chebpts fvals = fun(xk) if method is bary: vk = Chebtech2._barywts(fvals.size) a = bary(x, fvals, xk, vk) tol_multiplier = 1e0 elif method is clenshaw: ak = Chebtech2._vals2coeffs(fvals) a = clenshaw(x, ak) tol_multiplier = 2e1 b = fun(evalpts) n = evalpts.size tol = tol_multiplier * scaled_tol(n) return infNormLessThanTol(a, b, tol)
def __call__bary(self, x): fk = self.values() xk = self._chebpts(fk.size) vk = self._barywts(fk.size) return bary(x, fk, xk, vk)
def test_bary__scalar_input(self): for x in self.xx: self.assertTrue(np.isscalar(bary(x, self.fk, self.xk, self.vk))) self.assertFalse(np.isscalar(bary(xx, self.fk, self.xk, self.vk)))
def test_bary__scalar_input(self): for x in self.xx: self.assertTrue(np.isscalar(bary(x,self.fk,self.xk,self.vk))) self.assertFalse(np.isscalar(bary(xx,self.fk,self.xk,self.vk)))