summaryrefslogtreecommitdiff
path: root/gr-fec/python/fec/LDPC/Generate_LDPC_matrix.py
diff options
context:
space:
mode:
authorDouglas Anderson <danderson@ntia.doc.gov>2017-02-12 15:52:19 -0800
committerJohnathan Corgan <johnathan@corganlabs.com>2017-02-26 18:21:22 -0800
commit9e625c4821f4c63421b3d3747c0c4f358fef6c5f (patch)
tree41dedbe053417be7314cdce15d64fbbb89db4d8d /gr-fec/python/fec/LDPC/Generate_LDPC_matrix.py
parente5aabcc6a4a9335f3ef8abf5f89104b626e9364d (diff)
python3: update non-GRC components to use python2 or python3
Diffstat (limited to 'gr-fec/python/fec/LDPC/Generate_LDPC_matrix.py')
-rw-r--r--gr-fec/python/fec/LDPC/Generate_LDPC_matrix.py25
1 files changed, 15 insertions, 10 deletions
diff --git a/gr-fec/python/fec/LDPC/Generate_LDPC_matrix.py b/gr-fec/python/fec/LDPC/Generate_LDPC_matrix.py
index a3862a6fda..8c5b17bc43 100644
--- a/gr-fec/python/fec/LDPC/Generate_LDPC_matrix.py
+++ b/gr-fec/python/fec/LDPC/Generate_LDPC_matrix.py
@@ -20,7 +20,12 @@
# Boston, MA 02110-1301, USA.
#
-from Generate_LDPC_matrix_functions import *
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import unicode_literals
+
+from .Generate_LDPC_matrix_functions import *
# This is an example of how to generate a parity check matrix for
# use with the LDPC Richardson Urbanke encoder. A significant amount
@@ -62,18 +67,18 @@ newH = get_full_rank_H_matrix(parity_check_matrix.H)
# can take a while...
[bestH,g] = get_best_matrix(newH,100)
-# Print out some of the resulting properties.
+# Print(out some of the resulting properties.)
n = bestH.shape[1]
k = n - bestH.shape[0]
-print "Parity check matrix properties:"
-print "\tSize :", bestH.shape
-print "\tRank :", linalg.matrix_rank(bestH)
-print "\tRate : %.3f" % ((k*1.0)/n)
-print "\tn :", n, " (codeword length)"
-print "\tk :", k, " (info word length)"
-print "\tgap : %i" % g
+print("Parity check matrix properties:")
+print("\tSize :", bestH.shape)
+print("\tRank :", linalg.matrix_rank(bestH))
+print("\tRate : %.3f" % ((k*1.0) / n))
+print("\tn :", n, " (codeword length)")
+print("\tk :", k, " (info word length)")
+print("\tgap : %i" % g)
# Save the matrix to an alist file for future use:
alist_filename = "n_%04i_k_%04i_gap_%02i.alist" % (n,k,g)
write_alist_file(alist_filename,bestH)
-print '\nMatrix saved to alist file:', alist_filename, "\n"
+print('\nMatrix saved to alist file:', alist_filename, "\n")