IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 7, 2008, 3:31:01 PM (18 years ago)
Author:
eugene
Message:

big update from eam_branch_20081124 with updates to Opihi math

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/cmd.data/cumulative.c

    r10307 r20936  
    44 
    55  int i;
    6   float *Vi, *Vo;
     6  opihi_flt *Vo;
    77  Vector *ivec, *ovec;
    88
     
    1414  if ((ivec = SelectVector (argv[1], OLDVECTOR, TRUE)) == NULL) return (FALSE);
    1515  if ((ovec = SelectVector (argv[2], ANYVECTOR, TRUE)) == NULL) return (FALSE);
    16   ovec[0].Nelements = ivec[0].Nelements;
    17    
    18   REALLOCATE (ovec[0].elements, float, ovec[0].Nelements);
    19   bzero (ovec[0].elements, sizeof(float)*ovec[0].Nelements);
    2016
    21   Vi = ivec[0].elements;
    22   Vo = ovec[0].elements;
    23   *Vo = *Vi;
    24   for (i = 1; i < ivec[0].Nelements; i++, Vi++, Vo++) {
    25     *Vo = Vo[-1] + *Vi;
    26   }     
     17  ResetVector (ovec, OPIHI_FLT, ivec[0].Nelements);
     18  bzero (ovec[0].elements.Flt, sizeof(opihi_flt)*ovec[0].Nelements);
     19
     20  Vo = ovec[0].elements.Flt;
     21
     22  if (ivec[0].type == OPIHI_FLT) {
     23    opihi_flt *Vi = ivec[0].elements.Flt;
     24    *Vo = *Vi;
     25    for (i = 1; i < ivec[0].Nelements; i++, Vi++, Vo++) {
     26      *Vo = Vo[-1] + *Vi;
     27    }     
     28  } else {
     29    opihi_int *Vi = ivec[0].elements.Int;
     30    *Vo = *Vi;
     31    for (i = 1; i < ivec[0].Nelements; i++, Vi++, Vo++) {
     32      *Vo = Vo[-1] + *Vi;
     33    }     
     34  }
    2735  return (TRUE);
    2836}
Note: See TracChangeset for help on using the changeset viewer.