How do I construct a complex gpuArray directly on the GPU?
Mostrar comentarios más antiguos
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?
Respuesta aceptada
Más respuestas (1)
KSSV
el 12 de Sept. de 2017
G = gpuArray(rand(10,1)+1i*rand(10,1));
2 comentarios
Kevin
el 12 de Sept. de 2017
Jacob Lynch August
el 9 de Nov. de 2018
Alternatively:
complex(gpuArray.rand(size,type),gpuArray(size,type))
Categorías
Más información sobre GPU Computing in MATLAB en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!