Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions barretenberg/cpp/src/barretenberg/polynomials/gate_separator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ template <typename FF> struct GateSeparatorPolynomial {
*/
FF current_element() const
{
if (betas.empty()) {
if (current_element_idx >= betas.size()) {
return FF(1);
};
return betas[current_element_idx];
Expand All @@ -112,7 +112,13 @@ template <typename FF> struct GateSeparatorPolynomial {
/**
* @brief Evaluate \f$ ((1−X_{i}) + X_{i}\cdot \beta_{i})\f$ at the challenge point \f$ X_{i}=u_{i} \f$.
*/
FF univariate_eval(FF challenge) const { return (FF(1) + (challenge * (betas[current_element_idx] - FF(1)))); };
FF univariate_eval(FF challenge) const
{
if (current_element_idx >= betas.size()) {
return FF(1);
}
return (FF(1) + (challenge * (betas[current_element_idx] - FF(1))));
};

/**
* @brief Partially evaluate the \f$pow_{\beta} \f$-polynomial at the new challenge and update \f$ c_i \f$
Expand All @@ -122,12 +128,10 @@ template <typename FF> struct GateSeparatorPolynomial {
*/
void partially_evaluate(FF challenge)
{
if (!betas.empty()) {
FF current_univariate_eval = univariate_eval(challenge);
partial_evaluation_result *= current_univariate_eval;
current_element_idx++;
periodicity *= 2;
}
FF current_univariate_eval = univariate_eval(challenge);
partial_evaluation_result *= current_univariate_eval;
current_element_idx++;
periodicity *= 2;
}

/**
Expand Down
Loading