Skip to content
Snippets Groups Projects

Resolve "Create function reed_decode"

Merged nicolas.albanesi requested to merge 16-create-function-reed_decode into main
2 files
+ 15
4
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 2
2
@@ -38,7 +38,7 @@ class polynome():
@@ -38,7 +38,7 @@ class polynome():
coeff_poly_res = [0] * (len(self.coefs) + len(poly_2.coefs) - 1)
coeff_poly_res = [0] * (len(self.coefs) + len(poly_2.coefs) - 1)
for index_1, value_1 in enumerate(self.coefs):
for index_1, value_1 in enumerate(self.coefs):
for index_2, value_2 in enumerate(poly_2.coefs):
for index_2, value_2 in enumerate(poly_2.coefs):
coeff_poly_res[index_1 + index_2] += value_1 * value_2
coeff_poly_res[index_1 + index_2] += (value_1 * value_2) % self.prime_mod
return polynome(coeff_poly_res)
return polynome(coeff_poly_res)
def evaluate(self, x):
def evaluate(self, x):
@@ -46,4 +46,4 @@ class polynome():
@@ -46,4 +46,4 @@ class polynome():
res = 0
res = 0
for i in range(len(self.coefs) - 1, -1, -1):
for i in range(len(self.coefs) - 1, -1, -1):
res = (res * x + self.coefs[i])
res = (res * x + self.coefs[i])
return res
return (res % self.prime_mod)
Loading