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
ed765c87
Commit
ed765c87
authored
3 years ago
by
nicolas.albanesi
Browse files
Options
Downloads
Patches
Plain Diff
Everything is working fine
parent
e4aa26f3
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
+22
-4
22 additions, 4 deletions
main.py
reed_solomon.py
+4
-7
4 additions, 7 deletions
reed_solomon.py
with
26 additions
and
11 deletions
main.py
+
22
−
4
View file @
ed765c87
...
...
@@ -3,8 +3,26 @@
from
polynome
import
*
from
reed_solomon
import
*
def
correct_list
(
len_list
:
int
,
p
:
polynome
):
corrected
=
[]
for
x
in
range
(
len_list
):
corrected
.
append
(
p
.
evaluate
(
x
))
return
corrected
if
__name__
==
"
__main__
"
:
reed_solomon
=
reed_decode
([
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
])
# reed_solomon = reed_decode([2, 3 ,4])
reed_solomon
.
show
()
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
]
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
])))
\ No newline at end of file
This diff is collapsed.
Click to expand it.
reed_solomon.py
+
4
−
7
View file @
ed765c87
...
...
@@ -3,8 +3,8 @@ from polynome import *
from
inverse_mult
import
*
from
itertools
import
combinations
def
get_possibilities
(
l
:
list
,
index
:
int
):
def
get_possibilities
(
l
_og
:
list
,
index
:
int
):
l
=
l_og
.
copy
()
# Transforme the list in list of tupples with their indexes
for
x
,
_
in
enumerate
(
l
):
l
[
x
]
=
(
x
,
l
[
x
])
...
...
@@ -36,18 +36,15 @@ def lagrange_compute(l: list) -> polynome:
def
check_nb_error
(
l
:
list
,
p
:
polynome
)
->
int
:
nbr_error
=
0
for
item
in
l
:
if
(
item
[
1
]
%
p
.
prime_mod
)
!=
(
p
.
evaluate
(
item
[
0
])
%
p
.
prime_mod
):
# print(f"DEBUG PURPOSES ONLY {item[1]} != p.evaluate({item[0]}) = {p.evaluate(item[0])}")
for
counter
,
item
in
enumerate
(
l
):
if
(
item
%
p
.
prime_mod
)
!=
(
p
.
evaluate
(
counter
)
%
p
.
prime_mod
):
nbr_error
+=
1
return
nbr_error
def
reed_decode
(
l
:
list
)
->
polynome
:
# print("test")
for
points
in
get_possibilities
(
l
,
20
):
err
=
check_nb_error
(
l
,
lagrange_compute
(
points
))
print
(
f
"
{
err
=
}
"
)
if
((
err
)
<=
9
):
# ? Chercher un polynome avec moins de 9 erreurs ?
# Possibilité d'optimiser en evitant de compute 2 fois le poly
...
...
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