From f8804cb22b726c00a135d8c0b59d3b58eeadd217 Mon Sep 17 00:00:00 2001 From: Dmitry <98899785+mdqst@users.noreply.github.com> Date: Tue, 14 Oct 2025 00:12:30 +0300 Subject: [PATCH 1/2] chore: fix accumulation logic for `PrimeField` vectors --- src/r1cs/sparse.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/r1cs/sparse.rs b/src/r1cs/sparse.rs index 65ea3b983..30e9e56ba 100644 --- a/src/r1cs/sparse.rs +++ b/src/r1cs/sparse.rs @@ -91,7 +91,7 @@ impl SparseMatrix { self .get_row_unchecked(ptrs.try_into().unwrap()) .map(|(val, col_idx)| *val * vector[*col_idx]) - .sum() + .fold(F::zero(), |acc, x| acc + x) }) .collect() } From 72bdd1ae07c2449de87e2e2d31b881ea55c155c2 Mon Sep 17 00:00:00 2001 From: Dmitry <98899785+mdqst@users.noreply.github.com> Date: Fri, 5 Dec 2025 12:42:21 +0300 Subject: [PATCH 2/2] Update sparse.rs --- src/r1cs/sparse.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/r1cs/sparse.rs b/src/r1cs/sparse.rs index 30e9e56ba..15972eccc 100644 --- a/src/r1cs/sparse.rs +++ b/src/r1cs/sparse.rs @@ -91,7 +91,7 @@ impl SparseMatrix { self .get_row_unchecked(ptrs.try_into().unwrap()) .map(|(val, col_idx)| *val * vector[*col_idx]) - .fold(F::zero(), |acc, x| acc + x) + .fold(F::ZERO, |acc, x| acc + x) }) .collect() }