Changeset 40254
- Timestamp:
- Dec 7, 2017, 6:21:30 AM (9 years ago)
- Location:
- branches/eam_branches/ohana.20170822/src/opihi
- Files:
-
- 3 edited
-
cmd.data/print_vectors.c (modified) (2 diffs)
-
cmd.data/uniqpair.c (modified) (2 diffs)
-
lib.shell/VectorIO.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ohana.20170822/src/opihi/cmd.data/print_vectors.c
r40169 r40254 4 4 5 5 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 } 7 21 8 22 if (argc < 2) { … … 27 41 } 28 42 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++) { 30 52 for (i = 0; i < Nvec; i++) { 31 53 if (j >= vec[i][0].Nelements) { -
branches/eam_branches/ohana.20170822/src/opihi/cmd.data/uniqpair.c
r40174 r40254 55 55 56 56 // storage for the output and count vectors 57 int D_NOUT = 0.02*ID1vec->Nelements; 58 57 59 int Nout = 0; 58 int NOUT = 10000;60 int NOUT = D_NOUT; 59 61 ResetVector (OUTvec, OPIHI_INT, NOUT); 60 62 if (CNTvec) { … … 94 96 for (int i = 0; (i < ID1vec->Nelements) && !interrupt; Nout++) { 95 97 if (Nout >= NOUT) { 96 NOUT += 10000;98 NOUT += D_NOUT; 97 99 REALLOCATE (vtgt, opihi_int, NOUT); 98 100 if (CNTvec) { -
branches/eam_branches/ohana.20170822/src/opihi/lib.shell/VectorIO.c
r39457 r40254 41 41 for (j = 0; j < Nvec; j++) { 42 42 // 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 44 44 tformat[2*j + 1] = 0; 45 45 } … … 60 60 for (j = 0; j < Nvec; j++) { 61 61 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); 63 63 } 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); 65 66 } 66 67 } … … 328 329 ASSIGN_DATA(short, short, Int); 329 330 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 331 333 ASSIGN_DATA(float, float, Flt); 332 334 ASSIGN_DATA(double, double, Flt); … … 353 355 ASSIGN_DATA_TRANSPOSE(short, short, Int); 354 356 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 356 359 ASSIGN_DATA_TRANSPOSE(float, float, Flt); 357 360 ASSIGN_DATA_TRANSPOSE(double, double, Flt);
Note:
See TracChangeset
for help on using the changeset viewer.
