skcuda.cublas.cublasZdotc¶
-
skcuda.cublas.
cublasZdotc
(handle, n, x, incx, y, incy)[source]¶ Vector dot product (double precision complex)
Computes the dot product of two double precision complex vectors. cublasCdotc and cublasZdotc use the conjugate of the first vector when computing the dot product.
Parameters: - handle (int) – CUBLAS context.
- n (int) – Number of elements in input vectors.
- x (ctypes.c_void_p) – Pointer to double precision complex input 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.
Returns: d – Dot product of x and y.
Return type: np.complex128
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() >>> d = cublasZdotc(h, x_gpu.size, x_gpu.gpudata, 1, y_gpu.gpudata, 1) >>> cublasDestroy(h) >>> np.allclose(d, np.dot(np.conj(x), y)) True
Notes
Both x and y must contain n elements.
References