IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 8, 2008, 12:50:52 PM (19 years ago)
Author:
eugene
Message:

replaced sort functions drived from press with sort macros derived from gsl

Location:
trunk/Ohana/src/addstar
Files:
1 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/addstar/Makefile

    r15036 r16040  
    6868$(SRC)/ReadStarsTEXT.$(ARCH).o \
    6969$(SRC)/FilterStars.$(ARCH).o \
    70 $(SRC)/sort_lists.$(ARCH).o \
    7170$(SRC)/ImageOptions.$(ARCH).o \
    7271$(SRC)/GetFileMode.$(ARCH).o \
    … …  
    114113$(SRC)/opening_angle.$(ARCH).o \
    115114$(SRC)/replace_match.$(ARCH).o \
    116 $(SRC)/sort_lists.$(ARCH).o \
    117115$(SRC)/update_coords.$(ARCH).o
    118116
    … …  
    151149$(SRC)/SkyRegionUtils.$(ARCH).o \
    152150$(SRC)/SkyListForStars.$(ARCH).o \
    153 $(SRC)/sort_lists.$(ARCH).o \
    154151$(SRC)/update_coords.$(ARCH).o \
    155152$(SRC)/Shutdown.$(ARCH).o \
    … …  
    194191$(SRC)/find_matches_refstars.$(ARCH).o \
    195192$(SRC)/args_load2mass.$(ARCH).o \
    196 $(SRC)/sort_lists.$(ARCH).o \
    197193$(SRC)/replace_match.$(ARCH).o \
    198194$(SRC)/update_coords.$(ARCH).o \
  • trunk/Ohana/src/addstar/src/SEDops.c

    r13479 r16040  
    5757SEDtableRow **sort_SEDtable (SEDtableRow *raw, int N) {
    5858
    59   int l,j,ir,i;
    60   SEDtableRow **value, *temp;
     59  int i;
     60
     61  SEDtableRow **value;
    6162 
    6263  if (N <= 0) return (NULL);
    … …  
    6667    value[i] = &raw[i];
    6768  }
    68   if (N < 2) return (value);
    69 
    70   l = N >> 1;
    71   ir = N - 1;
    72   for (;;) {
    73     if (l > 0) {
    74       l--;
    75       temp = value[l];
    76     }
    77     else {
    78       temp = value[ir];
    79       value[ir] = value[0];
    80       if (--ir == 0) {
    81         value[0] = temp;
    82         return (value);
    83       }
    84     }
    85     i = l;
    86     j = (l << 1) + 1;
    87     while (j <= ir) {
    88       if (j < ir && value[j][0].color < value[j+1][0].color) ++j;
    89       if (temp[0].color < value[j][0].color) {
    90         value[i] = value[j];
    91         j += (i=j) + 1;
    92       }
    93       else j = ir + 1;
    94     }
    95     value[i] = temp;
    96   }
     69
     70# define SWAPFUNC(A,B){ SEDtableRow *temp = value[A]; value[A] = value[B]; value[B] = temp; }
     71# define COMPARE(A,B)(value[A][0].color < value[B][0].color)
     72
     73  OHANA_SORT (N, COMPARE, SWAPFUNC);
     74
     75# undef SWAPFUNC
     76# undef COMPARE
    9777
    9878  return (value);
  • trunk/Ohana/src/addstar/src/SkyListForStars.c

    r14401 r16040  
    1515  list[0].ownElements = FALSE; // free these elements when freeing the list
    1616
    17   sort_stars (stars, Nstars); /* sort by RA */
     17  sort_stars_ra (stars, Nstars); /* sort by RA */
    1818  for (i = 0; i < Nstars; i++) {
    1919    if (stars[i].found) continue;
  • trunk/Ohana/src/addstar/src/calibrate.c

    r15509 r16040  
    188188    return;
    189189  }
    190   fsort2 (Dmag, dDmag, Nkeep);
     190  fsortpair (Dmag, dDmag, Nkeep);
    191191
    192192  /* take sort list of Dmag, find median */
  • trunk/Ohana/src/addstar/src/find_matches.c

    r15743 r16040  
    55  int i, j, n, N, J, status, Nstars;
    66  double RADIUS, RADIUS2;
    7   float *X1, *Y1, *X2, *Y2;
    8   float dX, dY, dR;
     7  double *X1, *Y1, *X2, *Y2;
     8  double dX, dY, dR;
    99  int *N1, *N2,  *next_meas;
    1010  int Nave, NAVE, Nmeas, NMEAS, Nmatch;
    … …  
    2121
    2222  /** allocate local arrays (stars) **/
    23   ALLOCATE (X1, float, NstarsIn);
    24   ALLOCATE (Y1, float, NstarsIn);
     23  ALLOCATE (X1, double, NstarsIn);
     24  ALLOCATE (Y1, double, NstarsIn);
    2525  ALLOCATE (N1, int,   NstarsIn);
    2626
    2727  /** allocate local arrays (catalog) **/
    2828  NAVE = Nave = catalog[0].Naverage;
    29   ALLOCATE (X2, float, NAVE);
    30   ALLOCATE (Y2, float, NAVE);
     29  ALLOCATE (X2, double, NAVE);
     30  ALLOCATE (Y2, double, NAVE);
    3131  ALLOCATE (N2, int,   NAVE);
    3232  ALLOCATE (catalog[0].found, int, NAVE);
    … …  
    6060  Nstars = 0;
    6161  for (i = 0; i < NstarsIn; i++) {
    62     status = fRD_to_XY (&X1[Nstars], &Y1[Nstars], stars[i].R, stars[i].D, &tcoords);
     62    status = RD_to_XY (&X1[Nstars], &Y1[Nstars], stars[i].R, stars[i].D, &tcoords);
    6363    if (!status) continue;
    6464    N1[Nstars] = i;
    … …  
    7676    return (0);
    7777  }
    78   if (Nstars > 1) sort_lists (X1, Y1, N1, Nstars);
     78  if (Nstars > 1) sort_coords_index (X1, Y1, N1, Nstars);
    7979 
    8080  /* build spatial index (RA sort) */
    8181  for (i = 0; i < Nave; i++) {
    82     fRD_to_XY (&X2[i], &Y2[i], catalog[0].average[i].R, catalog[0].average[i].D, &tcoords);
     82    RD_to_XY (&X2[i], &Y2[i], catalog[0].average[i].R, catalog[0].average[i].D, &tcoords);
    8383    N2[i] = i;
    8484    catalog[0].found[N2[i]] = -1;
    8585  }
    86   if (Nave > 1) sort_lists (X2, Y2, N2, Nave);
     86  if (Nave > 1) sort_coords_index (X2, Y2, N2, Nave);
    8787
    8888  /* set up pointers for linked list of measure */
  • trunk/Ohana/src/addstar/src/find_matches_closest.c

    r15743 r16040  
    55  int i, j, n, N, J, Jmin, status, Nstars;
    66  double RADIUS, RADIUS2, Rmin;
    7   float *X1, *Y1, *X2, *Y2;
    8   float dX, dY, dR;
     7  double *X1, *Y1, *X2, *Y2;
     8  double dX, dY, dR;
    99  int *N1, *N2,  *next_meas, *next_miss;
    1010  int Nave, NAVE, Nmeas, NMEAS, Nmiss, NMISS, Nmatch;
    … …  
    2121
    2222  /** allocate local arrays (stars) **/
    23   ALLOCATE (X1, float, NstarsIn);
    24   ALLOCATE (Y1, float, NstarsIn);
     23  ALLOCATE (X1, double, NstarsIn);
     24  ALLOCATE (Y1, double, NstarsIn);
    2525  ALLOCATE (N1, int,   NstarsIn);
    2626
    2727  /** allocate local arrays (catalog) **/
    2828  NAVE = Nave = catalog[0].Naverage;
    29   ALLOCATE (X2, float, NAVE);
    30   ALLOCATE (Y2, float, NAVE);
     29  ALLOCATE (X2, double, NAVE);
     30  ALLOCATE (Y2, double, NAVE);
    3131  ALLOCATE (N2, int,   NAVE);
    3232  ALLOCATE (catalog[0].found, int, NAVE);
    … …  
    6161  Nstars = 0;
    6262  for (i = 0; i < NstarsIn; i++) {
    63     status = fRD_to_XY (&X1[Nstars], &Y1[Nstars], stars[i].R, stars[i].D, &tcoords);
     63    status = RD_to_XY (&X1[Nstars], &Y1[Nstars], stars[i].R, stars[i].D, &tcoords);
    6464    if (!status) continue;
    6565    N1[Nstars] = i;
    … …  
    7777    return (0);
    7878  }
    79   if (Nstars > 1) sort_lists (X1, Y1, N1, Nstars);
     79  if (Nstars > 1) sort_coords_index (X1, Y1, N1, Nstars);
    8080
    8181  /* build spatial index (RA sort) */
    8282  for (i = 0; i < Nave; i++) {
    83     fRD_to_XY (&X2[i], &Y2[i], catalog[0].average[i].R, catalog[0].average[i].D, &tcoords);
     83    RD_to_XY (&X2[i], &Y2[i], catalog[0].average[i].R, catalog[0].average[i].D, &tcoords);
    8484    N2[i] = i;
    8585    catalog[0].found[N2[i]] = -1;
    8686  }
    87   if (Nave > 1) sort_lists (X2, Y2, N2, Nave);
     87  if (Nave > 1) sort_coords_index (X2, Y2, N2, Nave);
    8888
    8989  /* set up pointers for linked list of measure, missing */
  • trunk/Ohana/src/addstar/src/find_matches_refstars.c

    r15743 r16040  
    55  int i, j, k, n, m, N, J;
    66  double RADIUS, RADIUS2;
    7   float *X1, *Y1, *X2, *Y2;
    8   float dX, dY, dR;
     7  double *X1, *Y1, *X2, *Y2;
     8  double dX, dY, dR;
    99  int *N1, *N2,  *next, *next_miss, last, last_miss;
    1010  int Nave, NAVE, Nmeas, NMEAS, Nmiss, NMISS, Nmatch;
    … …  
    1818
    1919  /** allocate local arrays (stars) **/
    20   ALLOCATE (X1, float, Nstars);
    21   ALLOCATE (Y1, float, Nstars);
     20  ALLOCATE (X1, double, Nstars);
     21  ALLOCATE (Y1, double, Nstars);
    2222  ALLOCATE (N1, int,   Nstars);
    2323
    … …  
    2525  Nave = catalog[0].Naverage;
    2626  NAVE = Nave + 1000;
    27   ALLOCATE (X2, float, NAVE);
    28   ALLOCATE (Y2, float, NAVE);
     27  ALLOCATE (X2, double, NAVE);
     28  ALLOCATE (Y2, double, NAVE);
    2929  ALLOCATE (N2, int, NAVE);
    3030  ALLOCATE (catalog[0].found, int, NAVE);
    … …  
    5959 
    6060  for (i = 0; i < Nstars; i++) {
    61     fRD_to_XY (&X1[i], &Y1[i], stars[i][0].R, stars[i][0].D, &tcoords);
     61    RD_to_XY (&X1[i], &Y1[i], stars[i][0].R, stars[i][0].D, &tcoords);
    6262    N1[i] = i;
    6363  }
    64   if (Nstars > 1) sort_lists (X1, Y1, N1, Nstars);
     64  if (Nstars > 1) sort_coords_index (X1, Y1, N1, Nstars);
    6565 
    6666  for (i = 0; i < Nave; i++) {
    67     fRD_to_XY (&X2[i], &Y2[i], catalog[0].average[i].R, catalog[0].average[i].D, &tcoords);
     67    RD_to_XY (&X2[i], &Y2[i], catalog[0].average[i].R, catalog[0].average[i].D, &tcoords);
    6868    N2[i] = i;
    6969    catalog[0].found[N2[i]] = -1;
    7070  }
    71   if (Nave > 1) sort_lists (X2, Y2, N2, Nave);
     71  if (Nave > 1) sort_coords_index (X2, Y2, N2, Nave);
    7272
    7373  /* set up pointers for linked list of measurements */
Note: See TracChangeset for help on using the changeset viewer.