     alpha[j] -= l * y[j];
 }
 
-__global__ void kernelCheckCache(const int * i_ptr, float * K, int * KCacheRemapIdx, int * KCacheVecIdx, int cache_rows, const float * x, float gamma, int num_vec, int num_vec_aligned, int dim, int dim_aligned, int lastPtrIdx)
+__global__ void kernelCheckCache(const int * i_ptr, float * K, int * KCacheRemapIdx, int * KCacheVecIdx, int cache_rows, const float * x, const float * xT, float gamma, int num_vec, int num_vec_aligned, int dim, int dim_aligned, int lastPtrIdx)
 {
     int i = *i_ptr;
     if (KCacheRemapIdx[i] >= 0)

    {
        int idx = idxshift + threadIdx.x;
        if (idx < dim)
            xi[idx] = x[num_vec_aligned * idx + i];
            //xi[idx] = x[dim_aligned * i + idx];
        idxshift += blockDim.x;
    }
    __syncthreads();

        for (int d = 0; d < dim; d++)
        {
            //float diff = xi[d] - x[dim_aligned * j + d];
            float diff = xi[d] - xT[num_vec_aligned * d + j];
            //float diff = x[dim_aligned * i + d] - x[dim_aligned * j + d];
            //float diff = xT[num_vec_aligned * d + i] - xT[num_vec_aligned * d + j];
            sum += diff * diff;
        }
        K[num_vec_aligned * last + j] = exp(-gamma * sum);
