Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
interaction_builder.cpp
Go to the documentation of this file.
1
#include "
barretenberg/vm2/tracegen/lib/interaction_builder.hpp
"
2
3
#include <algorithm>
4
5
#include "
barretenberg/vm2/common/set.hpp
"
6
7
namespace
bb::avm2::tracegen
{
8
9
void
order_jobs_by_destination_columns
(std::vector<
std::unique_ptr<InteractionBuilderInterface>
>& jobs)
10
{
11
// Identify first occurrences of each fingerprint.
12
unordered_flat_set<size_t>
seen_fingerprints;
13
unordered_flat_set<InteractionBuilderInterface*>
first_occurrence_jobs;
14
15
for
(
const
auto
& job : jobs) {
16
auto
fp = job->get_destination_columns_fingerprint();
17
auto
[_, inserted] = seen_fingerprints.insert(fp);
18
if
(inserted) {
19
first_occurrence_jobs.insert(job.get());
20
}
21
}
22
23
// Stable partition: first occurrences come first.
24
std::ranges::stable_partition(jobs, [&](
const
auto
& job) {
return
first_occurrence_jobs.contains(job.get()); });
25
}
26
27
}
// namespace bb::avm2::tracegen
interaction_builder.hpp
bb::avm2::tracegen
Definition
full_row.hpp:9
bb::avm2::tracegen::order_jobs_by_destination_columns
void order_jobs_by_destination_columns(std::vector< std::unique_ptr< InteractionBuilderInterface > > &jobs)
Definition
interaction_builder.cpp:9
bb::avm2::unordered_flat_set
::ankerl::unordered_dense::set< Key > unordered_flat_set
Definition
set.hpp:11
std::get
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition
tuple.hpp:13
set.hpp
src
barretenberg
vm2
tracegen
lib
interaction_builder.cpp
Generated by
1.9.8