Creating a Matrix C from Matrices A and B such that C(i,j) = A(B(i,j))
1 view (last 30 days)
Show older comments
Sylvain Catherine
on 20 Sep 2015
Commented: Sylvain Catherine
on 21 Sep 2015
Hello everyone,
My problem is the following. I have two matrices. A is of size Nx1. B is of size KxM, and is composed of integers between 1 and N. I want to create a new matrix C of size KxM, such that
C(i,j) = A(B(i,j));
One obvious way would be to loop "for i=1:K ... for j=1:K" but time efficiency is critical. Idealy, I would like to run this on GPU.
That does not look like a very specific problem so my intuition is that there should a simple way to do it that I am missing.
Thanks a lot if you have an idea.
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on GPU Computing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!