示例#1
0
 def test_coeffmult(self):
     f, g = self.f, self.g
     fn, gn = self.fn, self.gn
     hn = fn + gn - 1
     h  = lambda x: self.f(x) * self.g(x)
     fc = Chebtech2.initfun(f, fn).prolong(hn).coeffs
     gc = Chebtech2.initfun(g, gn).prolong(hn).coeffs
     hc = coeffmult(fc, gc)
     HC = Chebtech2.initfun(h, hn).coeffs
     self.assertLessEqual( infnorm(hc-HC), 2e1*eps)
示例#2
0
 def test_coeffmult(self):
     f, g = self.f, self.g
     fn, gn = self.fn, self.gn
     hn = fn + gn - 1
     h = lambda x: self.f(x) * self.g(x)
     fc = Chebtech2.initfun(f, fn).prolong(hn).coeffs
     gc = Chebtech2.initfun(g, gn).prolong(hn).coeffs
     hc = coeffmult(fc, gc)
     HC = Chebtech2.initfun(h, hn).coeffs
     self.assertLessEqual(infnorm(hc - HC), 2e1 * eps)
示例#3
0
文件: chebtech.py 项目: tschm/chebpy
 def __mul__(self, g):
     cls = self.__class__
     if np.isscalar(g):
         cfs = g * self.coeffs
         return cls(cfs, interval=self.interval)
     else:
         # TODO: review with reference to __add__
         if g.isempty:
             return g.copy()
         f = self
         n = f.size + g.size - 1
         f = f.prolong(n)
         g = g.prolong(n)
         cfs = coeffmult(f.coeffs, g.coeffs)
         out = cls(cfs, interval=self.interval)
         return out
示例#4
0
文件: chebtech.py 项目: chebpy/chebpy
 def __mul__(self, g):
     cls = self.__class__
     if np.isscalar(g):
         cfs = g * self.coeffs
         return cls(cfs)
     else:
         # TODO: review with reference to __add__
         if g.isempty:
             return g.copy()
         f = self
         n = f.size + g.size - 1
         f = f.prolong(n)
         g = g.prolong(n)
         cfs = coeffmult(f.coeffs, g.coeffs)
         out = cls(cfs)
         return out