skcuda.linalg.trace

skcuda.linalg.trace(x_gpu, handle=None)[source]

Return the sum along the main diagonal of the array.

Parameters:
  • x_gpu (pycuda.gpuarray.GPUArray) – Matrix to calculate the trace of.
  • handle (int) – CUBLAS context. If no context is specified, the default handle from skcuda.misc._global_cublas_handle is used.
Returns:

trace – trace of x_gpu

Return type:

number