Changeset 12368
- Timestamp:
- 06/05/12 09:26:57 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/Container/Observations.cpp
r12298 r12368 216 216 Observation *observation2 = NULL; 217 217 218 int *counter= (int*)xmalloc(n*sizeof(int));219 for(j=0;j<n;j++) counter[j] = 0 ;218 double *counter = (double*)xmalloc(n*sizeof(double)); 219 for(j=0;j<n;j++) counter[j] = 0.0; 220 220 for(j=0;j<n;j++) gamma[j] = 0.0; 221 221 … … 234 234 235 235 gamma[index] += 1./2.*pow(observation1->value - observation2->value,2.); 236 counter[index] += 1 ;236 counter[index] += 1.; 237 237 } 238 238 } 239 239 240 240 /*Normalize semivariogram*/ 241 gamma[0]=0 ;241 gamma[0]=0.; 242 242 for(k=0;k<n;k++){ 243 if(counter[k]) gamma[k] = gamma[k]/ double(counter[k]);243 if(counter[k]) gamma[k] = gamma[k]/counter[k]; 244 244 } 245 245
Note:
See TracChangeset
for help on using the changeset viewer.