- Timestamp:
- Nov 30, 2008, 7:45:21 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20081124/Ohana/src/opihi/cmd.data/vbin.c
r20839 r20857 42 42 Nout = Nin / scale; 43 43 44 REALLOCATE (out[0].elements.Flt, opihi_flt, Nout);45 out[0].Nelements = Nout;44 // re-binning creates a float vector 45 ResetVector (out, OPIHI_FLT, in[0].Nelements); 46 46 47 Vin = in[0].elements.Flt;48 47 Vout = out[0].elements.Flt; 49 for (n = j = 0; j < Nout; j++, Vout++) { 50 *Vout = 0; 51 for (N = i = 0; (i < scale) && (n < Nin); n++, i++, Vin++) { 52 if (!finite (*Vin)) continue; 53 if (Ignore && (*Vin == IgnoreValue)) continue; 54 *Vout += *Vin; 55 N ++; 56 } 57 if (Normalize) { 58 if (N > 0) { 59 *Vout /= (opihi_flt) N; 60 } else { 61 *Vout = 0; 48 49 if (in[0].type == OPIHI_FLT) { 50 opihi_flt *Vin = in[0].elements.Flt; 51 for (n = j = 0; j < Nout; j++, Vout++) { 52 *Vout = 0; 53 for (N = i = 0; (i < scale) && (n < Nin); n++, i++, Vin++) { 54 if (!finite (*Vin)) continue; 55 if (Ignore && (*Vin == IgnoreValue)) continue; 56 *Vout += *Vin; 57 N ++; 58 } 59 if (Normalize) { 60 if (N > 0) { 61 *Vout /= (opihi_flt) N; 62 } else { 63 *Vout = 0; 64 } 65 } 66 } 67 } else { 68 opihi_int *Vin = in[0].elements.Int; 69 for (n = j = 0; j < Nout; j++, Vout++) { 70 *Vout = 0; 71 for (N = i = 0; (i < scale) && (n < Nin); n++, i++, Vin++) { 72 if (!finite (*Vin)) continue; 73 if (Ignore && (*Vin == IgnoreValue)) continue; 74 *Vout += *Vin; 75 N ++; 76 } 77 if (Normalize) { 78 if (N > 0) { 79 *Vout /= (opihi_flt) N; 80 } else { 81 *Vout = 0; 82 } 62 83 } 63 84 }
Note:
See TracChangeset
for help on using the changeset viewer.
