- Timestamp:
- Nov 30, 2008, 2:46:46 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20081124/Ohana/src/opihi/cmd.data/peak.c
r20857 r20860 5 5 int i, N, imax, QUIET; 6 6 double start, end, xmax, ymax; 7 opihi_flt *X, *Y;8 7 Vector *vecx, *vecy; 9 8 … … 31 30 32 31 imax = -1; 32 xmax = -HUGE_VAL; 33 ymax = -HUGE_VAL; 33 34 34 if ( vecx[0].type == OPIHI_FLT) {35 if ((vecx[0].type == OPIHI_FLT) && (vecy[0].type == OPIHI_FLT)) { 35 36 opihi_flt *X = vecx[0].elements.Flt; 36 xmax = X[start]; 37 ymax = (vecy[0].type == OPIHI_FLT) ? vecy[0].elements.Flt[start] : vecy[0].elements.Int[start]; 38 for (i = 1; i < vecx[0].Nelements-1; i++, X++, Y++) { 39 if ((*X >= start) && (*X <= end)) { 40 if ((imax == -1) || (*Y > ymax)) { 41 xmax = *X; 42 ymax = (vecy[0].type == OPIHI_FLT) ? vecy[0].elements.Flt[i] : vecy[0].elements.Int[i]; 43 imax = i; 44 } 45 } 37 opihi_flt *Y = vecy[0].elements.Flt; 38 for (i = 0; i < vecx[0].Nelements; i++, X++, Y++) { 39 if (*X < start) continue; 40 if (*X > end) continue; 41 if (*Y < ymax) continue; 42 xmax = *X; 43 ymax = *Y; 44 imax = i; 46 45 } 47 } else { 46 } 47 if ((vecx[0].type == OPIHI_FLT) && (vecy[0].type == OPIHI_INT)) { 48 opihi_flt *X = vecx[0].elements.Flt; 49 opihi_int *Y = vecy[0].elements.Int; 50 for (i = 0; i < vecx[0].Nelements; i++, X++, Y++) { 51 if (*X < start) continue; 52 if (*X > end) continue; 53 if (*Y < ymax) continue; 54 xmax = *X; 55 ymax = *Y; 56 imax = i; 57 } 58 } 59 if ((vecx[0].type == OPIHI_INT) && (vecy[0].type == OPIHI_FLT)) { 48 60 opihi_int *X = vecx[0].elements.Int; 49 xmax = X[start]; 50 ymax = (vecy[0].type == OPIHI_FLT) ? vecy[0].elements.Flt[start] : vecy[0].elements.Int[start]; 51 for (i = 1; i < vecx[0].Nelements-1; i++, X++, Y++) { 52 if ((*X >= start) && (*X <= end)) { 53 if ((imax == -1) || (*Y > ymax)) { 54 xmax = *X; 55 ymax = (vecy[0].type == OPIHI_FLT) ? vecy[0].elements.Flt[i] : vecy[0].elements.Int[i]; 56 imax = i; 57 } 58 } 61 opihi_flt *Y = vecy[0].elements.Flt; 62 for (i = 0; i < vecx[0].Nelements; i++, X++, Y++) { 63 if (*X < start) continue; 64 if (*X > end) continue; 65 if (*Y < ymax) continue; 66 xmax = *X; 67 ymax = *Y; 68 imax = i; 69 } 70 } 71 if ((vecx[0].type == OPIHI_INT) && (vecy[0].type == OPIHI_INT)) { 72 opihi_int *X = vecx[0].elements.Int; 73 opihi_int *Y = vecy[0].elements.Int; 74 for (i = 0; i < vecx[0].Nelements; i++, X++, Y++) { 75 if (*X < start) continue; 76 if (*X > end) continue; 77 if (*Y < ymax) continue; 78 xmax = *X; 79 ymax = *Y; 80 imax = i; 59 81 } 60 82 }
Note:
See TracChangeset
for help on using the changeset viewer.
