scikits.cuda.cublas.cublasZrot

scikits.cuda.cublas.cublasZrot(handle, n, x, incx, y, incy, c, s)[source]

Apply a complex rotation to complex vectors (double-precision)

Multiplies the double-precision matrix [[c, s], [-s.conj(), c]] with the 2 x n double-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 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.

c : numpy.float64

Element of rotation matrix.

s : numpy.complex128

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.complex128(np.random.rand()+1j*np.random.rand()); c = np.float64(np.random.rand());
>>> 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()
>>> cublasZrot(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