   // Make sure we do not go out of bounds
   if (id < n)
     atomicAdd(trg + idx[id], -src[id]);
-
-  __syncthreads();
 }
 
 void dense_to_sparse_subtract(int n, const unsigned int *idx, float *src, float *trg) {

  // Make sure we do not go out of bounds
  if (id < n)
    trg[id] = val;

  __syncthreads();
}

void const_init(int n, float val, float *trg) {

  // Make sure we do not go out of bounds
  if (id < n)
    trg[id] = src[idx[id]];
}

void sparse_to_dense_assign(int n, const unsigned int *idx, float *src, float *trg) {
