# Thread: How to multiply single dimensional array with 2-dimensional array

1. ## How to multiply single dimensional array with 2-dimensional array

Hi,

How to multiply single dimensional array with 2-dimensional array. Please share me the logic.

Code:
```int H_Matrix={{1,1,0,0,1,0},{1,0,0,1,0,1},{1,1,1,0,0,1}}; //2-dimensional array

int message[]={1,1,0} //single dimensional array``` 2. Originally Posted by SarasMuthu
How to multiply single dimensional array with 2-dimensional array. Please share me the logic.
Considering that it looks like you want to do matrix multiplication, the Wikipedia article on matrix multiplication may be a good place to start. 3. No, I know matrix multiplication. Actually what is my problem means ? i am working with LDPC code

Code:
```int main()
int H_Matrix={{1,1,0,0,1,0},{1,0,0,1,0,1},{1,1,1,0,0,1}}; //2-dimensional array

int message[]={1,1,0}
.....
for (i = 0; i < 1; i++) {
for (j = 0; j < cols; j++) {
for (k = 0; k < rows; k++) {
sum = sum^( message[i][k]&H_Matrix[k][j]); //How to do this conversion ? 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");
}

}``` 4. Originally Posted by SarasMuthu
No, I know matrix multiplication.
Then you should know that the result of your matrix multiplication will be another matrix, but I see no result matrix, i.e., you don't understand matrix multiplication. Read the Wikipedia article carefully first, please.

Alternatively, you are not doing matrix multiplication, in which case I cannot help you without more information because there are so many ways to "multiply single dimensional array with 2-dimensional array", and all of them except one will not be applicable. Originally Posted by SarasMuthu
Actually what is my problem means ?
That is for you to answer. If you don't know what your problem means, then I surely cannot know either since all I know is what you have presented of your problem. I know what matrix multiplication is, but what matrix multiplication means is context/domain dependent. Originally Posted by SarasMuthu
i am working with LDPC code
That is meaningless to me, and I doubt it actually has any bearing on your problem other than providing some context that is not needed here. What you need to know is the algorithm for the multiplication, and while that may be known via the context of "LDPC code", it is for you to find out, not for anyone else to do this essential preliminary work. 5. Iayyo da, It`s very difficult to make you understand..OOOps  6. No, it is easy to make me understand: describe the algorithm that you have in mind to "multiply single dimensional array with 2-dimensional array". If you cannot do that, then it is you who does not understand enough to even properly ask for help in implementing what you want to implement, so you need to fix that first.

EDIT:
Oh, I noticed that you referenced code[i][j]. Is code your result matrix? If your problem is with a compile error, then instead of posting a syntactically incorrect code fragment, post the smallest and simplest program that you expect should compile but which demonstrates the problem. If your problem is with logic, then you should be describing the logic to the best of your ability. Popular pages Recent additions array, c language, c++, dimensional, int 