MCPcopy Index your code
hub / github.com/numpy/numpy / test_fromroots

Function test_fromroots

numpy/polynomial/tests/test_classes.py:120–136  ·  view source on GitHub ↗
(Poly)

Source from the content-addressed store, hash-verified

118
119
120def test_fromroots(Poly):
121 # check that requested roots are zeros of a polynomial
122 # of correct degree, domain, and window.
123 d = Poly.domain + random((2,)) * .25
124 w = Poly.window + random((2,)) * .25
125 r = random((5,))
126 p1 = Poly.fromroots(r, domain=d, window=w)
127 assert_equal(p1.degree(), len(r))
128 assert_equal(p1.domain, d)
129 assert_equal(p1.window, w)
130 assert_almost_equal(p1(r), 0)
131
132 # check that polynomial is monic
133 pdom = Polynomial.domain
134 pwin = Polynomial.window
135 p2 = Polynomial.cast(p1, domain=pdom, window=pwin)
136 assert_almost_equal(p2.coef[-1], 1)
137
138
139def test_bad_conditioned_fit(Poly):

Callers

nothing calls this directly

Calls 5

assert_equalFunction · 0.90
assert_almost_equalFunction · 0.90
fromrootsMethod · 0.80
degreeMethod · 0.80
castMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…