skcuda.linalg.hermitian¶
-
skcuda.linalg.
hermitian
(a_gpu, handle=None)[source]¶ Hermitian (conjugate) matrix transpose.
Conjugate transpose a matrix in device memory and return an object representing the transposed matrix.
Parameters: - a_gpu (pycuda.gpuarray.GPUArray) – Input matrix of shape (m, n).
- handle (int) – CUBLAS context. If no context is specified, the default handle from skcuda.misc._global_cublas_handle is used.
Returns: at_gpu – Transposed matrix of shape (n, m).
Return type: Examples
>>> import pycuda.autoinit >>> import pycuda.driver as drv >>> import pycuda.gpuarray as gpuarray >>> import numpy as np >>> import skcuda.linalg as linalg >>> linalg.init() >>> a = np.array([[1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12]], np.float32) >>> a_gpu = gpuarray.to_gpu(a) >>> at_gpu = linalg.hermitian(a_gpu) >>> np.all(a.T == at_gpu.get()) True >>> b = np.array([[1j, 2j, 3j, 4j, 5j, 6j], [7j, 8j, 9j, 10j, 11j, 12j]], np.complex64) >>> b_gpu = gpuarray.to_gpu(b) >>> bt_gpu = linalg.hermitian(b_gpu) >>> np.all(np.conj(b.T) == bt_gpu.get()) True