(self)
| 132 | y = polyval(x, [1., 2., 3.]) |
| 133 | |
| 134 | def test_chebval(self): |
| 135 | #check empty input |
| 136 | assert_equal(cheb.chebval([], [1]).size, 0) |
| 137 | |
| 138 | #check normal input) |
| 139 | x = np.linspace(-1, 1) |
| 140 | y = [polyval(x, c) for c in Tlist] |
| 141 | for i in range(10): |
| 142 | msg = f"At i={i}" |
| 143 | tgt = y[i] |
| 144 | res = cheb.chebval(x, [0]*i + [1]) |
| 145 | assert_almost_equal(res, tgt, err_msg=msg) |
| 146 | |
| 147 | #check that shape is preserved |
| 148 | for i in range(3): |
| 149 | dims = [2]*i |
| 150 | x = np.zeros(dims) |
| 151 | assert_equal(cheb.chebval(x, [1]).shape, dims) |
| 152 | assert_equal(cheb.chebval(x, [1, 0]).shape, dims) |
| 153 | assert_equal(cheb.chebval(x, [1, 0, 0]).shape, dims) |
| 154 | |
| 155 | def test_chebval2d(self): |
| 156 | x1, x2, x3 = self.x |
nothing calls this directly
no test coverage detected