Vectorize a series of interpn calculations with GPU
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Let's say I have a cell array with equal sized (but different) 4D datasets:
nPoints = 5;
dataCell = cell(1,nPoints);
for i = 1:nPoints
dataCell{i} = rand(3, 2, 4, 3);
end
For the data arays in each cell, I would like to carry out a 4D interpn. Let's say the interpolation sample arrays and targets for each dimension are as follows:
dimOneArray = [0.1 0.2 0.3];
dimTwoArray = [2 4];
dimThreeArray = [1 2 3 4];
dimFourArray = [0.3 0.6 0.9];
dimOneTarget = 0.15;
dimTwoTarget = 3;
dimThreeTarget = 2.5;
dimFourTarget = 0.4;
Then I would like to carry out nPoints interpn calculations in a vectorized manner i.e. I would like to produce the same result as below (interpArray) without a for loop:
interpArray = nan(nPoints, 1);
for i = 1:nPoints
interpArray(i) = interpn(dimOneArray, dimTwoArray, dimThreeArray, dimFourArray, cell2mat(dataCell(i)), dimOneTarget, dimTwoTarget, dimThreeTarget, dimFourTarget);
end
How would I use the GPU to carry out this calculation?
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu GPU Computing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!