Skip to content

Commit

Permalink
Use points map for faster search over the LPC points.
Browse files Browse the repository at this point in the history
  • Loading branch information
martun committed Sep 14, 2024
1 parent f8bca3a commit 5cfa30a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions libs/zk/include/nil/crypto3/zk/commitments/polynomial/lpc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,8 @@ namespace nil {
polynomial_type prepare_combined_Q(
const typename field_type::value_type& theta,
std::size_t starting_power = 0) {
this->build_points_map();

typename field_type::value_type theta_acc = theta.pow(starting_power);
polynomial_type combined_Q;
math::polynomial<value_type> V;
Expand All @@ -290,8 +292,10 @@ namespace nil {
math::polynomial<value_type> Q_normal;
for (std::size_t i: this->_z.get_batches()) {
for (std::size_t j = 0; j < this->_z.get_batch_size(i); j++) {
auto it = std::find(this->_points[i][j].begin(), this->_points[i][j].end(), point);
if( it == this->_points[i][j].end()) continue;
auto iter = this->_points_map[i][j].find(point);
if (iter == this->_points_map[i][j].end())
continue;

math::polynomial<value_type> g_normal;
if constexpr(std::is_same<math::polynomial_dfs<value_type>, PolynomialType>::value ) {
g_normal = math::polynomial<value_type>(this->_polys[i][j].coefficients());
Expand Down

0 comments on commit 5cfa30a

Please sign in to comment.