#include "meanshift_kernels.h" #include __global__ void calculate_kernel_matrix_kernel(Matrix shifted_points, Matrix original_points, double deviation, Matrix kernel_matrix){ // Each thread calculates one element of kernel_matrix int row = blockIdx.x * blockDim.x + threadIdx.x; int col = blockIdx.y * blockDim.y + threadIdx.y; if (row * kernel_matrix.width + col > kernel_matrix.width * kernel_matrix.height){ return; } int dimensions = shifted_points.width; // calculate distance double sum = 0, dif; for (int i=0; i denominator.width * denominator.height){ return; } denominator.elements[col]=0; denominator.elements[row] += kernel_matrix.elements[row*denominator.width + col]; }