Consider this line of code:
gpuArray(-1)^0.5;
Which results in:
ans = 0.0000 + 1.0000i
Now consider the following line of code:
gpuArray(-1).^0.5;
Which results in:
Error using .^ POWER: needs to return a complex result, but this is not supported for real input X and Y on the GPU. Use POWER(COMPLEX(X), COMPLEX(Y,0)) instead.
The problem clearly has something to do with a double -> complex double
conversion on the GPU, which is not allowed. Indeed, when I apply the workaround (which is also mentioned in the docs) it solves the problem - but I don't understand why.
Would anybody shed some light on this? Is this some limitation of VRAM? Of the specific card I'm using (mine is GTX 660, having a CC of 3.0)? Of the MATLAB implementation (I'm using R2018b)? Of the OS?