Skip to content

Commit

Permalink
Do not fmt the cond add constrains
Browse files Browse the repository at this point in the history
  • Loading branch information
drskalman committed Oct 7, 2024
1 parent d57015f commit c565032
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 11 deletions.
44 changes: 38 additions & 6 deletions common/src/gadgets/sw_cond_add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,44 @@ where
let (x2, y2) = (&self.points.xs.evals_4x, &self.points.ys.evals_4x);
let (x3, y3) = (&self.acc.xs.shifted_4x(), &self.acc.ys.shifted_4x());

let mut c1 = &(b * &(&(&(&(x1 - x2) * &(x1 - x2)) * &(&(x1 + x2) + x3))
- &(&(y2 - y1) * &(y2 - y1))))
+ &(&(one - b) * &(y3 - y1));

let mut c2 = &(b * &(&(&(x1 - x2) * &(y3 + y1)) - &(&(y2 - y1) * &(x3 - x1))))
+ &(&(one - b) * &(x3 - x1));
#[rustfmt::skip]
let mut c1 =
&(
b *
&(
&(
&(
&(x1 - x2) * &(x1 - x2)
) *
&(
&(x1 + x2) + x3
)
) -
&(
&(y2 - y1) * &(y2 - y1)
)
)
) +
&(
&(one - b) * &(y3 - y1)
);

#[rustfmt::skip]
let mut c2 =
&(
b *
&(
&(
&(x1 - x2) * &(y3 + y1)
) -
&(
&(y2 - y1) * &(x3 - x1)
)
)
) +
&(
&(one - b) * &(x3 - x1)
);

let not_last = &self.not_last.evals_4x;
c1 *= not_last;
Expand Down
44 changes: 39 additions & 5 deletions common/src/gadgets/te_cond_add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,46 @@ where
let (x3, y3) = (&self.acc.xs.shifted_4x(), &self.acc.ys.shifted_4x());

//b (x_3 (y_1 y_2 + ax_1 x_2) - x_1 y_1 - y_2 x_2) + (1 - b) (x_3 - x_1) = 0
let mut c1 = &(b * &(&(x3 * &(&(y1 * y2) + &(te_a_coeff * &(x1 * x2))))
- &(&(x1 * y1) + &(y2 * x2))))
+ &(&(one - b) * &(x3 - x1));
#[rustfmt::skip]
let mut c1 =
&(
b *
&(
&(
x3 *
&(
&(y1 * y2) +

&(te_a_coeff *
&(x1 * x2)
)
)
)
-
&(
&(x1 * y1) + &(y2* x2)
)
)
) +
&(
&(one - b) * &(x3 - x1)
);

//b (y_3 (x_1 y_2 - x_2 y_1) - x_1 y_1 + x_2 y_2) + (1 - b) (y_3 - y_1) = 0
let mut c2 = &(b * &(&(y3 * &(&(x1 * y2) - &(x2 * y1))) - &(&(x1 * y1) - &(x2 * y2))))
+ &(&(one - b) * &(y3 - y1));
#[rustfmt::skip]
let mut c2 =
&(
b *
&( &(y3 *
&(
&(x1 * y2) - &(x2 * y1))) -
&(&(x1 * y1) - &(x2 * y2))
)
)
+
&(
&(one - b) * &(y3 - y1)
);

let not_last = &self.not_last.evals_4x;
c1 *= not_last;
Expand Down

0 comments on commit c565032

Please sign in to comment.