skcuda.cublas.cublasDznrm2¶
-
skcuda.cublas.
cublasDznrm2
(handle, n, x, incx)[source]¶ Euclidean norm (2-norm) of real vector.
Computes the Euclidean norm of a 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 vector.
- incx (int) – Storage spacing between elements of x.
Returns: nrm – Euclidean norm of x.
Return type: numpy.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) >>> x_gpu = gpuarray.to_gpu(x) >>> h = cublasCreate() >>> nrm = cublasDznrm2(h, x.size, x_gpu.gpudata, 1) >>> cublasDestroy(h) >>> np.allclose(nrm, np.linalg.norm(x)) True
References