BInary matrix multiplication

Hii,
I am trying to multiply two matrices defined as follows:
U = [1 1 1 1 0 0 0 0 0 1 1];
G = [0 1 0 1 1 0 0 0 0 0 0 0 0 0 0
0 0 1 1 0 1 0 0 0 0 0 0 0 0 0
0 1 1 0 0 0 1 0 0 0 0 0 0 0 0
0 1 1 1 0 0 0 1 0 0 0 0 0 0 0
1 0 0 1 0 0 0 0 1 0 0 0 0 0 0
1 0 1 0 0 0 0 0 0 1 0 0 0 0 0
1 0 1 1 0 0 0 0 0 0 1 0 0 0 0
1 1 0 0 0 0 0 0 0 0 0 1 0 0 0
1 1 0 1 0 0 0 0 0 0 0 0 1 0 0
1 1 1 0 0 0 0 0 0 0 0 0 0 1 0
1 1 1 1 0 0 0 0 0 0 0 0 0 0 1];
Here U is a matrix of size 1*11 whereas G is a matrix of size 11*15. I have no idea of how to do binary multiplication any suggestions in this regard??
Thanks for you help.

回答 (1 件)

Walter Roberson
Walter Roberson 2012 年 4 月 15 日

0 投票

7 件のコメント

Dyno
Dyno 2012 年 4 月 15 日
Dear Sir,
Thanks for your reply. I really cant figure out the binary multiplication code out of it.
Dyno
Dyno 2012 年 4 月 15 日
This simple code seems to work for binary multiplication:
V = mod(double(U)*double(G),2)
Walter Roberson
Walter Roberson 2012 年 4 月 15 日
See Derek's MMBool routine in the above Question.
NGUYEN Duy Ngan
NGUYEN Duy Ngan 2014 年 4 月 29 日
Thank you very much Dyno.
Chris Volpe
Chris Volpe 2016 年 8 月 23 日
The "mod 2" part is appropriate only if boolean addition is defined as an exclusive-or operation. In most contexts it should be ordinary "or". I would do this as:
V = logical(double(U)*double(G))
Onyekachi Ukeje-Eloagu
Onyekachi Ukeje-Eloagu 2016 年 10 月 1 日
I tried using the "mod 2" and "logical" with some problems I am working on. I am not sure what you are referring to when you talk about the boolean addition being defined as an exclusive-or, but the "mod 2" gives the correct answer and "logical" does not
Walter Roberson
Walter Roberson 2016 年 10 月 1 日
Onyekachi Ukeje-Eloagu: in your situation, should boolean 1+1 be equal to 1 ("or") or should it be equal to 0 ("exclusive or") ?

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeResizing and Reshaping Matrices についてさらに検索

質問済み:

2012 年 4 月 15 日

コメント済み:

2016 年 10 月 1 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by