     __syncthreads();
 
     if (tx == 0) {
-        sdv1[bx * MEAN_SDV_THREADS + ty] = sqrt(partialSum1[ty][0] / SURF_DESCRIPTOR_SIZE);
-        sdv2[bx * MEAN_SDV_THREADS + ty] = sqrt(partialSum2[ty][0] / SURF_DESCRIPTOR_SIZE);
-    }
+        sdv1[mPos] = sqrt(partialSum1[ty][0] / SURF_DESCRIPTOR_SIZE);
+        sdv2[mPos] = sqrt(partialSum2[ty][0] / SURF_DESCRIPTOR_SIZE);
+    }       
 }
 
 __global__

    unsigned int bx = blockIdx.x;
    unsigned int by = blockIdx.y;

    partialSum1[ty][tx] = desc1[(bx * (MEAN_SDV_THREADS) + ty) * SURF_DESCRIPTOR_SIZE + tx];
    partialSum2[ty][tx] = desc2[(bx * (MEAN_SDV_THREADS) + ty) * SURF_DESCRIPTOR_SIZE + tx];

    for (unsigned int stride = blockDim.x>>1; stride > 0; stride >>= 1) {
        __syncthreads();

        }
        cout << endl;
    }
    free(hCorr);//*/

    timings.tCalcCorrelation = clock() - myTime;
    myTime = clock();
