    	int j = blockIdx.y;
 	int k = threadIdx.x;
 	int s;
-	int dist = 0;
 	// calculate the square of distance per dimensions
 	computeDimDist(m, n, V);
 	__syncthreads();
 	// reduce duplicated calculations since d(i, j) = d(j, i)
 	// also, we do not consider the trivial case of d(i, i) = 0
 	// so we only compute the square distance when i < j 
-	if( i < j )
+	if(i < j)
 	{
 		// use paralel reduction
 		for(s=n/2; s>0; s>>=1)

#include<cuda.h>
#include<stdlib.h>

#define INIT_MAX 100
void showResult(int m, int k, int *out);

extern __shared__ int SM[];

		cudaMalloc((void **)&d_V, m*n*sizeof(int));
		cudaMalloc((void **)&d_out, m*k*sizeof(int));
		cudaMalloc((void **)&D, m*m*sizeof(int));
		cudaMalloc((void **)&R, m*m*sizeof(int));
//		cudaMalloc((void **)&dim_D, m*m*n*sizeof(int));

		for(i=0; i<m*n; i++)
