Skip to content

Commit

Permalink
relation tracker bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ohad-starkware committed Dec 3, 2024
1 parent df4a642 commit 1d08a19
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions crates/prover/src/constraint_framework/relation_tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,10 @@ impl<'a> EvalAtRow for RelationTrackerEvaluator<'a> {
if cannonical_index >= self.n_rows {
continue;
}
let values = values.iter().map(|v| v[j]).collect_vec();
let mut values = values.iter().map(|v| v[j]).collect_vec();
while values.last().is_some_and(|v| v.is_zero()) {
values.pop();
}
let mult = mult[j].to_m31_array()[0];
self.entries.push(RelationTrackerEntry {
relation: relation.clone(),
Expand All @@ -194,9 +197,15 @@ impl RelationSummary {
/// Returns the sum of every entry's yields and uses.
/// The result is a map from relation name to a list of values(M31 vectors) and their sum.
pub fn summarize_relations(entries: &[RelationTrackerEntry]) -> Self {
let mut entry_by_relation = HashMap::new();
for entry in entries {
entry_by_relation
.entry(entry.relation.clone())
.or_insert_with(Vec::new)
.push(entry);
}
let mut summary = vec![];
let relations = entries.iter().group_by(|entry| entry.relation.clone());
for (relation, entries) in &relations {
for (relation, entries) in entry_by_relation {
let mut relation_sums: HashMap<Vec<_>, M31> = HashMap::new();
for entry in entries {
let mult = relation_sums
Expand Down

0 comments on commit 1d08a19

Please sign in to comment.