MCPcopy Create free account
hub / github.com/numpy/numpy / test_hermval

Method test_hermval

numpy/polynomial/tests/test_hermite.py:122–141  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

120 y = polyval(x, [1., 2., 3.])
121
122 def test_hermval(self):
123 #check empty input
124 assert_equal(herm.hermval([], [1]).size, 0)
125
126 #check normal input)
127 x = np.linspace(-1, 1)
128 y = [polyval(x, c) for c in Hlist]
129 for i in range(10):
130 msg = f"At i={i}"
131 tgt = y[i]
132 res = herm.hermval(x, [0]*i + [1])
133 assert_almost_equal(res, tgt, err_msg=msg)
134
135 #check that shape is preserved
136 for i in range(3):
137 dims = [2]*i
138 x = np.zeros(dims)
139 assert_equal(herm.hermval(x, [1]).shape, dims)
140 assert_equal(herm.hermval(x, [1, 0]).shape, dims)
141 assert_equal(herm.hermval(x, [1, 0, 0]).shape, dims)
142
143 def test_hermval2d(self):
144 x1, x2, x3 = self.x

Callers

nothing calls this directly

Calls 4

assert_equalFunction · 0.90
polyvalFunction · 0.90
assert_almost_equalFunction · 0.90
linspaceMethod · 0.80

Tested by

no test coverage detected