mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-02-26 01:05:15 +00:00
Fix comment for evaluate_polynomial_in_evaluation_form
to reflect that it can now also be used in the domain
This commit is contained in:
parent
86fb82b221
commit
1b4840c967
@ -303,8 +303,10 @@ def compute_powers(x: BLSFieldElement, n: uint64) -> Sequence[BLSFieldElement]:
|
|||||||
def evaluate_polynomial_in_evaluation_form(polynomial: Polynomial,
|
def evaluate_polynomial_in_evaluation_form(polynomial: Polynomial,
|
||||||
z: BLSFieldElement) -> BLSFieldElement:
|
z: BLSFieldElement) -> BLSFieldElement:
|
||||||
"""
|
"""
|
||||||
Evaluate a polynomial (in evaluation form) at an arbitrary point ``z`` that is not in the domain.
|
Evaluate a polynomial (in evaluation form) at an arbitrary point ``z``.
|
||||||
Uses the barycentric formula:
|
- When ``z`` is in the domain, the evaluation can be found by indexing the polynomial at the
|
||||||
|
position that ``z`` is in the domain.
|
||||||
|
- When ``z`` is not in the domain, the barycentric formula is used:
|
||||||
f(z) = (z**WIDTH - 1) / WIDTH * sum_(i=0)^WIDTH (f(DOMAIN[i]) * DOMAIN[i]) / (z - DOMAIN[i])
|
f(z) = (z**WIDTH - 1) / WIDTH * sum_(i=0)^WIDTH (f(DOMAIN[i]) * DOMAIN[i]) / (z - DOMAIN[i])
|
||||||
"""
|
"""
|
||||||
width = len(polynomial)
|
width = len(polynomial)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user