Hi,
How to multiply single dimensional array with 2-dimensional array. Please share me the logic.
Code: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 int message[]={1,1,0} //single dimensional array
Hi,
How to multiply single dimensional array with 2-dimensional array. Please share me the logic.
Code: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 int message[]={1,1,0} //single dimensional array
Considering that it looks like you want to do matrix multiplication, the Wikipedia article on matrix multiplication may be a good place to start.Originally Posted by SarasMuthu
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
No, I know matrix multiplication. Actually what is my problem means ? i am working with LDPC code
Code:int main() 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 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"); } }
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.Originally Posted by SarasMuthu
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.
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
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.Originally Posted by SarasMuthu
Last edited by laserlight; 06-19-2017 at 04:37 AM.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Iayyo da, It`s very difficult to make you understand..OOOps
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.
Last edited by laserlight; 06-19-2017 at 04:49 AM.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)