How can I check elements of an array are member of the other array?(For using GPU coder)
1 次查看（过去 30 天）
Hi, I'm trying to make a code to use GPU coder and I have a problem with huge matrix.
I have a matrix of 1701*1701*11 double composed with only 0 or 1 and suppose the name of this matrix as A. Also, I have another variable sized matrix. The second matrix has some number within 1~number of elements of the first matrix and I suppose the name of this matrix as B.
I want to check whether the value of A at i-th element from B.
For example, if A is [1 0 0;0 1 0;0 0 1], and B is [2 3 7]. I want to know the values of A at 2nd, 3rd, and 7th element.
For GPU coder app, I cannot use find, ismember, and even indexing.
Does anybody who have an idea which can solve my problem?
Walter Roberson 2019-11-28
Your problem is not suitable for coding efficiently on GPU.
It is probably possible to create an algorithm that does do indexing and manages to extract the data (possibly followed by a lot of nan), but the approaches would involve creating large large temporary arrays that would definitely fill up your gpu as you already have problems with running out of memory. The least amount of temporary memory that seems plausible to me at the moment is number of elements in A times number of elements in B, times the (number of bytes in the smallest integer that can store the number of elements in A, plus number of bytes in a logical)