IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 4, 2007, 3:45:18 PM (19 years ago)
Author:
eugene
Message:

finishing up the basic code; almost compiles

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/dvo-mods-2007-02/Ohana/src/relastro/src/FitPM.c

    r12068 r12220  
    22
    33/* do we want an init function which does the alloc and a clear function to free? */
    4 int FitPM (PMFit *fit, double *X, double *dX, double *Y, double *dY, double *T, int Npts) {
     4int FitPM (PMFit *fit, double *X, double *dX, double *Y, double *dY, time_t *T, int Npts) {
     5
     6  int i;
    57
    68  double **A, **B;
     9  double wx, wy, Wx, Wy, Tx, Ty, Tx2, Ty2, Xs, Ys, XT, YT;
    710
    811  /* do I need to do this as 2 2x2 matrix equations? */
    9   ALLOCATE (A, double *, 4);
    10   ALLOCATE (B, double *, 4);
    11   for (i = 0; i < 4; i++) {
    12     ALLOCATE (A[i], double, 4);
    13     ALLOCATE (B[i], double, 1);
    14     bzero (A[i], 4*sizeof(double));
    15     bzero (B[i], 1*sizeof(double));
    16   }
     12  A = array_init (4, 4);
     13  B = array_init (4, 1);
    1714
     15  Wx = Wy = Tx = Ty = Tx2 = Ty2 = Xs = Ys = XT = YT = 0.0;
    1816  for (i = 0; i < Npts; i++) {
    1917    /* handle case where dX or dY = 0.0 */
     
    5654  dgaussj (A, 4, B, 1);
    5755
    58   fit[0].Ro = B[0];
    59   fit[0].uR = B[1];
    60   fit[0].Do = B[2];
    61   fit[0].uD = B[3];
     56  fit[0].Ro = B[0][0];
     57  fit[0].uR = B[1][0];
     58  fit[0].Do = B[2][0];
     59  fit[0].uD = B[3][0];
    6260  fit[0].p  = 0.0;
    6361 
     
    6866  fit[0].dp  = 0.0;
    6967 
    70   for (i = 0; i < 4; i++) {
    71     free (A[i]);
    72     free (B[i]);
    73   }
    74   free (A);
    75   free (B);
     68  array_free (A, 4);
     69  array_free (B, 4);
    7670
    7771  return (TRUE);
Note: See TracChangeset for help on using the changeset viewer.