Skip to content

Commit

Permalink
Parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
Rumata888 committed Apr 22, 2024
1 parent ce98798 commit 8ef17ef
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
4 changes: 2 additions & 2 deletions barretenberg/cpp/src/barretenberg/polynomials/univariate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,9 +387,9 @@ template <class Fr, size_t domain_end, size_t domain_start = 0> class Univariate
Univariate<Fr, EXTENDED_LENGTH - NUM_SKIPPED_INDICES> optimised_result;
optimised_result.value_at(0) = result.value_at(0);

std::copy(std::next(result.begin(), 1 + NUM_SKIPPED_INDICES),
std::copy(std::next(result.evaluations.begin(), 1 + NUM_SKIPPED_INDICES),
result.evaluations.end(),
std::next(optimised_result.begin(), 1));
std::next(optimised_result.evaluations.begin(), 1));
return optimised_result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ template <class ProverInstances_> class ProtoGalaxyProver_ {
accumulate_relation_univariates(
thread_univariate_accumulators[thread_idx],
extended_univariates[thread_idx],
instances.relation_parameters, // these parameters have already been folded
instances.optimised_relation_parameters, // these parameters have already been folded
pow_challenge);
}
});
Expand All @@ -406,10 +406,13 @@ template <class ProverInstances_> class ProtoGalaxyProver_ {
static_assert(std::remove_reference_t<decltype(optimised_element)>::LENGTH + (ProverInstances::NUM - 1) ==
std::remove_reference_t<decltype(element)>::LENGTH);
element.evaluations[0] = optimised_element.evaluations[0];
element.evaluations[1] = FF(0);
for (size_t i = 1; i < ProverInstances::NUM; i++) {
element.evaluations[i] = FF(0);
}
for (size_t i = 1; i < std::remove_reference_t<decltype(optimised_element)>::LENGTH; i++) {
element.evaluations[i + 1] = optimised_element.evaluations[i];
element.evaluations[i + ProverInstances::NUM - 1] = optimised_element.evaluations[i];
}
info("Element ", outer_idx, ".", inner_idx, "[", ":", "] = ", element);
};

Utils::template apply_to_tuple_of_tuples<0, 0>(univariate_accumulators, deoptimise);
Expand Down Expand Up @@ -488,14 +491,19 @@ template <class ProverInstances_> class ProtoGalaxyProver_ {
{
size_t param_idx = 0;
auto to_fold = instances.relation_parameters.get_to_fold();
for (auto& folded_parameter : to_fold) {
auto to_fold_optimised = instances.optimised_relation_parameters.get_to_fold();
for (auto [folded_parameter, optimised_folded_parameter] : zip_view(to_fold, to_fold_optimised)) {
Univariate<FF, ProverInstances::NUM> tmp(0);
size_t instance_idx = 0;
for (auto& instance : instances) {
tmp.value_at(instance_idx) = instance->relation_parameters.get_to_fold()[param_idx];
instance_idx++;
}
folded_parameter = tmp.template extend_to<ProverInstances::EXTENDED_LENGTH>();
optimised_folded_parameter.value_at(0) = folded_parameter.value_at(0);
std::copy(std::next(folded_parameter.evaluations.begin(), ProverInstances::NUM),
folded_parameter.evaluations.end(),
std::next(optimised_folded_parameter.evaluations.begin(), 1));
param_idx++;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ template <typename Flavor_, size_t NUM_ = 2> struct ProverInstances_ {
static constexpr size_t EXTENDED_LENGTH = (Flavor::MAX_TOTAL_RELATION_LENGTH - 1) * (NUM - 1) + 1;
static constexpr size_t BATCHED_EXTENDED_LENGTH = (Flavor::MAX_TOTAL_RELATION_LENGTH - 1 + NUM - 1) * (NUM - 1) + 1;
using RelationParameters = bb::RelationParameters<Univariate<FF, EXTENDED_LENGTH>>;
using OptimisedRelationParameters = bb::RelationParameters<Univariate<FF, EXTENDED_LENGTH - NUM + 1>>;
using RelationSeparator = std::array<Univariate<FF, BATCHED_EXTENDED_LENGTH>, NUM_SUBRELATIONS - 1>;
ArrayType _data;
RelationParameters relation_parameters;
OptimisedRelationParameters optimised_relation_parameters;
RelationSeparator alphas;
std::vector<FF> next_gate_challenges;

Expand Down

0 comments on commit 8ef17ef

Please sign in to comment.