Matrix multiplication using XOR

9 visualizaciones (últimos 30 días)
Mandofa
Mandofa el 27 de Feb. de 2016
Respondida: John D'Errico el 28 de Feb. de 2016
I am multiplying two matrices together and instead of doing the regular addition I would to use XOR. I tried the XOR function but it gave me errors.
a = [2 3 1 1; 1 1 3 1; 1 1 2 3; 3 1 3 2]
b = [dec2hex(172);dec2hex(119);dec2hex(102);dec2hex(243)]
% prod = xor(a ,b)
prod = a * b
>> matrix
a =
2 3 1 1
1 1 3 1
1 1 2 3
3 1 3 2
b =
AC
77
66
F3
prod =
419 404
352 335
438 383
552 520
>>
  3 comentarios
Stephen23
Stephen23 el 27 de Feb. de 2016
Editada: Stephen23 el 27 de Feb. de 2016
"but it gave me errors": you do not show us any error message, and the code you have posted works just fine. So it seems that you don't have any problems after all. Congratulations!
Or perhaps you do have some problems, and just forgot to actually show us the complete error message and the exact code used and a description of what you expected to happen. If you want help you need to tell us what you are doing and what you expect your code to do.
Mandofa
Mandofa el 28 de Feb. de 2016
When I multiply the matrix out ACx2 + 77x3 + 66x1+ F3x1 just for example, I would like to have the plus signs as XOR like ACx2 xor 77x3 xor 66x1 xor F3x1.

Iniciar sesión para comentar.

Respuesta aceptada

John D'Errico
John D'Errico el 28 de Feb. de 2016
Sorry, but you cannot tell MATLAB to arbitrarily replace the addition in a matrix multiply (in a dot product) with some other operator. Some languages like APL for example, allow general dot product forms as I recall, but not in MATLAB. You CAN write code yourself do to that, which is what you will need to do.

Más respuestas (0)

Categorías

Más información sobre Resizing and Reshaping Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by