How do I construct a complex gpuArray directly on the GPU?
显示 更早的评论
I am trying to initialize a complex gpuArray directly on the GPU (i.e. without first creating a complex array in host memory and then copying it over to the device).
So far the only thing I've found that works is:
foo = gpuArray(complex(0));
bar = zeros(4, 1, 'like',foo);
which seems kinda silly. Is there a way to allocate a complex gpuArray directly using something like gpuArray.zeros?
采纳的回答
更多回答(1 个)
KSSV
2017-9-12
G = gpuArray(rand(10,1)+1i*rand(10,1));
2 个评论
Kevin
2017-9-12
Jacob Lynch August
2018-11-9
Alternatively:
complex(gpuArray.rand(size,type),gpuArray(size,type))
类别
在 帮助中心 和 File Exchange 中查找有关 GPU Computing in MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!