Exemple #1
0
 def test_size(self):
     cfs = np.random.rand(10)
     subinterval = Interval()
     b0 = Bndfun(Chebtech2(np.array([])), subinterval)
     b1 = Bndfun(Chebtech2(np.array([1.])), subinterval)
     b2 = Bndfun(Chebtech2(cfs), subinterval)
     self.assertEquals(b0.size, 0)
     self.assertEquals(b1.size, 1)
     self.assertEquals(b2.size, cfs.size)
Exemple #2
0
 def test_onefun_construction(self):
     coeffs = np.random.rand(10)
     subinterval = Interval()
     onefun = Chebtech2(coeffs)
     f = Bndfun(onefun, subinterval)
     self.assertIsInstance(f, Bndfun)
     self.assertLess(infnorm(f.coeffs - coeffs), eps)
Exemple #3
0
 def test_bary_clenshaw_consistency(self):
     coeffs = np.random.rand(3)
     evalpts = (0.5, np.array([]), np.array([.5]), np.array([.5, .6]))
     for n in range(len(coeffs)):
         ff = Chebtech2(coeffs[:n])
         for xx in evalpts:
             fb = ff(xx, "bary")
             fc = ff(xx, "clenshaw")
             self.assertEquals(type(fb), type(fc))
Exemple #4
0
 def test_coeff_construction(self):
     coeffs = rand(10)
     f = Chebtech2(coeffs)
     self.assertIsInstance(f, Chebtech2)
     self.assertLess(infnorm(f.coeffs - coeffs), eps)
Exemple #5
0
 def setUp(self):
     self.emptyfun = Chebtech2(array([]))
Exemple #6
0
 def test_vscale_empty(self):
     gg = Chebtech2(array([]))
     self.assertEquals(gg.vscale, 0.)
Exemple #7
0
 def test_size(self):
     cfs = rand(10)
     self.assertEquals(Chebtech2(array([])).size, 0)
     self.assertEquals(Chebtech2(array([1.])).size, 1)
     self.assertEquals(Chebtech2(cfs).size, cfs.size)
Exemple #8
0
 def test_isconst_False(self):
     f = Chebtech2(array([]))
     self.assertFalse(f.isconst)
     self.assertTrue(not f.isconst)
Exemple #9
0
 def test_isempty_False(self):
     f = Chebtech2(array([1.]))
     self.assertFalse(f.isempty)
     self.assertTrue(not f.isempty)
Exemple #10
0
 def test_size(self):
     cfs = np.random.rand(10)
     self.assertEquals(Chebtech2(np.array([])).size, 0)
     self.assertEquals(Chebtech2(np.array([1.0])).size, 1)
     self.assertEquals(Chebtech2(cfs).size, cfs.size)
Exemple #11
0
 def test_isconst_True(self):
     f = Chebtech2(np.array([1.0]))
     self.assertTrue(f.isconst)
     self.assertFalse(not f.isconst)