Skip to content

Commit

Permalink
add more auto-generated comments
Browse files Browse the repository at this point in the history
  • Loading branch information
feltroidprime committed Aug 21, 2024
1 parent e57c1f2 commit fba8e61
Show file tree
Hide file tree
Showing 2 changed files with 1,401 additions and 1,369 deletions.
74 changes: 53 additions & 21 deletions hydra/garaga/precompiled_circuits/ec.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,28 +264,44 @@ def _eval_function_challenge_dupl(

F_A0 = self.add(
self.div(
self.eval_horner(log_div_a_num, xA0),
self.eval_horner(log_div_a_den, xA0),
self.eval_horner(
log_div_a_num, xA0, poly_name="sumdlogdiv_a_num", var_name="xA0"
),
self.eval_horner(
log_div_a_den, xA0, poly_name="sumdlogdiv_a_den", var_name="xA0"
),
),
self.mul(
yA0,
self.div(
self.eval_horner(log_div_b_num, xA0),
self.eval_horner(log_div_b_den, xA0),
self.eval_horner(
log_div_b_num, xA0, poly_name="sumdlogdiv_b_num", var_name="xA0"
),
self.eval_horner(
log_div_b_den, xA0, poly_name="sumdlogdiv_b_den", var_name="xA0"
),
),
),
)

F_A2 = self.add(
self.div(
self.eval_horner(log_div_a_num, xA2),
self.eval_horner(log_div_a_den, xA2),
self.eval_horner(
log_div_a_num, xA2, poly_name="sumdlogdiv_a_num", var_name="xA2"
),
self.eval_horner(
log_div_a_den, xA2, poly_name="sumdlogdiv_a_den", var_name="xA2"
),
),
self.mul(
yA2,
self.div(
self.eval_horner(log_div_b_num, xA2),
self.eval_horner(log_div_b_den, xA2),
self.eval_horner(
log_div_b_num, xA2, poly_name="sumdlogdiv_b_num", var_name="xA2"
),
self.eval_horner(
log_div_b_den, xA2, poly_name="sumdlogdiv_b_den", var_name="xA2"
),
),
),
)
Expand All @@ -312,19 +328,35 @@ def _init_function_challenge_dupl(
# Precompute powers of xA0 and xA2 for evaluating the polynomials.
xA0_powers = [xA0]
xA2_powers = [xA2]
for _ in range(len(log_div_b_den) - 2):
xA0_powers.append(self.mul(xA0_powers[-1], xA0))
xA2_powers.append(self.mul(xA2_powers[-1], xA2))

A_NUM_A0 = self.eval_poly(log_div_a_num, xA0_powers)
A_DEN_A0 = self.eval_poly(log_div_a_den, xA0_powers)
B_NUM_A0 = self.eval_poly(log_div_b_num, xA0_powers)
B_DEN_A0 = self.eval_poly(log_div_b_den, xA0_powers)

A_NUM_A2 = self.eval_poly(log_div_a_num, xA2_powers)
A_DEN_A2 = self.eval_poly(log_div_a_den, xA2_powers)
B_NUM_A2 = self.eval_poly(log_div_b_num, xA2_powers)
B_DEN_A2 = self.eval_poly(log_div_b_den, xA2_powers)
for i in range(len(log_div_b_den) - 2):
xA0_powers.append(self.mul(xA0_powers[-1], xA0, comment=f"xA0^{i+2}"))
xA2_powers.append(self.mul(xA2_powers[-1], xA2, comment=f"xA2^{i+2}"))

A_NUM_A0 = self.eval_poly(
log_div_a_num, xA0_powers, poly_name="sumdlogdiv_a_num", var_name="xA0"
)
A_DEN_A0 = self.eval_poly(
log_div_a_den, xA0_powers, poly_name="sumdlogdiv_a_den", var_name="xA0"
)
B_NUM_A0 = self.eval_poly(
log_div_b_num, xA0_powers, poly_name="sumdlogdiv_b_num", var_name="xA0"
)
B_DEN_A0 = self.eval_poly(
log_div_b_den, xA0_powers, poly_name="sumdlogdiv_b_den", var_name="xA0"
)

A_NUM_A2 = self.eval_poly(
log_div_a_num, xA2_powers, poly_name="sumdlogdiv_a_num", var_name="xA2"
)
A_DEN_A2 = self.eval_poly(
log_div_a_den, xA2_powers, poly_name="sumdlogdiv_a_den", var_name="xA2"
)
B_NUM_A2 = self.eval_poly(
log_div_b_num, xA2_powers, poly_name="sumdlogdiv_b_num", var_name="xA2"
)
B_DEN_A2 = self.eval_poly(
log_div_b_den, xA2_powers, poly_name="sumdlogdiv_b_den", var_name="xA2"
)

# return F(A0) and F(A2), and the last power of xA0 and xA2 used in a_den (also equal to b_num)

Expand Down
Loading

0 comments on commit fba8e61

Please sign in to comment.