IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 30, 2011, 8:05:04 AM (15 years ago)
Author:
eugene
Message:

avoid double counting the pairs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20111122/Ohana/src/opihi/cmd.astro/spex1dgas.c

    r32995 r33037  
    172172    }
    173173
    174     N = index2->elements.Int[i];
    175     if (N >= Nobject) abort();
    176     m = object[N].Nindex;
    177     object[N].index[m] = index1->elements.Int[i];
    178     object[N].Dtgt[m] = distance->elements.Flt[i];
    179     object[N].Dcur[m] = 0.0;
    180     object[N].Nindex ++;
    181     if (object[N].Nindex == object[N].NINDEX) {
    182       object[N].NINDEX += 100;
    183       REALLOCATE (object[N].Dtgt, float, object[N].NINDEX);
    184       REALLOCATE (object[N].Dcur, float, object[N].NINDEX);
    185       REALLOCATE (object[N].index, int, object[N].NINDEX);
    186     }
     174    // Above we used the set (N,M,D_N,M) to assigned the distance of obj M to obj N.
     175    // Below we use that set to assign the distance of obj N to obj M.  IF we supply all
     176    // pairwise distances, then this duplicates all entries, so we need to skip that step
     177    // in such a case.
     178
     179    // XX N = index2->elements.Int[i];
     180    // XX if (N >= Nobject) abort();
     181    // XX m = object[N].Nindex;
     182    // XX object[N].index[m] = index1->elements.Int[i];
     183    // XX object[N].Dtgt[m] = distance->elements.Flt[i];
     184    // XX object[N].Dcur[m] = 0.0;
     185    // XX object[N].Nindex ++;
     186    // XX if (object[N].Nindex == object[N].NINDEX) {
     187    // XX   object[N].NINDEX += 100;
     188    // XX   REALLOCATE (object[N].Dtgt, float, object[N].NINDEX);
     189    // XX   REALLOCATE (object[N].Dcur, float, object[N].NINDEX);
     190    // XX   REALLOCATE (object[N].index, int, object[N].NINDEX);
     191    // XX }
    187192  }
    188193
     
    221226  // int idx2 = object[idx1].index[(int)(0.75*object[idx1].Nindex)];
    222227  float A = NAN;
    223   for (i = 0; isnan (A) && (i < object[idx1].Nindex); i++) {
    224       if (object[idx1].index[i] == idx2) {
    225           A = object[idx1].Dtgt[i];
     228  for (i = 0; isnan (A) && (i < object[idx2].Nindex); i++) {
     229      if (object[idx2].index[i] == idx1) {
     230          A = object[idx2].Dtgt[i];
    226231      }
    227232  }
Note: See TracChangeset for help on using the changeset viewer.