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
d9480900
Commit
d9480900
authored
3 years ago
by
nicolas.albanesi
Browse files
Options
Downloads
Plain Diff
Changed indentation to tabs, modified get_possibilities
parents
66a3bb06
15076478
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
+5
-5
5 additions, 5 deletions
main.py
reed_solomon.py
+9
-6
9 additions, 6 deletions
reed_solomon.py
with
14 additions
and
11 deletions
main.py
+
5
−
5
View file @
d9480900
# MAIN FILE TO TEST FUNCTIONS
from
polynome
import
*
from
reed_solomon
import
*
if
__name__
==
"
__main__
"
:
pol1
=
polynome
([
1
,
2
,
3
,
4
,
5
])
pol2
=
polynome
([
2
,
3
,
4
,
4
,
4
])
# pol3 = pol1.add(pol2)
pol1
.
show
()
pol1
.
evaluate
(
2
)
\ No newline at end of file
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
()
This diff is collapsed.
Click to expand it.
reed_solomon.py
+
9
−
6
View file @
d9480900
...
...
@@ -9,8 +9,6 @@ def get_possibilities(l: list, index: int):
for
x
,
_
in
enumerate
(
l
):
l
[
x
]
=
(
x
,
l
[
x
])
# ! la valeur 20 est hardcodée. Paramètre de fonction ??
l_fixe
=
l
[
index
:]
# Liste contenant aucune erreur
l_posi
=
l
[:
index
]
# Liste contenant des erreurs,
...
...
@@ -38,15 +36,20 @@ def lagrange_compute(l: list) -> polynome:
def
check_nb_error
(
l
:
list
,
p
:
polynome
)
->
int
:
nbr_error
=
0
for
_
,
item
in
enumerate
(
l
)
:
if
(
item
%
p
.
prime_mod
)
!=
(
p
.
evaluate
(
_
)
%
p
.
prime_mod
):
print
(
f
"
DEBUG PURPOSES ONLY
{
item
}
!= p.evaluate(
{
_
}
) =
{
p
.
evaluate
(
_
)
}
"
)
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
]
)
}
"
)
nbr_error
+=
1
return
nbr_error
def
reed_decode
(
l
:
list
)
->
polynome
:
# print("test")
for
points
in
get_possibilities
(
l
):
if
(
check_nb_error
(
l
,
lagrange_compute
(
points
))
<=
9
):
# print(f"{points}")
# lagrange_compute(points).show()
err
=
check_nb_error
(
l
,
lagrange_compute
(
points
))
print
(
f
"
{
err
=
}
"
)
if
((
err
)
<=
9
):
# 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