| 9 | // diag of a square matrix |
| 10 | template <typename T> |
| 11 | __global__ void DiagKernel(T* mat, T* diag, size_s N) { |
| 12 | // mat is the input square matrix, and diag is the vector output |
| 13 | size_l idx = threadIdx.x + blockIdx.x * blockDim.x; |
| 14 | if(idx < N){ |
| 15 | diag[idx] = mat[idx*N+idx]; |
| 16 | } |
| 17 | |
| 18 | } |
| 19 | |
| 20 | template <typename T> |
| 21 | __global__ void traceKernel(T* mat, T* result, size_s N) { |
nothing calls this directly
no outgoing calls
no test coverage detected