changeset 10707:2d15bf604652 octave-forge

egolaydec/egolayenc: use egolaygen and avoid repeating code
author carandraug
date Tue, 21 Aug 2012 01:12:21 +0000
parents 8f1434f40544
children 5756675b884e
files main/comm/inst/egolaydec.m main/comm/inst/egolayenc.m
diffstat 2 files changed, 4 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/main/comm/inst/egolaydec.m	Tue Aug 21 00:59:49 2012 +0000
+++ b/main/comm/inst/egolaydec.m	Tue Aug 21 01:12:21 2012 +0000
@@ -56,25 +56,10 @@
     error ("extended golay code is (24,12), use rx codeword of 24 bit column size");
   endif
 
-  I = eye (12);
-                                %P is 12x12 matrix
-  P = [1 0 0 0 1 1 1 0 1 1 0 1;
-       0 0 0 1 1 1 0 1 1 0 1 1;
-       0 0 1 1 1 0 1 1 0 1 0 1;
-       0 1 1 1 0 1 1 0 1 0 0 1;
-       1 1 1 0 1 1 0 1 0 0 0 1;
-       1 1 0 1 1 0 1 0 0 0 1 1;
-       1 0 1 1 0 1 0 0 0 1 1 1;
-       0 1 1 0 1 0 0 0 1 1 1 1;
-       1 1 0 1 0 0 0 1 1 1 0 1;
-       1 0 1 0 0 0 1 1 1 0 1 1;
-       0 1 0 0 0 1 1 1 0 1 1 1;
-       1 1 1 1 1 1 1 1 1 1 1 0;];
-
-  H = [I; P]; %partiy check matrix transpose.
-
   dec_error = [];
-  C         = zeros (size (R));
+  [~, P] = egolaygen ();
+  H      = [eye(12); P]; # parity check matrix transpose
+  C      = zeros (size (R));
 
   for rspn = 1:rows (R)
     RR   = R(rspn,:);
--- a/main/comm/inst/egolayenc.m	Tue Aug 21 00:59:49 2012 +0000
+++ b/main/comm/inst/egolayenc.m	Tue Aug 21 01:12:21 2012 +0000
@@ -43,20 +43,7 @@
     error("extended golay code is (24,12), use message  of column size 12");
   endif
 
-  I = eye (12);
-  P = [1 0 0 0 1 1 1 0 1 1 0 1;
-       0 0 0 1 1 1 0 1 1 0 1 1;
-       0 0 1 1 1 0 1 1 0 1 0 1;
-       0 1 1 1 0 1 1 0 1 0 0 1;
-       1 1 1 0 1 1 0 1 0 0 0 1;
-       1 1 0 1 1 0 1 0 0 0 1 1;
-       1 0 1 1 0 1 0 0 0 1 1 1;
-       0 1 1 0 1 0 0 0 1 1 1 1;
-       1 1 0 1 0 0 0 1 1 1 0 1;
-       1 0 1 0 0 0 1 1 1 0 1 1;
-       0 1 0 0 0 1 1 1 0 1 1 1;
-       1 1 1 1 1 1 1 1 1 1 1 0;];
-  G = [P I]; %generator.
+  G = egolaygen (); # generator
 
   C = mod (M * repmat (G, [1, rows(M)]), 2);
   C = C(:, 1:24);