#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2017
    Posts
    16
    Rep Power
    0

    How to represent Binary Matrix with {0,1} bits as elements?


    I written an error correction code which uses a binary generator matrix(which i have declared and initialized within the code) in which each individual element in the matrix is declared as an int(as far as i understand that the size of int is 32, please correct me if am wrong). what i want to do is try to declare a binary matrix , that represents each element of the matrix as a bit rather than a word , to optimize the code , to improve space constraints in memory. please advice. If not , please suggest if this can be achieved in any other way. I've attached my matrix declaration code. please check.

    Code:
    #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,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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,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]);
    }
    }
    https://stackoverflow.com/questions/...ts-as-elements
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2017
    Location
    uk
    Posts
    4
    Rep Power
    0
    typedef int bool;
    #define true 1
    #define false 0
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2017
    Location
    uk
    Posts
    4
    Rep Power
    0
    char
    1 byte
    -128 to 127 or 0 to 255
    unsigned char
    1 byte
    0 to 255
    signed char
    1 byte
    -128 to 127
    int
    2 or 4 bytes
    -32,768 to 32,767 or -2,147,483,648 to 2,147,483,647
  6. #4
  7. Contributing User
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Aug 2011
    Posts
    5,896
    Rep Power
    509
    let's say you have a subset of two items. {1, "big train"}
    Code:
    unsigned char set = 0;
    
    if (1 is in the set) {
      set |= 1 << 0;
    }
    
    if ("big train" is in the set) {
      set |= 1 << 1;
    }
    Now set stores in bit position 0 whether 1 is in the set.
    And stores in bit position 1 whether "big train" is in the set.
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo