Skip to content

Commit

Permalink
compute sparsity iff sparse
Browse files Browse the repository at this point in the history
  • Loading branch information
feltroidprime committed Feb 21, 2024
1 parent aaeeced commit e06f26f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/extension_field_modulo_circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ def eval_poly_in_precomputed_Z(
assert len(X) <= len(
self.z_powers
), f"{len(X)} > Zpowlen = {len(self.z_powers)}"
sparsity = [1 if elmt != self.field.zero() else 0 for elmt in X]

if not sparse:
X_of_z = X[0]
for i in range(1, len(X)):
X_of_z = self.add(X_of_z, self.mul(X[i], self.z_powers[i - 1]))
else:
sparsity = [1 if elmt.value != 0 else 0 for elmt in X]
first_non_zero_idx = sparsity.index(1)
if first_non_zero_idx == 0:
X_of_z = X[0]
Expand Down Expand Up @@ -227,7 +227,7 @@ def extf_div(
x_over_y, _, _ = self.write_commitments(x_over_y)
s1 = self.transcript.RLC_coeff
s1 = self.field(s1)
Q, R = nondeterministic_extension_field_mul_divmod(
Q, _ = nondeterministic_extension_field_mul_divmod(
x_over_y, Y, self.curve_id, extension_degree
)
# R should be X
Expand Down

0 comments on commit e06f26f

Please sign in to comment.