| 38 | // diagnal add a matrix |
| 39 | template <typename T> |
| 40 | __global__ void DiagAddKernel(T* mat, T* diag, size_s N) { |
| 41 | // mat is the input square matrix, and diag is the vector output |
| 42 | size_l idx = threadIdx.x + blockIdx.x * blockDim.x; |
| 43 | if(idx < N){ |
| 44 | atomicAdd(&mat[idx*N+idx],diag[idx]); |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | template <typename T> |
| 49 | inline void DiagAdd(DeviceDnTen<T>& mat, DeviceDnTen<T>& diag){ |
nothing calls this directly
no outgoing calls
no test coverage detected