CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Threaded View

  1. #1
    Join Date
    Jun 2017
    Posts
    13

    LDPC:How to declare

    Hi,
    I am working LDPC encoding and decoding.In Vivado HLS, I need to transform a parity-check matrix H (that only consists of ones and zeros) from a non-standard to a standard form through C/C++ programming language.

    Its showing wrong result while generating codeword, please debug my program.


    Code:
    int main()
    {
        // coding for the general form beginning using rows and cols
        int i,j,msg_length,sum=0,k;
       int message[]={1,1,0}          //single dimensional array
        int rows=3,cols=6,r=0,r2,c;
        int Generator[10][10],code[10][10]={0};
        int temp[10][10]={0};
        int H_Matrix[3][6]={{1,1,0,0,1,0},{1,0,0,1,0,1},{1,1,1,0,0,1}}; //2-dimensional array
    */
    ....................
    ...............
    */
    
    for(i=0;i<rows;i++)
    {
        for(j=0;j<cols;j++)
        {
            Generator[i][j]=H_Matrix[i][j];
        //    printf("%d\t ",Generator[i][j]);
        }
        printf("\n");
    }
    
    for (i = 0; i < 1; i++) {
          for (j = 0; j < cols; j++) {
            for (k = 0; k < rows; k++) {
              sum = sum^( message[i][k]&Generator[k][j]); //How to compute? This line showing error while compiling 
            }
     
            code[i][j] = sum;
            sum = 0;
          }
        }
       
    //code wrd
    printf("the code word \n");   
    for(i=0;i<1;i++)
    {
        for(j=0;j<cols;j++)
        {
            printf("%d\t ",code[i][j]);
        }
        printf("\n");
    }   
    
    }
    Last edited by 2kaud; June 19th, 2017 at 06:23 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured