mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-08 08:43:06 +00:00
Remove prefix before calling eval_unfiltered_*
This commit is contained in:
parent
c01e772fd8
commit
0a75dcdb95
@ -58,8 +58,9 @@ pub trait Gate<F: Extendable<D>, const D: usize>: 'static + Send + Sync {
|
||||
vars: EvaluationTargets<D>,
|
||||
) -> Vec<ExtensionTarget<D>>;
|
||||
|
||||
fn eval_filtered(&self, vars: EvaluationVars<F, D>, prefix: &[bool]) -> Vec<F::Extension> {
|
||||
fn eval_filtered(&self, mut vars: EvaluationVars<F, D>, prefix: &[bool]) -> Vec<F::Extension> {
|
||||
let filter = compute_filter(prefix, vars.local_constants);
|
||||
vars.remove_prefix(prefix);
|
||||
self.eval_unfiltered(vars)
|
||||
.into_iter()
|
||||
.map(|c| filter * c)
|
||||
@ -67,8 +68,9 @@ pub trait Gate<F: Extendable<D>, const D: usize>: 'static + Send + Sync {
|
||||
}
|
||||
|
||||
/// Like `eval_filtered`, but specialized for points in the base field.
|
||||
fn eval_filtered_base(&self, vars: EvaluationVarsBase<F>, prefix: &[bool]) -> Vec<F> {
|
||||
fn eval_filtered_base(&self, mut vars: EvaluationVarsBase<F>, prefix: &[bool]) -> Vec<F> {
|
||||
let filter = compute_filter(prefix, vars.local_constants);
|
||||
vars.remove_prefix(prefix);
|
||||
self.eval_unfiltered_base(vars)
|
||||
.into_iter()
|
||||
.map(|c| c * filter)
|
||||
|
||||
10
src/vars.rs
10
src/vars.rs
@ -27,6 +27,16 @@ impl<'a, F: Extendable<D>, const D: usize> EvaluationVars<'a, F, D> {
|
||||
let arr = self.local_wires[wire_range].try_into().unwrap();
|
||||
ExtensionAlgebra::from_basefield_array(arr)
|
||||
}
|
||||
|
||||
pub fn remove_prefix(&mut self, prefix: &[bool]) {
|
||||
self.local_constants = &self.local_constants[prefix.len()..];
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, F: Field> EvaluationVarsBase<'a, F> {
|
||||
pub fn remove_prefix(&mut self, prefix: &[bool]) {
|
||||
self.local_constants = &self.local_constants[prefix.len()..];
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user