mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-08 16:53:07 +00:00
fixes
This commit is contained in:
parent
e88564ce5e
commit
0140f7a3cf
@ -23,15 +23,19 @@ impl<F: RichField + Extendable<D>, const D: usize> CircuitBuilder<F, D> {
|
|||||||
&mut self,
|
&mut self,
|
||||||
p: &AffinePointTarget<C>,
|
p: &AffinePointTarget<C>,
|
||||||
) -> Vec<AffinePointTarget<C>> {
|
) -> Vec<AffinePointTarget<C>> {
|
||||||
let mut multiples = vec![self.constant_affine_point(C::GENERATOR_AFFINE)];
|
let neg = {
|
||||||
let mut cur = p.clone();
|
let mut g = C::GENERATOR_AFFINE;
|
||||||
for _pow in 0..WINDOW_SIZE {
|
g.y = -g.y;
|
||||||
for existing in multiples.clone() {
|
self.constant_affine_point(g)
|
||||||
multiples.push(self.curve_add(&cur, &existing));
|
};
|
||||||
}
|
|
||||||
cur = self.curve_double(&cur);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
let mut multiples = vec![self.constant_affine_point(C::GENERATOR_AFFINE)];
|
||||||
|
for i in 1..1 << WINDOW_SIZE {
|
||||||
|
multiples.push(self.curve_add(p, &multiples[i - 1]));
|
||||||
|
}
|
||||||
|
for i in 1..1 << WINDOW_SIZE {
|
||||||
|
multiples[i] = self.curve_add(&neg, &multiples[i]);
|
||||||
|
}
|
||||||
multiples
|
multiples
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,8 +111,7 @@ impl<F: RichField + Extendable<D>, const D: usize> CircuitBuilder<F, D> {
|
|||||||
let zero = self.zero();
|
let zero = self.zero();
|
||||||
|
|
||||||
let windows = self.split_nonnative_to_4_bit_limbs(n);
|
let windows = self.split_nonnative_to_4_bit_limbs(n);
|
||||||
let m = C::ScalarField::BITS / WINDOW_SIZE;
|
for i in (0..windows.len()).rev() {
|
||||||
for i in (0..m).rev() {
|
|
||||||
result = self.curve_repeated_double(&result, WINDOW_SIZE);
|
result = self.curve_repeated_double(&result, WINDOW_SIZE);
|
||||||
let window = windows[i];
|
let window = windows[i];
|
||||||
|
|
||||||
|
|||||||
@ -150,6 +150,7 @@ impl<F: RichField + Extendable<D>, const D: usize> CircuitBuilder<F, D> {
|
|||||||
/// generate the final witness (a grid of wire values), these virtual targets will go away.
|
/// generate the final witness (a grid of wire values), these virtual targets will go away.
|
||||||
pub fn add_virtual_target(&mut self) -> Target {
|
pub fn add_virtual_target(&mut self) -> Target {
|
||||||
let index = self.virtual_target_index;
|
let index = self.virtual_target_index;
|
||||||
|
|
||||||
self.virtual_target_index += 1;
|
self.virtual_target_index += 1;
|
||||||
Target::VirtualTarget { index }
|
Target::VirtualTarget { index }
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user