Conv_code_177_133.png
Size of this preview:
800 × 324 pixels
.
Other resolutions:
320 × 130 pixels
|
963 × 390 pixels
.
Summary
Description Conv code 177 133.png |
English:
Octal 171 is the binary 1111001, octal 133 is the binary 1011011. So, the one means the existence of the link to the adder (by modulo 2), zero - no link.
Try in python: import numpy as np
from scipy.ndimage.interpolation import shift
class ConvolutionalCodes:
def __init__(self, poly):
self.poly = poly
def poly2regs(self):
poly = self.poly
L = poly[0] # Constrain length
Gen = [] # List for generators
for g in poly[1]:
bin_str = bin(int(str(g), 8))[2:] # From octal to binary representation
split_str = list(tuple(bin_str)) # Split the bits
split_int = [int(i) for i in split_str] # Convert to from chars to integers
Gen.append(split_int)
return L, Gen
def encoder(self, message):
L, Gen = self.poly2regs()
Gen = np.matrix(Gen)
memory = np.zeros((L,))
encoded = []
for bit in message:
memory = np.abs(shift(memory, 1, cval=np.NaN).round())
memory[0] = bit
y = np.array(np.dot(Gen, memory) % 2)
[encoded.append(i) for i in y[0]]
return encoded
convC = ConvolutionalCodes([7,[171, 133]])
convC.poly2regs()
convC.encoder([1, 0, 1, 0, 0, 1, 1])
|
||
Date | |||
Source | Own work | ||
Author | Kirlf | ||
Other versions |
|
Licensing
I, the copyright holder of this work, hereby publish it under the following license:
This file is licensed under the
Creative Commons
Attribution-Share Alike 4.0 International
license.
-
You are free:
- to share – to copy, distribute and transmit the work
- to remix – to adapt the work
-
Under the following conditions:
- attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
- share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.