Modulo-2 matrix multiplication
56 次查看(过去 30 天)
显示 更早的评论
Hi.
I would like to know whether its possible to have the following multiplication and how it can be perfromed.
a=[1 1];
b=[0 0];
c=[1 0];
X=[a b c];
Y=[1 1 0;1 0 1; 0 1 0];
Z=mod(X*Y, 2);
I am expecting Z=[a+b,a+c,b], the addition is modulo-2 addition. The final output should be Z=[110100];
Thank you.
0 个评论
采纳的回答
Dyuman Joshi
2021-5-5
size(X) = [1 6];
size(Y) = [3 3];
X and Y are not compatible for multiplcation given their sizes.
You can do something like this -
X = [a;b;c]; %size(X) = [3 2]
Z = mod(Y*X,2);
Z = [1 1; 0 1; 0 0];
Z = reshape(Z,1,[]);
Z = [1 1 0 1 0 0]; %If you want it to be a number and not an array, use polyval(z,10)
2 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!