MATLAB Answers

Info

This question is closed. Reopen it to edit or answer.

What is the difference when multiplying and dividing 3D gpuArrays compared to 2D?

1 view (last 30 days)
Mantas Vaitonis
Mantas Vaitonis on 13 Jul 2018
Closed: Mantas Vaitonis on 13 Jul 2018
Hello,
I am trying to do some calculations on 3D gpuArrays. Firstly I made my code for 2D arrays, the I did try tomove to 3D. I noticed that results are different, what I am doing wrong and what is the difference when performing multiplication and division between 2D and 3D arrays? As example there is 3D array A(100x5x1):
x=A
y=A
b = inv(x'*x)*x'*y;
C=x\y;
result c is (5x5) array and b(5x5). And if I convert 3D A to gpuArray and perform the following calculations when A (100x5x10);
b1=pagefun(@mtimes,permute(x, [2 1 3]),x);
bb=pagefun(@inv,b1);
b2=permute(x, [2 1 3]);
b3= pagefun(@mtimes,bb,b2);
b=pagefun(@mtimes,b3,y);
result is b(5x5x10),
c=bsxfun(@mldivide,x,y);
Here result is c (100x5x10).Why it is different from 2D array division? What would be the correct way performing same calculations on 3D gpuArrays?

  0 Comments

Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by