フィルターのクリア

Vectorize a series of interpn calculations with GPU

2 ビュー (過去 30 日間)
deathtime
deathtime 2023 年 5 月 19 日
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 件)

カテゴリ

Help Center および File ExchangeGPU Computing についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by