-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsimpleHammingDecoder.py
More file actions
33 lines (27 loc) · 978 Bytes
/
Copy pathsimpleHammingDecoder.py
File metadata and controls
33 lines (27 loc) · 978 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 29 20:25:38 2024
@author: Omer
"""
from ieeeConstants import *
# Obsolete
# def simpleHammingDecoder(H, slicedReceivedMessage):
# syndrome = np.squeeze(np.asarray(slicedReceivedMessage.dot(H)))
# correctionVector = np.zeros(slicedReceivedMessage.shape[0], dtype = IEEE_8023_INT_DATA_TYPE)
# index = 0
# decoderFailure = False
# if np.all(syndrome == 0):
# pass
# else:
# found = False
# while (index < H.shape[0]) and (not found):
# if np.all(H[index , :] == syndrome):
# found = True
# else:
# index = index + 1
# if index >= H.shape[0]:
# decoderFailure = True
# else:
# correctionVector[index] = 1
# correctedMessage = (slicedReceivedMessage + correctionVector) %2
# return correctedMessage, correctionVector, decoderFailure