?»??»?#include #include #include #include #define Malloc(type,n) (type *)malloc((n)*sizeof(type)) struct svm_node { int index; double value; }; struct svm_problem { int l; double *y; struct svm_node **x; }; #define m 976 #define n 50000 int main(int argc, char *argv[]) { int i,j,size,k; short num[10]; FILE *fptr; int *ptr = (int *) malloc(m*n*sizeof(int)); struct svm_problem prob; struct svm_node *x_space; fptr = fopen("GASP.SetTwo.1_50000", "r"); if (fptr == NULL) printf("\n GASP.SetTwo.1_50000¸ê®ÆÀɤ£¦s¦b¡I\n"); else { printf(" GASP.SetTwo.1_50000 ŪÀɤ¤ ...\n"); while (!feof(fptr)) { for(i = 0; i < m; i++) { for(j = 0; j < n; j++) { fscanf(fptr, "%hd\n", (ptr+(n*i+j)+1)); } } } } printf("GASP.SetTwo.Label ¦@¦³ %d ¦C¸ê®Æ\n", i); printf("GASP.SetTwo.Label ¦@¦³ %d ¦æ¸ê®Æ\n", j); printf("½Ð¿é¤J¦@¨ú´X¦æ"); scanf("%d", &size); prob.y = Malloc(double,976); prob.x = Malloc(struct svm_node *,976); x_space = Malloc(struct svm_node,size*976); for(k = 0; k < size; k++) { printf("½Ð¿é¤J²Ä %d ¦æ¡G\n", k+1); scanf("%d", &num[k]); } for(k = 0; k < size; k++) { printf("¿é¤J²Ä %d ¦æ¼Æ­È ¡G%d \n", k+1, num[k]); } for(i = 0; i < m; i++) { for(k = 0; k < size; k++) { j=num[k]; if(*(ptr+n*i+j)!= 0) { x_space[i*size+k].index=k+1; x_space[i*size+k].value=*(ptr+n*i+j); printf("%hd", *(ptr+n*i+j)); } } printf("-1\n"); } printf("%hd", x_space[1950].value); fclose(fptr); system("PAUSE"); fptr = fopen("GASP.SetTwo.Label", "r"); if (fptr == NULL) printf("\n GASP.SetTwo.Label¸ê®ÆÀɤ£¦s¦b¡I\n"); else { printf(" GASP.SetTwo.Label ŪÀɤ¤ ...\n"); while (!feof(fptr)) { for(i = 0; i < m; i++) { fscanf(fptr, "%hd\n", &prob.y[i]); } } } printf("GASP.SetTwo.Label ¦@¦³ %d µ§¸ê®Æ\n", i); printf("²Ä966µ§¸ê®Æ¬°%hd",prob.y[965]); printf("²Ä967µ§¸ê®Æ¬°%hd",prob.y[966]); fclose(fptr); system("PAUSE"); return 0; }