Skip to content

Commit

Permalink
Updated doc-strings.
Browse files Browse the repository at this point in the history
  • Loading branch information
veeresht committed Apr 8, 2015
1 parent b998b01 commit 10d87c7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion commpy/channelcoding/convcode.py
Expand Up @@ -86,7 +86,7 @@ class Trellis:
2
>>> print trellis.number_states
4
print trellis.number_inputs
>>> print trellis.number_inputs
2
>>> print trellis.next_state_table
[[0 2]
Expand Down
15 changes: 15 additions & 0 deletions commpy/channelcoding/gfields.py
Expand Up @@ -73,6 +73,9 @@ def __mul__(self, x):
raise ValueError, "Two sets of elements cannot be multiplied"

def power_to_tuple(self):
"""
Convert Galois field elements from power form to tuple form representation.
"""
y = zeros(len(self.elements))
for idx, i in enumerate(self.elements):
if 2**i < 2**self.m:
Expand All @@ -82,6 +85,9 @@ def power_to_tuple(self):
return GF(y, self.m)

def tuple_to_power(self):
"""
Convert Galois field elements from tuple form to power form representation.
"""
y = zeros(len(self.elements))
for idx, i in enumerate(self.elements):
if i != 0:
Expand All @@ -98,13 +104,19 @@ def tuple_to_power(self):
return GF(y, self.m)

def order(self):
"""
Compute the orders of the Galois field elements.
"""
orders = zeros(len(self.elements))
power_gf = self.tuple_to_power()
for idx, i in enumerate(power_gf.elements):
orders[idx] = (2**self.m - 1)/(gcd(i, 2**self.m-1))
return orders

def cosets(self):
"""
Compute the cyclotomic cosets of the Galois field.
"""
coset_list = []
x = self.tuple_to_power().elements
mark_list = zeros(len(x))
Expand All @@ -127,6 +139,9 @@ def cosets(self):
return coset_list

def minpolys(self):
"""
Compute the minimal polynomials for all elements of the Galois field.
"""
minpol_list = array([])
full_gf = GF(arange(2**self.m), self.m)
full_cosets = full_gf.cosets()
Expand Down

0 comments on commit 10d87c7

Please sign in to comment.