mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-07 16:23:12 +00:00
Implement eval_unfiltered_base
This commit is contained in:
parent
c0f09591ee
commit
d509f03b1b
@ -77,6 +77,32 @@ impl<F: Extendable<D>, const D: usize> Gate<F, D> for ReducingGate<D> {
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn eval_unfiltered_base(&self, vars: EvaluationVarsBase<F>) -> Vec<F> {
|
||||
let output = vars.get_local_ext(Self::wires_output());
|
||||
let alpha = vars.get_local_ext(Self::wires_alpha());
|
||||
let old_acc = vars.get_local_ext(Self::wires_old_acc());
|
||||
let coeffs = self
|
||||
.wires_coeffs()
|
||||
.map(|i| vars.local_wires[i])
|
||||
.collect::<Vec<_>>();
|
||||
let accs = (0..self.num_coeffs)
|
||||
.map(|i| vars.get_local_ext(self.wires_accs(i)))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let mut constraints = Vec::new();
|
||||
let mut acc = old_acc;
|
||||
for i in 0..self.num_coeffs {
|
||||
constraints.push(acc * alpha + coeffs[i].into() - accs[i]);
|
||||
acc = accs[i];
|
||||
}
|
||||
|
||||
constraints.push(output - acc);
|
||||
constraints
|
||||
.into_iter()
|
||||
.flat_map(|alg| alg.to_basefield_array())
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn eval_unfiltered_recursively(
|
||||
&self,
|
||||
builder: &mut CircuitBuilder<F, D>,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user