?? encode.cpp
字號:
#include "LDPC_head.h"
#include <stdlib.h>
code *encode(struct matrix_bit *matrix, unsigned int *message)
{
code *code1;
unsigned int i;
unsigned int j;
unsigned int k;
code1=(struct code *) malloc (sizeof(struct code));
code1->length=matrix->N;
code1->codeword=(double *) malloc ((sizeof(double))*code1->length);
for(i=0;i<code1->length;i++)
{
k=0;
for(j=0;j<matrix->G_mcw;j++)
{
if(matrix->G[j*matrix->N+i]!=0)
{
k+=message[matrix->G[j*matrix->N+i]-1];
}
}
if(k%2==0)
{
code1->codeword[i]=1;
}else
{
code1->codeword[i]=-1;
}
}
return(code1);
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -