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

Function traceKernel

XM/include/Dense/trace.h:21–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19
20template <typename T>
21__global__ void traceKernel(T* mat, T* result, size_s N) {
22 // mat is the input square matrix, and result is a scalar output
23 size_l idx = threadIdx.x + blockIdx.x * blockDim.x;
24 if(idx < N){
25 atomicAdd(&result[0], mat[idx*N+idx]);
26 }
27
28}
29
30template <typename T>
31inline void trace(DeviceDnTen<T>& mat, T* result){

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected