Also make test_barycentric_within_domain() not exhaustive
This commit is contained in:
parent
09983a4416
commit
be3c0f7b04
|
@ -139,20 +139,22 @@ def test_barycentric_outside_domain(spec):
|
||||||
@single_phase
|
@single_phase
|
||||||
def test_barycentric_within_domain(spec):
|
def test_barycentric_within_domain(spec):
|
||||||
"""
|
"""
|
||||||
Test barycentric formula correctness by using it to evaluate a polynomial at all the points of its domain
|
Test barycentric formula correctness by using it to evaluate a polynomial at various points inside its domain
|
||||||
(the roots of unity).
|
(the roots of unity).
|
||||||
|
|
||||||
Then make sure that we would get the same result if we evaluated it from coefficient form without using the
|
Then make sure that we would get the same result if we evaluated it from coefficient form without using the
|
||||||
barycentric formula
|
barycentric formula
|
||||||
"""
|
"""
|
||||||
|
rng = random.Random(5566)
|
||||||
poly_coeff, poly_eval = get_poly_in_both_forms(spec)
|
poly_coeff, poly_eval = get_poly_in_both_forms(spec)
|
||||||
roots_of_unity_brp = spec.bit_reversal_permutation(spec.ROOTS_OF_UNITY)
|
roots_of_unity_brp = spec.bit_reversal_permutation(spec.ROOTS_OF_UNITY)
|
||||||
|
|
||||||
assert len(poly_coeff) == len(poly_eval) == len(roots_of_unity_brp)
|
assert len(poly_coeff) == len(poly_eval) == len(roots_of_unity_brp)
|
||||||
n = len(poly_coeff)
|
n = len(poly_coeff)
|
||||||
|
|
||||||
# Iterate over the entire domain
|
# Iterate over some roots of unity
|
||||||
for i in range(n):
|
for i in range(12):
|
||||||
|
i = rng.randint(0, n - 1)
|
||||||
# Grab a root of unity and use it as the evaluation point
|
# Grab a root of unity and use it as the evaluation point
|
||||||
z = int(roots_of_unity_brp[i])
|
z = int(roots_of_unity_brp[i])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue