IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 27, 2015, 4:49:06 PM (11 years ago)
Author:
eugene
Message:

extensive work on relphot, relastro, uniphot, dvomerge aiming to the construction and calibration of PV3

Location:
trunk/Ohana
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana

  • trunk/Ohana/src/libohana/src/sorts.c

    r33963 r38986  
    2727}
    2828
    29 void fsortpair (float *X, float *Y, int N) {
     29void isort (int *value, int N) {
    3030
    31 # define SWAPFUNC(A,B){ float tmp; \
     31# define SWAPFUNC(A,B){ int tmp = value[A]; value[A] = value[B]; value[B] = tmp; }
     32# define COMPARE(A,B)(value[A] < value[B])
     33
     34  OHANA_SORT (N, COMPARE, SWAPFUNC);
     35
     36# undef SWAPFUNC
     37# undef COMPARE
     38
     39}
     40
     41void dsortpair (double *X, double *Y, int N) {
     42
     43# define SWAPFUNC(A,B){ double tmp; \
    3244  tmp = X[A]; X[A] = X[B]; X[B] = tmp; \
    3345  tmp = Y[A]; Y[A] = Y[B]; Y[B] = tmp; \
     
    4254}
    4355
    44 void dsortpair (double *X, double *Y, int N) {
     56void fsortpair (float *X, float *Y, int N) {
    4557
    46 # define SWAPFUNC(A,B){ double tmp; \
     58# define SWAPFUNC(A,B){ float tmp; \
    4759  tmp = X[A]; X[A] = X[B]; X[B] = tmp; \
    4860  tmp = Y[A]; Y[A] = Y[B]; Y[B] = tmp; \
     
    89101}
    90102
     103void dsortthree (double *X, double *Y, double *Z, int N) {
     104
     105# define SWAPFUNC(A,B){ double tmp; \
     106  tmp = X[A]; X[A] = X[B]; X[B] = tmp; \
     107  tmp = Y[A]; Y[A] = Y[B]; Y[B] = tmp; \
     108  tmp = Z[A]; Z[A] = Z[B]; Z[B] = tmp; \
     109}
     110# define COMPARE(A,B)(X[A] < X[B])
     111
     112  OHANA_SORT (N, COMPARE, SWAPFUNC);
     113
     114# undef SWAPFUNC
     115# undef COMPARE
     116
     117}
     118
    91119void fsortthree (float *X, float *Y, float *Z, int N) {
    92120
     
    105133}
    106134
    107 void dsortthree (double *X, double *Y, double *Z, int N) {
     135void dsortfour (double *X, double *Y, double *Z, double *W, int N) {
    108136
    109137# define SWAPFUNC(A,B){ double tmp; \
     
    111139  tmp = Y[A]; Y[A] = Y[B]; Y[B] = tmp; \
    112140  tmp = Z[A]; Z[A] = Z[B]; Z[B] = tmp; \
     141  tmp = W[A]; W[A] = W[B]; W[B] = tmp; \
    113142}
    114143# define COMPARE(A,B)(X[A] < X[B])
     
    138167}
    139168
    140 void dsortfour (double *X, double *Y, double *Z, double *W, int N) {
     169void isortfour (int *X, int *Y, int *Z, int *W, int N) {
    141170
    142 # define SWAPFUNC(A,B){ double tmp; \
     171# define SWAPFUNC(A,B){ int tmp; \
    143172  tmp = X[A]; X[A] = X[B]; X[B] = tmp; \
    144173  tmp = Y[A]; Y[A] = Y[B]; Y[B] = tmp; \
     
    154183
    155184}
     185
Note: See TracChangeset for help on using the changeset viewer.