Changeset 12368


Ignore:
Timestamp:
06/05/12 09:26:57 (13 years ago)
Author:
Mathieu Morlighem
Message:

counter is now a double

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/Container/Observations.cpp

    r12298 r12368  
    216216        Observation *observation2 = NULL;
    217217
    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;
    220220        for(j=0;j<n;j++) gamma[j]   = 0.0;
    221221
     
    234234
    235235                        gamma[index]   += 1./2.*pow(observation1->value - observation2->value,2.);
    236                         counter[index] += 1;
     236                        counter[index] += 1.;
    237237                }
    238238        }
    239239
    240240        /*Normalize semivariogram*/
    241         gamma[0]=0;
     241        gamma[0]=0.;
    242242        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];
    244244        }
    245245
Note: See TracChangeset for help on using the changeset viewer.