How to compare two matrices, row by matrix using the GPU

3 visualizzazioni (ultimi 30 giorni)
Hi,
given the two matrices A and B I have to create the result matrix, in it we have 1 if the number of the matrix A is contained in the matrix B. We compare the whole matrix A with the elements of each row of the matrix B.
I managed to get the result with cycles but I would need a more efficient function, able to run with the GPU because the rows of the matrix B could be really many.
I thank in advance who will be kind enough to help me.
Thanks
Kurio

Risposta accettata

David Hill
David Hill il 17 Mag 2020
Not sure if something like this would work for you.
arrayfun(@(x)ismember(a,b(x,:)),1:size(b,1),'UniformOutput',false);
  1 Commento
kurio curio
kurio curio il 17 Mag 2020
Modificato: kurio curio il 17 Mag 2020
Hi, David, I am a beginner and I had never used cells but I learn quickly. Your solution works perfectly, even with the GPU. You are a great. Thanks so much!

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by