-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7074467
commit 3f50cef
Showing
2 changed files
with
50 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
use std::ops::Mul; | ||
|
||
use num_traits::One; | ||
|
||
use super::EvalAtRow; | ||
use crate::core::fields::m31::BaseField; | ||
use crate::core::fields::qm31::SecureField; | ||
use crate::core::pcs::TreeVec; | ||
|
||
/// Collects information about the constraints. | ||
/// This includes mask offsets and columns at each interaction, and the number of constraints. | ||
#[derive(Default)] | ||
pub struct InfoEvaluator { | ||
pub mask_offsets: TreeVec<Vec<Vec<isize>>>, | ||
pub n_constraints: usize, | ||
} | ||
impl InfoEvaluator { | ||
pub fn new() -> Self { | ||
Self::default() | ||
} | ||
} | ||
impl EvalAtRow for InfoEvaluator { | ||
type F = BaseField; | ||
type EF = SecureField; | ||
fn next_interaction_mask<const N: usize>( | ||
&mut self, | ||
interaction: usize, | ||
offsets: [isize; N], | ||
) -> [Self::F; N] { | ||
// Check if requested a mask from a | ||
if self.mask_offsets.len() <= interaction { | ||
// Resize `mask_offsets` so that `interaction` is the last index. | ||
self.mask_offsets.resize(interaction + 1, vec![]); | ||
} | ||
self.mask_offsets[interaction].push(offsets.into_iter().collect()); | ||
[BaseField::one(); N] | ||
} | ||
fn add_constraint<G>(&mut self, _constraint: G) | ||
where | ||
Self::EF: Mul<G, Output = Self::EF>, | ||
{ | ||
self.n_constraints += 1; | ||
} | ||
|
||
fn combine_ef(_values: [Self::F; 4]) -> Self::EF { | ||
SecureField::one() | ||
} | ||
} |
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