Skip to content

Commit ab72984

Browse files
committed
Comments
1 parent 1f8230b commit ab72984

File tree

1 file changed

+9
-2
lines changed
  • src/backends/plonky2/primitives/ec/gates

1 file changed

+9
-2
lines changed

src/backends/plonky2/primitives/ec/gates/generic.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,9 +453,10 @@ where
453453
}
454454

455455
fn eval_unfiltered(&self, vars: EvaluationVars<F, D>) -> Vec<F::Extension> {
456-
// We think of vars as a list of G::WIRES_PER_OP elements of ExtensionAlgebra<F,D>.
456+
// We think of `vars.local_wires` as a list of G::WIRES_PER_OP
457+
// elements of ExtensionAlgebra<F,D>.
457458
// We use the fact that ExtensionAlgebra<F,D> is isomorphic to D copies of
458-
// F::Extension, with the isomorphism given by (a \otimes b) ->
459+
// F::Extension, with the isomorphism given by (a b) ->
459460
// [a.repeated_frobenius(j) * b for j in 0..D].
460461
let mut constraints = Vec::with_capacity(D * G::OUTPUTS_PER_OP);
461462
let mut evals: [Vec<F::Extension>; D] = core::array::from_fn(|_| Vec::new());
@@ -466,9 +467,13 @@ where
466467
for i in 0..self.max_ops {
467468
let input_start = D * G::WIRES_PER_OP * i;
468469
let output_start = input_start + D * G::INPUTS_PER_OP;
470+
// Phase factor for Frobenius automorphism
471+
// application, cf. definition of `repeated_frobenius`
472+
// in plonky2/field/src/extension/mod.rs.
469473
let mut phase = F::ONE;
470474
for ev in evals.iter_mut() {
471475
inputs.clear();
476+
// Collect input wires.
472477
for j in 0..G::INPUTS_PER_OP {
473478
let var_start = input_start + D * j;
474479
let var: [[F; D]; D] = core::array::from_fn(|k| {
@@ -489,6 +494,7 @@ where
489494
}
490495
inputs.push(F::Extension::from_basefield_array(input));
491496
}
497+
// Evaluate SimpleGate.
492498
*ev = G::eval(&inputs);
493499
phase *= F::DTH_ROOT;
494500
}
@@ -520,6 +526,7 @@ where
520526
constraints
521527
}
522528

529+
// Recursive constraint analogue to `eval_unfiltered`.
523530
fn eval_unfiltered_circuit(
524531
&self,
525532
builder: &mut plonky2::plonk::circuit_builder::CircuitBuilder<F, D>,

0 commit comments

Comments
 (0)