如何用{0,1}位作为元素表示二进制矩阵?

时间:2017-11-17 10:17:02

标签: c bits

我编写了一个纠错码,它使用二进制生成器矩阵(我在代码中声明并初始化),其中矩阵中的每个单独元素都被声明为int(据我所知,int的大小在xilix软件开发套件(XSDK)是32,如果我错了请纠正我)。我想要做的是尝试声明一个二进制矩阵,它将矩阵的每个元素表示为一个位而不是一个字,以优化代码,改善内存中的空间约束。 XSDK中有一点类型。请指教。如果没有,请建议是否可以通过任何其他方式实现。我附上了矩阵声明代码。请检查。

#define ROWS 102  //k
#define COLS 204
int main()
{    

int msg[ROWS];
int dout[COLS];
int G[ROWS][COLS] = {0};
int i,j,k,r,c,n;

 k = ROWS;
 r = ROWS;
 c = COLS;
 n = COLS;
 static int H[ROWS][COLS] = {0,1,0,1,1,0,0,1,1,0,0,0,0,0,1,0,1,0,0,1,0,0,0,0,0,1,0,1,1,0,1,0,1,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,0,0,0,1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1,0,1,0,0,1,0,1,1,0,1,1,0,0,0,1,0,0,1,0,0,0,1,0,1,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,1,0,1,1,1,0,1,0,1,1,0,1,1,0,0,1,0,1,0,1,1,0,0,0,1,0,1,0,0,1,1,1,1,1,0,0,0,0,0,0,1,0,1,0,0,0,1,0,1,1,0,0,0,1,0,0,1,1,0,1,0,0,0,0,0,0,0,1,0,0,1,1,1,0,1,0,1,1,1,0,0,1,0,0,1,1,0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,1,0,0,1,0,1,1,0,1,1,1,0,0,0,1,1,0,1,0,0,1,1,1,1,1,0,1,0,0,1,1,1,0,1,0,1,0,0,0,1,1,1,0,1,1,0,0,1,0,0,0,1,1,1,0,1,0,1,1,1,0,1,1,0,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1,1,0,0,0,1,0,0,1,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,0,1,0,0,1,0,0,0,0,1,1,0,0,1,1......};

int Codeword[COLS]= {0};
int s = 0;
for (i=0;i<k;i++)
for(j=0;j<k;j++)
    if(i == j)
    G[i][j] = 1;

for(i=0;i<r;i++)
for(j=0;j<k;j++)
    G[j][k+i] = H[i][j];

for(i=0;i<r;i++)
   {
for(j=0;j<c;j++)
    printf("%d",G[i][j]);
   }

for(j=0;j<n;j++)
 {
 for(i=0;i<k;i++)
 {
    s = s + msg[i]*G[i][j];
 }
Codeword[j] = s % 2;
s = 0;
 }
for(i=0;i<n;i++)
{
printf("%d",Codeword[i]);
}
}

0 个答案:

没有答案