 	cudaMemcpy(distantPCAHost, distantPCAKernel, distantPCASize, cudaMemcpyDeviceToHost);
 	cuCheck(__LINE__);
 	for(int j=0; j<count; ++j) {
+		cudaMemcpy(digitsHost, digitsDevice, sizeof(int)*TrainDataNum, cudaMemcpyDeviceToHost);
+		cuCheck(__LINE__);
 		float* curDistantHost=distantPCAKernel+j*TrainDataNum;
-		mergeSortPCA(curDistantHost, TrainDataNum);
+		mergeSortPCA(curDistantHost, digitsHost, TrainDataNum);
+		int num[10]={};
+		// if(curDistantHost[0]>180) {
+		// 	ans[j]=-1;
+		// 	continue;
+		// }
+		for(int i=0; i<5; i++) {
+			num[digitsHost[i]]+=1;
+		}
+		int curBest=-1;
+		int curInt=-1;
+		for(int i=0; i<10; i++) {
+			if(num[i]!=0&&num[i]>curBest) {
+				curBest=num[i];
+				curInt=i;
+			}
+		}
+		ans[j]=curInt;
 	}
 }
 



//knn code below{{{{{{{{{{{{{{{{{{{{{{{{
int* digits=NULL;
int* digitsDevice=NULL;
float* trainDataHost=NULL;
float* trainDataKernel=NULL;
float* distantHost=NULL;
float* distantKernel=NULL;

float* trainDataPCAHost=NULL;
float* trainDataPCAKernel=NULL;
float* distantPCAHost=NULL;
float* distantPCAKernel=NULL;

//init the answer to the training data
//return by pointer
//this is because the training data only holds the data

	return;
}

void initEigenvectors() {
	float* EigenVectorsHost=(float*)malloc(DataLen*Reduced_Data_Length*sizeof(float));
	cudaMalloc((void **) &EigenVectors, DataLen*Reduced_Data_Length*sizeof(float));
	float* container=EigenVectorsHost;
	FILE* ptr=fopen("explore/eigenvectors.csv", "r");
	char* buffer=(char*)malloc(sizeof(char));
	for(int j=0; j<DataLen; ++j) {
		for(int i=0; i<Reduced_Data_Length; ++i) {
