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/applyfit.c

    r16428 r20936  
    11# include "data.h"
    2 
    3 char *get_variable (char *);
    42
    53int applyfit (int argc, char **argv) {
     
    86  char *c, name[64];
    97  double *C, X;
    10   float *x, *y;
     8  opihi_flt *y;
    119  Vector *xvec, *yvec;
    1210
     
    3836    free (c);
    3937  }
    40   yvec[0].Nelements = xvec[0].Nelements;
    41   REALLOCATE (yvec[0].elements, float, yvec[0].Nelements);
    42   bzero (yvec[0].elements, sizeof(float)*yvec[0].Nelements);
    43   x = xvec[0].elements;
    44   y = yvec[0].elements;
    4538
    46   for (j = 0; j < xvec[0].Nelements; j++, x++, y++) {
    47     X = 1;
    48     for (i = 0; i < order + 1; i++) {
    49       *y += C[i]*X;
    50       X = X * (*x);
     39  ResetVector (yvec, OPIHI_FLT, xvec[0].Nelements);
     40  bzero (yvec[0].elements.Flt, sizeof(opihi_flt)*yvec[0].Nelements);
     41  y = yvec[0].elements.Flt;
     42
     43  if (xvec[0].type == OPIHI_FLT) {
     44    opihi_flt *x = xvec[0].elements.Flt;
     45    for (j = 0; j < xvec[0].Nelements; j++, x++, y++) {
     46      X = 1;
     47      for (i = 0; i < order + 1; i++) {
     48        *y += C[i]*X;
     49        X = X * (*x);
     50      }
     51    }
     52  } else {
     53    opihi_int *x = xvec[0].elements.Int;
     54    for (j = 0; j < xvec[0].Nelements; j++, x++, y++) {
     55      X = 1;
     56      for (i = 0; i < order + 1; i++) {
     57        *y += C[i]*X;
     58        X = X * (*x);
     59      }
    5160    }
    5261  }
Note: See TracChangeset for help on using the changeset viewer.