-
Notifications
You must be signed in to change notification settings - Fork 271
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ProverPolynomials owns its memory (#3560)
Makes ProverPolynomials no longer use a span - Polynomial class already used shared memory, now allowing shifted polynomials to be represented by the same class - Fixes #2213 by using ranges defined in entity classes - For safety, deletes the full-copy assignment and constructor of ProverPolynomials, so that we correctly std::move it around. This can possibly be removed, but wanted to catch any now-different-semantics usage and avoid extra copies - Makes explicit share() calls wherever semantics were to share before due to std::span usage. shifted() is similar, shares underlying memory, shifted - Remove cruft needed with a separate polynomial storages variable, some might remain --------- Co-authored-by: ludamad <adam@aztecprotocol.com>
- Loading branch information
Showing
54 changed files
with
751 additions
and
1,405 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#include "std_string.hpp" | ||
#include <algorithm> | ||
#include <cctype> | ||
#include <iostream> | ||
#include <locale> | ||
#include <sstream> | ||
#include <vector> | ||
|
||
namespace barretenberg::detail { | ||
std::vector<std::string> split(const std::string& str, char delimiter) | ||
{ | ||
std::vector<std::string> result; | ||
std::istringstream iss(str); | ||
std::string token; | ||
|
||
while (std::getline(iss, token, delimiter)) { | ||
result.push_back(token); | ||
} | ||
|
||
return result; | ||
} | ||
|
||
// trim from start (in place) | ||
void ltrim(std::string& s) | ||
{ | ||
s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](unsigned char ch) { return !std::isspace(ch); })); | ||
} | ||
|
||
// trim from end (in place) | ||
void rtrim(std::string& s) | ||
{ | ||
s.erase(std::find_if(s.rbegin(), s.rend(), [](unsigned char ch) { return !std::isspace(ch); }).base(), s.end()); | ||
} | ||
|
||
// trim from both ends (in place) | ||
void trim(std::string& s) | ||
{ | ||
rtrim(s); | ||
ltrim(s); | ||
} | ||
std::vector<std::string> split_and_trim(const std::string& str, char delimiter) | ||
{ | ||
std::vector<std::string> ret = split(str, delimiter); | ||
for (std::string& part : ret) { | ||
trim(part); | ||
} | ||
return ret; | ||
} | ||
} // namespace barretenberg::detail |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include <string> | ||
#include <vector> | ||
|
||
namespace barretenberg::detail { | ||
std::vector<std::string> split(const std::string& str, char delimiter); | ||
// trim from start (in place) | ||
void ltrim(std::string& s); | ||
// trim from end (in place) | ||
void rtrim(std::string& s); | ||
// trim from both ends (in place) | ||
void trim(std::string& s); | ||
|
||
// Used to extract variables from a macro #__VA_ARGS__ | ||
std::vector<std::string> split_and_trim(const std::string& str, char delimiter); | ||
} // namespace barretenberg::detail |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#pragma once | ||
#include <vector> | ||
|
||
// TODO(https://github.com/AztecProtocol/barretenberg/issues/794) namespace this once convenient | ||
/** | ||
* @brief Concatenates multiple std::vector objects into a single std::vector. | ||
* | ||
* @tparam T The type of elements in the std::vector. | ||
* @param vectors The std::vector objects to be concatenated. | ||
* @return std::vector object containing all elements from the input vectors. | ||
*/ | ||
template <typename T> std::vector<T> concatenate(const std::vector<T>& vector, const auto&... vectors) | ||
{ | ||
std::vector<T> concatenated; | ||
// Reserve our final space | ||
concatenated.reserve(vector.size() + (vectors.size() + ...)); | ||
|
||
auto append = [&](const auto& vec) { std::copy(vec.begin(), vec.end(), std::back_inserter(concatenated)); }; | ||
|
||
append(vector); | ||
// Unpack and append each std::vector's elements to concatenated | ||
(append(vectors), ...); | ||
|
||
return concatenated; | ||
} |
Oops, something went wrong.