IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 40254


Ignore:
Timestamp:
Dec 7, 2017, 6:21:30 AM (9 years ago)
Author:
eugene
Message:

fixes for 64-bit int vectors

Location:
branches/eam_branches/ohana.20170822/src/opihi
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ohana.20170822/src/opihi/cmd.data/print_vectors.c

    r40169 r40254  
    44
    55  Vector **vec;
    6   int i, j;
     6  int i, j, N;
     7
     8  int START_VALUE = 0;
     9  if ((N = get_argument (argc, argv, "-s"))) {
     10    remove_argument (N, &argc, argv);
     11    START_VALUE = atoi (argv[N]);
     12    remove_argument (N, &argc, argv);
     13  }
     14
     15  int END_VALUE = -1;
     16  if ((N = get_argument (argc, argv, "-e"))) {
     17    remove_argument (N, &argc, argv);
     18    END_VALUE = atoi (argv[N]);
     19    remove_argument (N, &argc, argv);
     20  }
    721
    822  if (argc < 2) {
     
    2741  }
    2842
    29   for (j = 0; j < MaxLen; j++) {
     43  // start and end may be 0 - N (truncated to N) or may be negative, in which case it refers to
     44  // distance from the end (just like vector[-5])
     45  START_VALUE = (START_VALUE < 0) ? MaxLen + START_VALUE + 1 : MIN (START_VALUE, MaxLen);
     46  START_VALUE = MAX (0, START_VALUE);
     47
     48  END_VALUE = (END_VALUE < 0) ? MaxLen + END_VALUE + 1 : MIN (END_VALUE, MaxLen);
     49  END_VALUE = MAX (0, END_VALUE);
     50
     51  for (j = START_VALUE; j < END_VALUE; j++) {
    3052    for (i = 0; i < Nvec; i++) {
    3153      if (j >= vec[i][0].Nelements) {
  • branches/eam_branches/ohana.20170822/src/opihi/cmd.data/uniqpair.c

    r40174 r40254  
    5555
    5656  // storage for the output and count vectors
     57  int D_NOUT = 0.02*ID1vec->Nelements;
     58
    5759  int Nout = 0;
    58   int NOUT = 10000;
     60  int NOUT = D_NOUT;
    5961  ResetVector (OUTvec, OPIHI_INT, NOUT);
    6062  if (CNTvec) {
     
    9496  for (int i = 0; (i < ID1vec->Nelements) && !interrupt; Nout++) {
    9597    if (Nout >= NOUT) {
    96       NOUT += 10000;
     98      NOUT += D_NOUT;
    9799      REALLOCATE (vtgt, opihi_int, NOUT);
    98100      if (CNTvec) {
  • branches/eam_branches/ohana.20170822/src/opihi/lib.shell/VectorIO.c

    r39457 r40254  
    4141    for (j = 0; j < Nvec; j++) {
    4242      // if the format is not defined, just use the native byte-widths
    43       tformat[2*j + 0] = (vec[j][0].type == OPIHI_FLT) ? 'D' : 'J';
     43      tformat[2*j + 0] = (vec[j][0].type == OPIHI_FLT) ? 'D' : 'K'; // this depends on opihi_int == int64_t for Int
    4444      tformat[2*j + 1] = 0;
    4545    }
     
    6060  for (j = 0; j < Nvec; j++) {
    6161    if (vec[j][0].type == OPIHI_FLT) {
    62       gfits_set_bintable_column_reformat (theader, ftable, vec[j][0].name, "double", vec[j][0].elements.Flt, vec[j][0].Nelements, nativeOrder);
     62      gfits_set_bintable_column_reformat (theader, ftable, vec[j][0].name, "double",  vec[j][0].elements.Flt, vec[j][0].Nelements, nativeOrder);
    6363    } else {
    64       gfits_set_bintable_column_reformat (theader, ftable, vec[j][0].name, "int", vec[j][0].elements.Int, vec[j][0].Nelements, nativeOrder);
     64//    gfits_set_bintable_column_reformat (theader, ftable, vec[j][0].name, "int",     vec[j][0].elements.Int, vec[j][0].Nelements, nativeOrder);
     65      gfits_set_bintable_column_reformat (theader, ftable, vec[j][0].name, "int64_t", vec[j][0].elements.Int, vec[j][0].Nelements, nativeOrder);
    6566    }
    6667  }
     
    328329  ASSIGN_DATA(short,   short,   Int);
    329330  ASSIGN_DATA(int,     int,     Int);
    330   ASSIGN_DATA(int64_t, int64_t, Flt); // int64_t has a problem: Int is too small, Flt is wrong precision
     331  ASSIGN_DATA(int64_t, int64_t, Int); // XXX this works if opihi_int is assigned to int64_t
     332//ASSIGN_DATA(int64_t, int64_t, Flt); // int64_t has a problem: Int is too small, Flt is wrong precision
    331333  ASSIGN_DATA(float,   float,   Flt);
    332334  ASSIGN_DATA(double,  double,  Flt);
     
    353355  ASSIGN_DATA_TRANSPOSE(short,   short,   Int);
    354356  ASSIGN_DATA_TRANSPOSE(int,     int,     Int);
    355   ASSIGN_DATA_TRANSPOSE(int64_t, int64_t, Flt);
     357  ASSIGN_DATA_TRANSPOSE(int64_t, int64_t, Int);
     358//ASSIGN_DATA_TRANSPOSE(int64_t, int64_t, Flt); // see above comment
    356359  ASSIGN_DATA_TRANSPOSE(float,   float,   Flt);
    357360  ASSIGN_DATA_TRANSPOSE(double,  double,  Flt);
Note: See TracChangeset for help on using the changeset viewer.