Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
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
Show more breadcrumbs
darius.briquet
reed_solomon
Commits
5dad04d5
Commit
5dad04d5
authored
3 years ago
by
nicolas.albanesi
Browse files
Options
Downloads
Patches
Plain Diff
Ajout des paramètres
parent
ed765c87
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
main.py
+10
-5
10 additions, 5 deletions
main.py
reed_solomon.py
+9
-2
9 additions, 2 deletions
reed_solomon.py
with
19 additions
and
7 deletions
main.py
+
10
−
5
View file @
5dad04d5
...
...
@@ -14,15 +14,20 @@ def correct_list(len_list: int, p: polynome):
if
__name__
==
"
__main__
"
:
l
=
[
115
,
117
,
101
,
118
,
122
,
116
,
57
,
108
,
32
,
224
,
62
,
116
,
115
,
140
,
32
,
108
,
153
,
83
,
169
,
117
,
108
,
112
,
32
,
110
,
101
,
55
,
96
,
61
,
160
,
218
,
228
,
156
,
224
,
203
,
12
,
75
,
180
,
23
,
220
,
211
,
137
,
139
,
206
]
# PARAMETRES
# Variables dans reed_solomon.py
INDEX_MAX
=
20
ERROR_MAX
=
9
MSG_LEN
=
25
# Find the correct polynom
reed_solomon
=
reed_decode
(
l
)
l_ok
=
correct_list
(
len
(
l
),
reed_solomon
)
print
(
l
)
print
(
l_ok
)
print
(
""
.
join
(
map
(
chr
,
l
[:
25
])))
print
(
""
.
join
(
map
(
chr
,
l_ok
[:
25
])))
print
(
"
Message recu :
"
+
""
.
join
(
map
(
chr
,
l
[:
MSG_LEN
])))
print
(
"
Message décodé :
"
+
""
.
join
(
map
(
chr
,
l_ok
[:
MSG_LEN
])))
\ No newline at end of file
This diff is collapsed.
Click to expand it.
reed_solomon.py
+
9
−
2
View file @
5dad04d5
...
...
@@ -3,6 +3,13 @@ from polynome import *
from
inverse_mult
import
*
from
itertools
import
combinations
# Global Variables
# Parameters
INDEX_MAX
=
20
ERROR_MAX
=
9
def
get_possibilities
(
l_og
:
list
,
index
:
int
):
l
=
l_og
.
copy
()
# Transforme the list in list of tupples with their indexes
...
...
@@ -43,9 +50,9 @@ def check_nb_error(l: list, p: polynome) -> int:
def
reed_decode
(
l
:
list
)
->
polynome
:
for
points
in
get_possibilities
(
l
,
20
):
for
points
in
get_possibilities
(
l
,
INDEX_MAX
):
err
=
check_nb_error
(
l
,
lagrange_compute
(
points
))
if
((
err
)
<=
9
):
if
((
err
)
<=
ERROR_MAX
):
# ? Chercher un polynome avec moins de 9 erreurs ?
# Possibilité d'optimiser en evitant de compute 2 fois le poly
return
lagrange_compute
(
points
)
\ No newline at end of file
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