mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-08 00:33:06 +00:00
Renaming
This commit is contained in:
parent
0541956942
commit
e87aa2c90b
@ -268,7 +268,7 @@ impl<F: Extendable<D>, const D: usize> CircuitBuilder<F, D> {
|
||||
let g = self.constant(F::MULTIPLICATIVE_GROUP_GENERATOR);
|
||||
let phi = self.constant(F::primitive_root_of_unity(n_log));
|
||||
|
||||
let reversed_x = self.base_sum(x_index_bits.iter().rev());
|
||||
let reversed_x = self.le_sum(x_index_bits.iter().rev());
|
||||
let phi = self.exp(phi, reversed_x, n_log);
|
||||
self.mul(g, phi)
|
||||
});
|
||||
@ -308,7 +308,7 @@ impl<F: Extendable<D>, const D: usize> CircuitBuilder<F, D> {
|
||||
// Insert P(y) into the evaluation vector, since it wasn't included by the prover.
|
||||
let high_x_index_bits = x_index_bits.split_off(arity_bits);
|
||||
old_x_index_bits = x_index_bits;
|
||||
let low_x_index = self.base_sum(old_x_index_bits.iter());
|
||||
let low_x_index = self.le_sum(old_x_index_bits.iter());
|
||||
evals = self.insert(low_x_index, e_x, evals);
|
||||
context!(
|
||||
self,
|
||||
|
||||
@ -39,26 +39,28 @@ impl<F: Extendable<D>, const D: usize> CircuitBuilder<F, D> {
|
||||
Target::wire(gate, BaseSumGate::<B>::WIRE_REVERSED_SUM)
|
||||
}
|
||||
|
||||
pub(crate) fn base_sum(
|
||||
/// Takes an iterator of bits `(b_i)` and returns `sum b_i * 2^i`, i.e.,
|
||||
/// the number with little-endian bit representation given by `bits`.
|
||||
pub(crate) fn le_sum(
|
||||
&mut self,
|
||||
limbs: impl ExactSizeIterator<Item = impl Borrow<Target>> + Clone,
|
||||
bits: impl ExactSizeIterator<Item = impl Borrow<Target>> + Clone,
|
||||
) -> Target {
|
||||
let num_limbs = limbs.len();
|
||||
let num_bits = bits.len();
|
||||
debug_assert!(
|
||||
BaseSumGate::<2>::START_LIMBS + num_limbs <= self.config.num_routed_wires,
|
||||
BaseSumGate::<2>::START_LIMBS + num_bits <= self.config.num_routed_wires,
|
||||
"Not enough routed wires."
|
||||
);
|
||||
let gate_index = self.add_gate(BaseSumGate::<2>::new(num_limbs), vec![]);
|
||||
for (limb, wire) in limbs
|
||||
let gate_index = self.add_gate(BaseSumGate::<2>::new(num_bits), vec![]);
|
||||
for (limb, wire) in bits
|
||||
.clone()
|
||||
.zip(BaseSumGate::<2>::START_LIMBS..BaseSumGate::<2>::START_LIMBS + num_limbs)
|
||||
.zip(BaseSumGate::<2>::START_LIMBS..BaseSumGate::<2>::START_LIMBS + num_bits)
|
||||
{
|
||||
self.route(*limb.borrow(), Target::wire(gate_index, wire));
|
||||
}
|
||||
|
||||
self.add_generator(BaseSumGenerator::<2> {
|
||||
gate_index,
|
||||
limbs: limbs.map(|l| *l.borrow()).collect(),
|
||||
limbs: bits.map(|l| *l.borrow()).collect(),
|
||||
});
|
||||
|
||||
Target::wire(gate_index, BaseSumGate::<2>::WIRE_SUM)
|
||||
@ -143,7 +145,7 @@ mod tests {
|
||||
let zero = builder.zero();
|
||||
let one = builder.one();
|
||||
|
||||
let y = builder.base_sum(
|
||||
let y = builder.le_sum(
|
||||
(0..10)
|
||||
.scan(n, |acc, _| {
|
||||
let tmp = *acc % 2;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user