This commit is contained in:
Nicholas Ward 2022-02-11 13:24:46 -08:00
parent f67e12ee64
commit 12d5239be6
2 changed files with 12 additions and 2 deletions

View File

@ -95,6 +95,16 @@ impl<F: RichField + Extendable<D>, const D: usize> CircuitBuilder<F, D> {
AffinePointTarget { x: x3, y: y3 }
}
pub fn curve_repeated_double<C: Curve>(&mut self, p: &AffinePointTarget<C>, n: usize) -> AffinePointTarget<C> {
let mut result = p.clone();
for _ in 0..n {
result = self.curve_double(&result);
}
result
}
// Add two points, which are assumed to be non-equal.
pub fn curve_add<C: Curve>(
&mut self,

View File

@ -82,7 +82,7 @@ impl<F: RichField + Extendable<D>, const D: usize> CircuitBuilder<F, D> {
let windows = self.split_nonnative_to_4_bit_limbs(n);
let m = C::ScalarField::BITS / WINDOW_SIZE;
for i in (0..m).rev() {
result = self.curve_double(&result);
result = self.curve_repeated_double(&result, WINDOW_SIZE);
let window = windows[i];
let to_add = self.random_access_curve_points(window, precomputation.clone());
@ -147,7 +147,7 @@ mod tests {
}
#[test]
fn test_curve_mul_windowed() -> Result<()> {
fn test_curve_windowed_mul() -> Result<()> {
const D: usize = 2;
type C = PoseidonGoldilocksConfig;
type F = <C as GenericConfig<D>>::F;