Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

c - Array subscript is not an integer -


following previous question malloc memory corruption in c, have problem. have same code. trying multiply values contained in arrays * vc , store in res. set 0 , second multiplication res , vc , store values in a. (a , q square matrices , mc , vc n lines 2 columns matrices or arrays). here code :

    int jacobi_gpu(double a[], double q[],             double tol, long int dim){   int nrot, p, q, k, tid;   double c, s;   double *mc, *vc, *res;   int i,kc;   double vc1, vc2;    mc   = (double *)malloc(2 * dim * sizeof(double));   vc   = (double *)malloc(2 * dim * sizeof(double));   vc   = (double *)malloc(dim * dim * sizeof(double));    if( mc == null || vc == null){     fprintf(stderr, "pb allocation matricre\n");     exit(1);   }    nrot = 0;    for(k = 0; k < dim - 1; k++){      eye(mc, dim);     eye(vc, dim);      for(tid = 0; tid < floor(dim /2); tid++){       p = (tid + k)%(dim - 1);       if(tid != 0)     q = (dim - tid + k - 1)%(dim - 1);       else     q = dim - 1;        printf("p = %d | q = %d\n", p, q);       if(fabs(a[p + q*dim]) > tol){      nrot++;     symschur2(a, dim, p, q, &c, &s);       mc[2*tid] = p;                                               vc[2 * tid] = c;     mc[2*tid + 1] = q;                                           vc[2*tid + 1] = -s;     mc[2*tid + 2*(dim - 2*tid) - 2] = p;                         vc[2*tid + 2*(dim - 2*tid)   - 2 ] = s;     mc[2*tid + 2*(dim - 2*tid) - 1] = q;                         vc[2 * tid + 2*(dim - 2*tid) - 1 ] = c;        }     }      for( = 0; i< dim; i++){       for(kc=0; kc < dim; kc++){     if( kc < floor(dim/2)) {       vc1 = vc[2*kc + i*dim];       vc2 = vc[2*kc + 2*(dim - 2*kc) - 2];     }else {       vc1 = vc[2*kc+1 + i*dim];       vc2 = vc[2*kc - 2*(dim - 2*kc) - 1];     }     res[kc + i*dim] = a[mc[2*kc] + i*dim]*vc1 + a[mc[2*kc + 1] + i*dim]*vc2;       }     }      zero(a, dim);      for( = 0; i< dim; i++){       for(kc=0; kc < dim; k++){     if( k < floor(dim/2)){       vc1 = vc[2*kc + i*dim];       vc2 = vc[2*kc + 2*(dim - 2*kc) - 2];     }else {       vc1 = vc[2*kc+1 + i*dim];       vc2 = vc[2*kc - 2*(dim - 2*kc) - 1];     }     a[kc + i*dim] = res[mc[2*kc] + i*dim]*vc1 + res[mc[2*kc + 1] + i*dim]*vc2;       }     }       affiche(mc,dim,2,"matrice creuse");     affiche(vc,dim,2,"valeur creuse");    }    free(mc);   free(vc);   free(res);   return nrot; } 

when try compile, have error :

    jacobi_gpu.c: in function ‘jacobi_gpu’: jacobi_gpu.c:103: error: array subscript not integer jacobi_gpu.c:103: error: array subscript not integer jacobi_gpu.c:118: error: array subscript not integer jacobi_gpu.c:118: error: array subscript not integer make: *** [jacobi_gpu.o] erreur 1 

the corresponding lines store results in res , :

res[kc + i*dim] = a[mc[2*kc] + i*dim]*vc1 + a[mc[2*kc + 1] + i*dim]*vc2; 

and

a[kc + i*dim] = res[mc[2*kc] + i*dim]*vc1 + res[mc[2*kc + 1] + i*dim]*vc2; 

can explain me error , how can correct it? help. ;)

mc of type double. has integral type


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -