mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-01 08:07:10 -04:00
d84c169d6d
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6869 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
38 lines
926 B
Plaintext
Executable File
38 lines
926 B
Plaintext
Executable File
#!/opt/local/bin/octave -qf
|
|
# read a parity check matrix produced by the peg algorithm and
|
|
# convert to alist format so that it can be read using alist_to_pcheck
|
|
arg_list=argv();
|
|
filename=arg_list{1};
|
|
fid=fopen(filename,"r");
|
|
N=fscanf(fid,"%d",[1]);
|
|
M=fscanf(fid,"%d",[1]);
|
|
pcheck=zeros(M,N);
|
|
max_bits_in_check=fscanf(fid,"%d",[1]);
|
|
for i=1:M
|
|
vec=fscanf(fid,"%d",[max_bits_in_check]);
|
|
pcheck(i,vec(vec>0))=1;
|
|
endfor
|
|
|
|
max_bits_in_check2=max(sum(pcheck'));
|
|
max_checks_per_bit=max(sum(pcheck));
|
|
printf("%d %d\n",M,N);
|
|
printf("%d %d\n",max_bits_in_check2,max_checks_per_bit);
|
|
printf("%d ",sum(pcheck'));
|
|
printf("\n");
|
|
printf("%d ",sum(pcheck));
|
|
printf("\n");
|
|
for i=1:M
|
|
vec=find(pcheck(i,:)>0);
|
|
pr=zeros(1,max_bits_in_check2);
|
|
pr(1:size(vec)(2))=vec;
|
|
printf("%d ",pr);
|
|
printf("\n");
|
|
endfor
|
|
for i=1:N
|
|
vec=find(pcheck(:,i)>0);
|
|
pr=zeros(1,max_checks_per_bit);
|
|
pr(1:size(vec)(1))=vec;
|
|
printf("%d ",pr)
|
|
printf("\n");
|
|
endfor
|