skcuda.cublas.cublasCrot¶
-
skcuda.cublas.
cublasCrot
(handle, n, x, incx, y, incy, c, s)[source]¶ Apply a complex rotation to complex vectors (single precision)
Multiplies the single precision matrix [[c, s], [-s.conj(), c]] with the 2 x n single precision matrix [[x.T], [y.T]].
Parameters: - handle (int) – CUBLAS context.
- n (int) – Number of elements in input vectors.
- x (ctypes.c_void_p) – Pointer to single precision complex input/output vector.
- incx (int) – Storage spacing between elements of x.
- y (ctypes.c_void_p) – Pointer to single precision complex input/output vector.
- incy (int) – Storage spacing between elements of y.
- c (numpy.float32) – Element of rotation matrix.
- s (numpy.complex64) – Element of rotation matrix.
Notes
Both x and y must contain n elements.
Examples
>>> import pycuda.autoinit >>> import pycuda.gpuarray as gpuarray >>> import numpy as np >>> s = np.complex64(np.random.rand()+1j*np.random.rand()); c = np.float32(np.random.rand()); >>> x = (np.random.rand(5)+1j*np.random.rand(5)).astype(np.complex64) >>> y = (np.random.rand(5)+1j*np.random.rand(5)).astype(np.complex64) >>> x_gpu = gpuarray.to_gpu(x) >>> y_gpu = gpuarray.to_gpu(y) >>> h = cublasCreate() >>> cublasCrot(h, x.size, x_gpu.gpudata, 1, y_gpu.gpudata, 1, c, s) >>> cublasDestroy(h) >>> np.allclose(x_gpu.get(), c*x+s*y) True >>> np.allclose(y_gpu.get(), -s.conj()*x+c*y) True
References