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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
|
diff -ruN -x '*~' -x -q cml-orig/CmlStartup.m cml/CmlStartup.m
--- cml-orig/CmlStartup.m 2007-09-08 23:12:26.000000000 +0930
+++ cml/CmlStartup.m 2018-04-12 16:38:31.966825321 +0930
@@ -20,7 +20,7 @@
addpath( strcat( cml_home, '\mex'), ...
strcat( cml_home, '\mat'), ...
strcat( cml_home, '\matalt' ), ...
- strcat( cml_home, '\mexhelp'), ...
+ %strcat( cml_home, '\mexhelp'), ...
strcat( cml_home, '\demos' ), ...
strcat( cml_home, '\scenarios'), ...
strcat( cml_home, '\localscenarios'),...
@@ -41,7 +41,7 @@
addpath( strcat( cml_home, '/mex'), ...
strcat( cml_home, '/mat'), ...
strcat( cml_home, '/matalt' ), ...
- strcat( cml_home, '/mexhelp'), ...
+ %strcat( cml_home, '/mexhelp'), ...
strcat( cml_home, '/demos' ), ...
strcat( cml_home, '/scenarios'), ...
strcat( cml_home, '/localscenarios'),...
@@ -59,4 +59,4 @@
save_directory = strcat( cml_home, '/scenarios/CmlHome.mat' );
end
-save( save_directory, save_flag, 'cml_home' );
\ No newline at end of file
+save( save_directory, save_flag, 'cml_home' );
diff -ruN -x '*~' -x -q cml-orig/mat/CreateConstellation.m cml/mat/CreateConstellation.m
--- cml-orig/mat/CreateConstellation.m 2007-12-27 21:36:24.000000000 +1030
+++ cml/mat/CreateConstellation.m 2018-04-15 10:21:35.325168186 +0930
@@ -58,7 +58,7 @@
% Optional argument: Label Type
if (length(varargin)>=2)
label_type = varargin{2};
- if ~isstr( label_type )
+ if ~ischar( label_type )
if (length( label_type ) ~= M )
error( 'Length of label_type must be M' );
elseif (sum( sort( label_type ) ~= [0:M-1] ) > 0)
diff -ruN -x '*~' -x -q cml-orig/mat/InitializeWiMaxLDPC.m cml/mat/InitializeWiMaxLDPC.m
--- cml-orig/mat/InitializeWiMaxLDPC.m 2007-07-21 08:18:04.000000000 +0930
+++ cml/mat/InitializeWiMaxLDPC.m 2018-04-15 10:19:59.487185664 +0930
@@ -134,7 +134,7 @@
H(cnt1:cnt1+z-1, cnt2:cnt2+z-1)= eye(z);
end
if (Hbm(i, j) >0)
- if ((rate ==2/3)&(ind ==0))
+ if ((rate ==2/3)&&(ind ==0))
H(cnt1:cnt1+z-1, cnt2:cnt2+z-1)=circshift( eye(z),[0,mod(Hbm(i,j),z)]);
else
H(cnt1:cnt1+z-1, cnt2:cnt2+z-1)= circshift( eye(z),[0,floor(Hbm(i,j)*z/z0)]);
@@ -146,7 +146,7 @@
end
P =eye(z);
-if ((rate ==3/4) & (ind ==1))
+if ((rate ==3/4) && (ind ==1))
P=inv(circshift( eye(z),[0,floor(80*z/z0)]));
end
diff -ruN -x '*~' -x -q cml-orig/source/matrix.h cml/source/matrix.h
--- cml-orig/source/matrix.h 1970-01-01 09:30:00.000000000 +0930
+++ cml/source/matrix.h 2018-04-12 16:38:31.966825321 +0930
@@ -0,0 +1,1 @@
+#include <mex.h>
diff -ruN -x '*~' -x -q cml-orig/source/MpDecode.c cml/source/MpDecode.c
--- cml-orig/source/MpDecode.c 2007-08-06 14:44:24.000000000 +0930
+++ cml/source/MpDecode.c 2018-04-15 07:28:51.092724038 +0930
@@ -53,6 +53,7 @@
#include <mex.h>
#include <matrix.h>
#include <stdlib.h>
+#include <stdio.h>
/* Input Arguments */
#define INPUT prhs[0]
@@ -332,8 +333,10 @@
int sign;
float temp_sum;
float Qi;
-
+ int ssum;
+
for (iter=0;iter<max_iter;iter++) {
+ ssum = 0;
/* update r */
for (j=0;j<NumberParityBits;j++) {
sign = v_nodes[ c_nodes[j].index[0] ].sign[ c_nodes[j].socket[0] ];
@@ -344,6 +347,8 @@
sign ^= v_nodes[ c_nodes[j].index[i] ].sign[ c_nodes[j].socket[i] ];
}
+ if (sign==0) ssum++;
+
for (i=0;i<c_nodes[j].degree;i++) {
if ( sign^v_nodes[ c_nodes[j].index[i] ].sign[ c_nodes[j].socket[i] ] ) {
c_nodes[j].message[i] = -phi0( phi_sum - v_nodes[ c_nodes[j].index[i] ].message[ c_nodes[j].socket[i] ] )*r_scale_factor;
@@ -382,12 +387,18 @@
for (i=0;i<CodeLength-NumberParityBits;i++)
if ( DecodedBits[iter+max_iter*i] != data[i] )
BitErrors[iter]++;
-
+
/* Halt if zero errors */
if (BitErrors[iter] == 0)
- break;
+ break;
+
+ // added by Bill -- reuse the BitErrors array to count PCs
+ // count the number of PC satisfied and exit if all OK
+ BitErrors[iter] = ssum;
+ if (ssum==NumberParityBits) break;
}
+ //fprintf(stderr, " iter: %d ssum is %d \n", iter, ssum);
}
/* main function that interfaces with MATLAB */
@@ -765,4 +776,4 @@
free( v_nodes );
return;
-}
\ No newline at end of file
+}
|