MCPcopy Create free account
hub / github.com/ComputationalRobotics/XM-code / DiagAddKernel

Function DiagAddKernel

XM/include/Dense/trace.h:40–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38// diagnal add a matrix
39template <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
48template <typename T>
49inline void DiagAdd(DeviceDnTen<T>& mat, DeviceDnTen<T>& diag){

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected