skcuda.cublas.cublasZswap¶
-
skcuda.cublas.
cublasZswap
(handle, n, x, incx, y, incy)[source]¶ Swap double precision complex vectors.
Swaps the contents of one double precision complex vector with those of another double precision complex vector.
Parameters: - handle (int) – CUBLAS context.
- n (int) – Number of elements in input vectors.
- x (ctypes.c_void_p) – Pointer to double precision complex input/output vector.
- incx (int) – Storage spacing between elements of x.
- y (ctypes.c_void_p) – Pointer to double precision complex input/output vector.
- incy (int) – Storage spacing between elements of y.
Examples
>>> import pycuda.autoinit >>> import pycuda.gpuarray as gpuarray >>> import numpy as np >>> x = (np.random.rand(5)+1j*np.random.rand(5)).astype(np.complex128) >>> y = (np.random.rand(5)+1j*np.random.rand(5)).astype(np.complex128) >>> x_gpu = gpuarray.to_gpu(x) >>> y_gpu = gpuarray.to_gpu(y) >>> h = cublasCreate() >>> cublasZswap(h, x.size, x_gpu.gpudata, 1, y_gpu.gpudata, 1) >>> cublasDestroy(h) >>> np.allclose(x_gpu.get(), y) True >>> np.allclose(y_gpu.get(), x) True
Notes
Both x and y must contain n elements.
References