Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
ISC_122 - Travail Pratique 001 - Code de Reed-Solomon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
florian.burgener
ISC_122 - Travail Pratique 001 - Code de Reed-Solomon
Commits
ad31f8bc
Commit
ad31f8bc
authored
3 years ago
by
quentin.fasler
Browse files
Options
Downloads
Plain Diff
Merge branch 'main' of
ssh://ssh.hesge.ch:10572/florian.burgener/math-tp-001
parents
53507693
629e1bc3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
polynomial.py
+25
-1
25 additions, 1 deletion
polynomial.py
with
25 additions
and
1 deletion
polynomial.py
+
25
−
1
View file @
ad31f8bc
import
math
from
numbers
import
Number
import
itertools
import
json
...
...
@@ -77,6 +78,7 @@ class Polynomial:
str_value
=
""
for
i
,
x
in
enumerate
(
reversed
(
self
.
value
)):
x
=
math
.
ceil
(
x
)
if
x
==
0
:
continue
if
i
!=
0
:
...
...
@@ -130,7 +132,29 @@ def modular_inverse(a, n):
def
compute_lagrange_polynomial
(
points
,
prime_number
):
pass
nb_points
=
len
(
points
)
lagrange
=
Polynomial
((
0
,))
# Create a polynomial for each points
for
i
in
range
(
nb_points
):
poly_li
=
Polynomial
((
1
,))
divider
=
1
# Compute the lagrange polynomial
for
k
in
range
(
nb_points
):
if
k
!=
i
:
dividend
=
Polynomial
((
-
points
[
k
][
0
],
1
))
# x - value
poly_li
*=
dividend
divider
*=
(
points
[
i
][
0
]
-
points
[
k
][
0
])
divider
=
1
/
divider
point_yi
=
points
[
i
][
1
]
poly_li
=
poly_li
*
Polynomial
((
divider
,))
*
Polynomial
((
point_yi
,))
lagrange
+=
poly_li
return
lagrange
def
reed_solomon
(
points
,
data_length
,
last_error_index
,
prime_number
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment