IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 30, 2008, 11:13:15 AM (18 years ago)
Author:
eugene
Message:

allow functions to use FLT or INT vectors as appropriate; document valid types

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20081124/Ohana/src/opihi/cmd.data/gaussj.c

    r20839 r20859  
    44
    55  float *m;
    6   opihi_flt *v;
     6  opihi_flt *vf;
     7  opihi_int *vi;
    78  double **a, **b;
    89  int i, j, N, status, QUIET;
     
    3233  }
    3334
     35  isFloat = (B[0].type == OPIHI_FLT);
     36  vf = B[0].elements.Flt;
     37  vi = B[0].elements.Int;
     38
    3439  m = (float *) A[0].matrix.buffer;
    35   v = B[0].elements.Flt;
    3640  for (i = 0; i < N; i++) {
    3741    for (j = 0; j < N; j++) {
    3842      a[i][j] = m[i+j*N];
    3943    }
    40     b[i][0] = v[i];
     44    b[i][0] = isFloat ? vf[i] : vi[i];
    4145  }
    4246
    4347  status = dgaussjordan (a, b, N, 1);
     48
     49  // output vector needs to be float, so re-cast it
     50  ResetVector (B, OPIHI_FLT, N);
     51  vf = B[0].elements.Flt;
    4452
    4553  for (i = 0; i < N; i++) {
     
    4755       m[i+j*N] = a[i][j];
    4856    }
    49     v[i] = b[i][0];
     57    vf[i] = b[i][0];
    5058  }
    5159
Note: See TracChangeset for help on using the changeset viewer.