Skip to content
Snippets Groups Projects
Commit 5421607c authored by Djokzer's avatar Djokzer
Browse files

Pulled main

parent 73426291
No related branches found
No related tags found
1 merge request!10Resolve "Create Lagrange method"
**/__pycache__ **/__pycache__
\ No newline at end of file **/test.py
...@@ -45,5 +45,5 @@ class polynome(): ...@@ -45,5 +45,5 @@ class polynome():
# Using horner method # Using horner method
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]) % self.prime_mod res = (res * x + self.coefs[i])
return res return res
# Created on 09/12/2021 # Created on 09/12/2021
from polynome import * from polynome import *
from inverse_mult import * from inverse_mult import *
from itertools import combinations
def get_possibilities(l: list): def get_possibilities(l: list):
pass
# Transforme the list in list of tupples with their indexes
for x, _ in enumerate(l):
l[x] = (x, l[x])
# ! la valeur 20 est hardcodée. Paramètre de fonction ??
l_fixe = l[20:] # Liste contenant aucune erreur
l_posi = l[:20] # Liste contenant des erreurs,
p = list(combinations(l_posi, 2))
for x, y in enumerate(p):
p[x] = list(y)
p[x].extend(l_fixe)
return p
def lagrange_compute(l: list) -> polynome: def lagrange_compute(l: list) -> polynome:
list_s = [0] * len(l) list_s = [0] * len(l)
...@@ -37,4 +54,4 @@ if __name__ == '__main__': ...@@ -37,4 +54,4 @@ if __name__ == '__main__':
#print(list_) #print(list_)
poly = lagrange_compute(list_) poly = lagrange_compute(list_)
poly.show() poly.show()
#print(poly.evaluate(0)) #print(poly.evaluate(0))
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment