Changeset 38443
- Timestamp:
- Jun 12, 2015, 9:26:15 PM (11 years ago)
- Location:
- branches/eam_branches/ipp-20150419/Ohana/src/opihi
- Files:
-
- 46 edited
- 1 copied
-
. (modified) (1 prop)
-
cmd.data (modified) (1 prop)
-
cmd.data/Makefile (modified) (1 diff)
-
cmd.data/cast.c (modified) (4 diffs)
-
cmd.data/init.c (modified) (2 diffs)
-
cmd.data/mslice.c (copied) (copied from trunk/Ohana/src/opihi/cmd.data/mslice.c )
-
cmd.data/rd.c (modified) (6 diffs)
-
cmd.data/read_vectors.c (modified) (11 diffs)
-
cmd.data/tv.c (modified) (1 diff)
-
cmd.data/vstats.c (modified) (1 diff)
-
cmd.data/wd.c (modified) (7 diffs)
-
cmd.data/write_vectors.c (modified) (5 diffs)
-
dvo/avextract.c (modified) (2 diffs)
-
dvo/avmatch.c (modified) (3 diffs)
-
dvo/calextract.c (modified) (1 diff)
-
dvo/calmextract.c (modified) (1 diff)
-
dvo/catalog.c (modified) (1 diff)
-
dvo/ccd.c (modified) (1 diff)
-
dvo/cmatch.c (modified) (1 diff)
-
dvo/cmd.c (modified) (1 diff)
-
dvo/cmpReadFile.c (modified) (1 diff)
-
dvo/ddmags.c (modified) (1 diff)
-
dvo/dmagaves.c (modified) (1 diff)
-
dvo/dmagmeas.c (modified) (1 diff)
-
dvo/dmags.c (modified) (1 diff)
-
dvo/dmt.c (modified) (1 diff)
-
dvo/dvo_host_utils.c (modified) (1 diff)
-
dvo/extract.c (modified) (1 diff)
-
dvo/fitcolors.c (modified) (1 diff)
-
dvo/fitsed.c (modified) (1 diff)
-
dvo/gstar.c (modified) (1 diff)
-
dvo/imdata.c (modified) (1 diff)
-
dvo/lcurve.c (modified) (1 diff)
-
dvo/lightcurve.c (modified) (1 diff)
-
dvo/mextract.c (modified) (4 diffs)
-
dvo/mmatch.c (modified) (3 diffs)
-
dvo/mmextract.c (modified) (1 diff)
-
dvo/objectcoverage.c (modified) (1 diff)
-
dvo/paverage.c (modified) (1 diff)
-
dvo/pmeasure.c (modified) (1 diff)
-
dvo/subpix.c (modified) (1 diff)
-
include/dvomath.h (modified) (1 diff)
-
lib.data/SplineOps.c (modified) (1 diff)
-
lib.shell/VectorIO.c (modified) (9 diffs)
-
lib.shell/convert_to_RPN.c (modified) (1 diff)
-
lib.shell/evaluate_stack.c (modified) (2 diffs)
-
lib.shell/stack_math.c (modified) (24 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20150419/Ohana/src/opihi
-
Property svn:mergeinfo
set to
/branches/eam_branches/ipp-20150112/Ohana/src/opihi merged eligible /branches/eam_branches/ipp-20150405/Ohana/src/opihi merged eligible /trunk/Ohana/src/opihi merged eligible
-
Property svn:mergeinfo
set to
-
branches/eam_branches/ipp-20150419/Ohana/src/opihi/cmd.data
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20150419/Ohana/src/opihi/cmd.data/Makefile
r38282 r38443 92 92 $(SRC)/mget.$(ARCH).o \ 93 93 $(SRC)/mget3d.$(ARCH).o \ 94 $(SRC)/mslice.$(ARCH).o \ 94 95 $(SRC)/minterpolate.$(ARCH).o \ 95 96 $(SRC)/medimage.$(ARCH).o \ -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/cmd.data/cast.c
r36489 r38443 17 17 // out type 18 18 char outType = OPIHI_NOTYPE; 19 if (!strcasecmp(argv[5], "int")) outType = OPIHI_INT; 20 if (!strcasecmp(argv[5], "float")) outType = OPIHI_FLT; 19 if (!strcasecmp(argv[5], "int")) outType = OPIHI_INT; 20 if (!strcasecmp(argv[5], "float")) outType = OPIHI_FLT; 21 if (!strcasecmp(argv[5], "single")) outType = OPIHI_FLT; 22 if (!strcasecmp(argv[5], "int64")) outType = OPIHI_FLT; 21 23 if (outType == OPIHI_NOTYPE) goto usage; 24 25 int ForceSingle = FALSE; 26 if (!strcasecmp(argv[5], "single")) ForceSingle = TRUE; 27 28 int ForceI64 = FALSE; 29 if (!strcasecmp(argv[5], "int64")) ForceI64 = TRUE; 22 30 23 31 if ((ovec = SelectVector (argv[1], ANYVECTOR, TRUE)) == NULL) goto error; … … 32 40 opihi_flt *vo = ovec[0].elements.Flt; 33 41 for (i = 0; i < ovec[0].Nelements; i++, vi++, vo++) { 34 *vo = *vi; 42 if (ForceSingle) { 43 float tmp = *vi; 44 *vo = tmp; 45 } else if (ForceI64) { 46 int64_t tmp = *vi; 47 *vo = tmp; 48 } else { 49 *vo = *vi; 50 } 35 51 } 36 52 return (TRUE); … … 48 64 opihi_flt *vo = ovec[0].elements.Flt; 49 65 for (i = 0; i < ovec[0].Nelements; i++, vi++, vo++) { 50 *vo = *vi; 66 if (ForceSingle) { 67 float tmp = *vi; 68 *vo = tmp; 69 } else { 70 *vo = *vi; 71 } 51 72 } 52 73 return (TRUE); … … 66 87 67 88 usage: 68 gprint (GP_ERR, "SYNTAX: cast vec = vec as (int/float)\n"); 89 gprint (GP_ERR, "SYNTAX: cast vec = vec as (int/float/single)\n"); 90 gprint (GP_ERR, " note: (single) forces vector to have single precision\n"); 69 91 return (FALSE); 70 92 } -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/cmd.data/init.c
r38282 r38443 82 82 int mget PROTO((int, char **)); 83 83 int mget3d PROTO((int, char **)); 84 int mslice PROTO((int, char **)); 84 85 int minterp PROTO((int, char **)); 85 86 int medimage_command PROTO((int, char **)); … … 250 251 {1, "mget", mget, "extract a vector from an image"}, 251 252 {1, "mget3d", mget3d, "extract a vector from a 3D image"}, 253 {1, "mslice", mslice, "extract an image plane from a 3D image"}, 252 254 {1, "imget", mget, "extract a vector from an image"}, 253 255 {1, "minterp", minterp, "interpolate image pixels"}, -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/cmd.data/rd.c
r38062 r38443 9 9 Buffer *buf; 10 10 11 int VERBOSE = FALSE; 12 if ((N = get_argument (argc, argv, "-v"))) { 13 remove_argument (N, &argc, argv); 14 VERBOSE = TRUE; 15 } 16 11 17 int JustHead = FALSE; 12 18 if ((N = get_argument (argc, argv, "-head"))) { 13 19 remove_argument (N, &argc, argv); 14 20 JustHead = TRUE; 21 } 22 23 int SwapRaw = FALSE; 24 if ((N = get_argument (argc, argv, "-swap-raw"))) { 25 remove_argument (N, &argc, argv); 26 SwapRaw = TRUE; 15 27 } 16 28 … … 85 97 return (FALSE); 86 98 } 87 if (gfits_extension_is_compressed (&buf[0].header)) {99 if (gfits_extension_is_compressed_image (&buf[0].header)) { 88 100 IsCompressed = TRUE; 89 101 } … … 118 130 Nword = 1; 119 131 IsCompressed = FALSE; 120 if (gfits_extension_is_compressed (&buf[0].header)) {132 if (gfits_extension_is_compressed_image (&buf[0].header)) { 121 133 if (!strcmp (CCDKeyword, "EXTNAME")) Nword = 1; 122 134 IsCompressed = TRUE; … … 170 182 if (plane >= 0) { 171 183 // we are requesting a specific plane (-1 : all data) 172 int tooFar = Nz ? (plane >= Nz) : (plane > Nz);184 int tooFar = (Nz > 0) ? (plane >= Nz) : (plane > 0); 173 185 if (tooFar) { 174 186 gprint (GP_ERR, "-plane is too large: %d total planes\n", Nz); … … 192 204 ftable.header[0].buffer = NULL; 193 205 gfits_copy_header (&buf[0].header, ftable.header); 194 status = gfits_fread_ftable_data (f, &ftable, FALSE); // this just reads the bytes (not even a SWAP) 195 status = gfits_uncompress_image (&buf[0].header, &buf[0].matrix, &ftable); 206 207 if (!gfits_fread_ftable_data (f, &ftable, FALSE)) { gprint (GP_ERR, "problem reading compressed image table data\n"); fclose (f); return FALSE; } 208 if (!gfits_byteswap_varlength_column (&ftable, 1)) { gprint (GP_ERR, "problem doing byteswap on compressed image metadata column\n"); fclose (f); gfits_free_table (&ftable); return FALSE; } 209 if (!gfits_uncompress_image (&buf[0].header, &buf[0].matrix, &ftable)) { gprint (GP_ERR, "problem uncompressing the image data\n"); fclose (f); gfits_free_table (&ftable); return FALSE; } 210 196 211 // uncompressing the image leaves the format as an extension 197 212 gfits_extended_to_primary (&buf[0].header, TRUE, "Standard FITS"); 198 213 gfits_free_table (&ftable); 214 215 status = TRUE; 199 216 // XXX this currently does not work for a cube (we get a cube back, not a specific plane) 200 217 } else { … … 233 250 buf[0].unsign = buf[0].header.unsign; 234 251 235 gprint (GP_LOG, "read "OFF_T_FMT" bytes from %s into buffer %s\n", 236 buf[0].header.datasize + buf[0].matrix.datasize, argv[2], argv[1]); 252 if (VERBOSE) gprint (GP_LOG, "read "OFF_T_FMT" bytes from %s into buffer %s\n", buf[0].header.datasize + buf[0].matrix.datasize, argv[2], argv[1]); 237 253 238 254 blank = 0xffff; 239 255 gfits_scan (&buf[0].header, "BLANK", "%d", 1, &blank); 240 256 257 if (SwapRaw) { 258 gfits_swap_raw (&buf[0].matrix); 259 } 260 241 261 /** now - convert the matrix values to floats for internal use **/ 242 262 gfits_convert_format (&buf[0].header, &buf[0].matrix, -32, 1.0, 0.0, blank, gfits_get_unsign_mode()); -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/cmd.data/read_vectors.c
r38062 r38443 1 1 # include "data.h" 2 int dump_raw_table (FTable *table, char *message); 3 int dump_cmp_table (FTable *table, char *message); 2 4 3 5 FILE *f = (FILE *) NULL; … … 412 414 table.header = &header; 413 415 414 /* load appropriate extension (if extname is a number, use count)*/416 /**** find the appropriate extension and read header (if extname is a number, use count) ****/ 415 417 if (Nextend > -1) { 416 418 // first extension is PHU, cannot be a table. … … 429 431 } 430 432 if (!gfits_load_header (f, &header)) ESCAPE ("error reading header for extension %d\n", Nextend); 431 432 if (getSizes) {433 read_table_sizes (&header);434 if (CCDKeyword != NULL) free (CCDKeyword);435 gfits_free_header (&header);436 return TRUE;437 }438 439 if (Nrows == -1) {440 Nrows = header.Naxis[1] - start;441 }442 if (start < 0) ESCAPE ("invalid range: start < 0\n");443 if (start >= header.Naxis[1]) ESCAPE ("invalid range: start >= Ny (%d)\n", header.Naxis[1]);444 if (Nrows < 0) ESCAPE ("invalid range: Nrows < 0\n");445 446 // just a warning:447 if (start + Nrows > header.Naxis[1]) {448 if (VERBOSE) gprint (GP_ERR, "NOTE: reading last block will return only %d rows\n", header.Naxis[1] - start);449 }450 451 // Ny = 100, start = 0, Nrows = -1 -> Nrows => 100452 // Ny = 100, start = 10, Nrows = 90453 454 if (!gfits_fread_ftable_range (f, padIfShort, &table, start, Nrows)) ESCAPE ("error reading table for extension %d\n", Nextend);455 433 } else { 456 434 if (CCDKeyword == NULL) { … … 460 438 CCDKeyword = strcreate ("EXTNAME"); 461 439 } 462 463 440 while (1) { 464 441 if (!gfits_load_header (f, &header)) { … … 469 446 return (TRUE); 470 447 } 471 472 448 Nbytes = gfits_data_size (&header); 473 449 … … 482 458 continue; 483 459 } 484 485 if (getSizes) {486 read_table_sizes (&header);487 if (CCDKeyword != NULL) free (CCDKeyword);488 gfits_free_header (&header);489 return TRUE;490 }491 492 if (Nrows == -1) {493 Nrows = header.Naxis[1] - start;494 }495 if (start < 0) ESCAPE ("invalid range: start < 0\n");496 if (start >= header.Naxis[1]) ESCAPE ("invalid range: start >= Ny (%d)\n", header.Naxis[1]);497 if (Nrows < 0) ESCAPE ("invalid range: Nrows < 0\n");498 499 // just a warning:500 if (start + Nrows > header.Naxis[1]) {501 if (VERBOSE) gprint (GP_ERR, "NOTE: reading last block will return only %d rows\n", header.Naxis[1] - start);502 }503 504 if (!gfits_fread_ftable_range (f, padIfShort, &table, start, Nrows)) ESCAPE ("error reading table for extension %d\n", Nextend);505 506 // if (!gfits_fread_ftable_data (f, &table, padIfShort)) ESCAPE ("error reading table for extension\n");507 508 460 break; 509 461 } 462 } 463 464 int IsCompressed = gfits_extension_is_compressed_table (&header); 465 466 if (getSizes && !IsCompressed) { 467 read_table_sizes (&header); 468 if (CCDKeyword != NULL) free (CCDKeyword); 469 gfits_free_header (&header); 470 return TRUE; 471 } 472 if (IsCompressed) { 473 if (getSizes) { 474 gprint (GP_ERR, "%s[%s] is compressed: -sizes is invalid\n", filename, extname); 475 gfits_free_header (&header); 476 return FALSE; 477 } 478 if ((start > 0) || (Nrows > -1)) { 479 gprint (GP_ERR, "%s[%s] is compressed: must read entire table\n", filename, extname); 480 gfits_free_header (&header); 481 return FALSE; 482 } 483 } 484 485 if (Nrows == -1) { 486 Nrows = header.Naxis[1] - start; 487 } 488 if (start < 0) ESCAPE ("invalid range: start < 0\n"); 489 if (start >= header.Naxis[1]) ESCAPE ("invalid range: start >= Ny ("OFF_T_FMT")\n", header.Naxis[1]); 490 if (Nrows < 0) ESCAPE ("invalid range: Nrows < 0\n"); 491 492 // just a warning: 493 if (start + Nrows > header.Naxis[1]) { 494 if (VERBOSE) gprint (GP_ERR, "NOTE: reading last block will return only "OFF_T_FMT" rows\n", header.Naxis[1] - start); 495 } 496 497 // Ny = 100, start = 0, Nrows = -1 -> Nrows => 100 498 // Ny = 100, start = 10, Nrows = 90 499 500 if (IsCompressed) { 501 if (!gfits_fread_ftable_data (f, &table, padIfShort)) ESCAPE ("error reading table for extension %d\n", Nextend); 502 } else { 503 if (!gfits_fread_ftable_range (f, padIfShort, &table, start, Nrows)) ESCAPE ("error reading table for extension %d\n", Nextend); 510 504 } 511 505 … … 518 512 Binary = !strcmp (type, "BINTABLE"); 519 513 Ny = header.Naxis[1]; 514 515 Header *outheader = &header; 516 FTable *outtable = &table; 517 518 Header rawheader; 519 FTable rawtable; 520 if (IsCompressed) { 521 rawtable.header = &rawheader; 522 523 dump_cmp_table (&table, "rd cmp"); 524 525 int Nfields; 526 if (!gfits_scan (&header, "TFIELDS", "%d", 1, &Nfields)) ESCAPE ("cannot find TFIELDS in header\n"); 527 for (i = 0; i < Nfields; i++) { 528 gfits_byteswap_varlength_column (&table, i+1); 529 } 530 if (!gfits_uncompress_table (&table, &rawtable)) ESCAPE ("failed to uncompress table\n"); 531 dump_raw_table (&rawtable, "rd raw"); 532 533 outheader = &rawheader; 534 outtable = &rawtable; 535 gfits_free_header (&header); 536 gfits_free_table (&table); 537 Ny = rawheader.Naxis[1]; 538 } 520 539 521 540 /* find columns which match requested vectors */ … … 527 546 Nval = 0; 528 547 if (Binary) { 529 if (!gfits_get_bintable_column_type ( &header, argv[i], type, &Nval)) ESCAPE ("requested field not found");530 if (!gfits_get_bintable_column (&header, &table, argv[i], &data)) ESCAPE ("error reading data from specified field");548 if (!gfits_get_bintable_column_type (outheader, argv[i], type, &Nval)) ESCAPE ("requested field not found\n"); 549 if (!gfits_get_bintable_column_raw (outheader, outtable, argv[i], &data, IsCompressed)) ESCAPE ("error reading data from specified field\n"); 531 550 } else { 532 if (!gfits_get_table_column_type ( &header, argv[i], type)) ESCAPE ("requested field not found");533 if (!gfits_get_table_column ( &header, &table, argv[i], &data)) ESCAPE ("error reading data from specified field");534 } 535 if (Nval == 0) ESCAPE ("no data for field in table ");551 if (!gfits_get_table_column_type (outheader, argv[i], type)) ESCAPE ("requested field not found\n"); 552 if (!gfits_get_table_column (outheader, outtable, argv[i], &data)) ESCAPE ("error reading data from specified field\n"); 553 } 554 if (Nval == 0) ESCAPE ("no data for field in table\n"); 536 555 537 556 vecType = OPIHI_INT; 538 if (!strcmp (type, "double") || !strcmp (type, "float") ) {557 if (!strcmp (type, "double") || !strcmp (type, "float") || !strcmp (type, "int64_t")) { 539 558 vecType = OPIHI_FLT; 540 559 } … … 570 589 else 571 590 sprintf (name, "%s:%d", argv[i], j); 572 if ((vec[j] = SelectVector (name, ANYVECTOR, TRUE)) == NULL) ESCAPE ("bad vector name ");591 if ((vec[j] = SelectVector (name, ANYVECTOR, TRUE)) == NULL) ESCAPE ("bad vector name\n"); 573 592 ResetVector (vec[j], vecType, Ny); 574 593 } 575 594 576 if (!VectorAssignData (vec, type, data, Ny, Nval)) ESCAPE ("bad column type %s ", type);595 if (!VectorAssignData (vec, type, data, Ny, Nval)) ESCAPE ("bad column type %s\n", type); 577 596 578 597 } else { … … 584 603 else 585 604 sprintf (name, "%s:%d", argv[i], j); 586 if ((vec[j] = SelectVector (name, ANYVECTOR, TRUE)) == NULL) ESCAPE ("bad vector name ");605 if ((vec[j] = SelectVector (name, ANYVECTOR, TRUE)) == NULL) ESCAPE ("bad vector name\n"); 587 606 ResetVector (vec[j], vecType, Nval); 588 607 } 589 608 590 if (!VectorAssignDataTranspose (vec, type, data, Ny, Nval)) ESCAPE ("bad column type %s ", type);609 if (!VectorAssignDataTranspose (vec, type, data, Ny, Nval)) ESCAPE ("bad column type %s\n", type); 591 610 } 592 611 free (data); … … 594 613 } 595 614 if (CCDKeyword != NULL) free (CCDKeyword); 596 gfits_free_table ( &table);597 gfits_free_header ( &header);615 gfits_free_table (outtable); 616 gfits_free_header (outheader); 598 617 return (TRUE); 599 618 } -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/cmd.data/tv.c
r38062 r38443 71 71 int tooBig = buf[0].matrix.Naxis[2] ? (plane >= buf[0].matrix.Naxis[2]) : plane > 0; 72 72 if (tooBig) { 73 gprint (GP_ERR, " ERROR: -plane (plane) : out of bounds (%d vs %d)\n", plane, buf[0].matrix.Naxis[2]);73 gprint (GP_ERR, " ERROR: -plane (plane) : out of bounds (%d vs "OFF_T_FMT")\n", plane, buf[0].matrix.Naxis[2]); 74 74 return (FALSE); 75 75 } -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/cmd.data/vstats.c
r35109 r38443 121 121 goto skip; 122 122 } 123 // we can hit inf if pmax and pmin are close to the max range 124 if (isinf(dx)) dx = DBL_MAX / Nbin; 123 125 124 126 ALLOCATE (Nval, int, Nbin + 2); -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/cmd.data/wd.c
r38062 r38443 18 18 } 19 19 20 char *CompressMode = NULL; 21 if ((N = get_argument (argc, argv, "-compress-mode"))) { 22 remove_argument (N, &argc, argv); 23 CompressMode = strcreate(argv[N]); 24 remove_argument (N, &argc, argv); 25 } else if ((N = get_argument (argc, argv, "-compress"))) { 26 remove_argument (N, &argc, argv); 27 CompressMode = strcreate("GZIP_1"); 28 } 29 20 30 outZero = 0; 21 31 newZero = FALSE; … … 54 64 if (outUnsign == -1) { 55 65 gprint (GP_ERR, "-unsign options: t, f, true, false\n"); 66 FREE (CompressMode); 56 67 return (FALSE); 57 68 } … … 62 73 if (argc != 3) { 63 74 gprint (GP_ERR, "USAGE: wd <buffer> <filename> [-bitpix N] [-bscale X] [-bzero X] [-extend] [-newplane]\n"); 75 FREE (CompressMode); 64 76 return (FALSE); 65 77 } 66 78 67 if ((buf = SelectBuffer (argv[1], OLDBUFFER, TRUE)) == NULL) return (FALSE);79 if ((buf = SelectBuffer (argv[1], OLDBUFFER, TRUE)) == NULL) { FREE (CompressMode); return (FALSE); } 68 80 69 81 if (!newBitpix) outBitpix = buf[0].bitpix; … … 159 171 gfits_free_header (&temp_header); 160 172 gfits_free_matrix (&temp_matrix); 173 FREE (CompressMode); 161 174 return (status); 162 175 } 163 176 177 // not compatible with extend 178 if (CompressMode) { 179 Header myHeader; 180 Matrix myMatrix; 181 182 FILE *f = fopen (argv[2], "w"); 183 if (!f) { 184 fprintf (stderr, "ERROR: cannot open image subset file for output %s\n", argv[2]); 185 FREE (CompressMode); 186 return FALSE; 187 } 188 189 gfits_init_header (&myHeader); 190 myHeader.extend = TRUE; 191 gfits_create_header (&myHeader); 192 gfits_create_matrix (&myHeader, &myMatrix); 193 gfits_fwrite_header (f, &myHeader); 194 gfits_fwrite_matrix (f, &myMatrix); 195 gfits_free_header (&myHeader); 196 gfits_free_matrix (&myMatrix); 197 198 FTable ftable; 199 Header theader; 200 201 ftable.header = &theader; 202 203 gfits_compress_image (&temp_header, &temp_matrix, &ftable, NULL, CompressMode); 204 gfits_byteswap_varlength_column (&ftable, 1); 205 gfits_fwrite_Theader (f, &theader); 206 gfits_fwrite_table (f, &ftable); 207 fclose (f); 208 209 gfits_free_header (&theader); 210 gfits_free_table (&ftable); 211 FREE (CompressMode); 212 return (TRUE); 213 } 214 164 215 /* the actual write-to-disk goes here */ 165 216 if (!gfits_write_header (argv[2], &temp_header)) { … … 167 218 gfits_free_header (&temp_header); 168 219 gfits_free_matrix (&temp_matrix); 220 FREE (CompressMode); 169 221 return (FALSE); 170 222 } … … 174 226 gfits_free_header (&temp_header); 175 227 gfits_free_matrix (&temp_matrix); 228 FREE (CompressMode); 176 229 return (FALSE); 177 230 } … … 180 233 gfits_free_matrix (&temp_matrix); 181 234 235 FREE (CompressMode); 182 236 return (TRUE); 183 237 } -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/cmd.data/write_vectors.c
r35109 r38443 3 3 int write_vectors (int argc, char **argv) { 4 4 5 int append;6 5 int i, j, Nvec, Ne, N; 7 6 FILE *f; 8 7 char **fmtlist, *fmttype; 9 char *p0, *p1, *p2, *format , *FITS;8 char *p0, *p1, *p2, *format; 10 9 Vector **vec; 11 10 … … 34 33 35 34 /* option generate a FITS output table */ 36 FITS = NULL;35 char *FITS = NULL; 37 36 if ((N = get_argument (argc, argv, "-fits"))) { 38 37 remove_argument (N, &argc, argv); … … 58 57 } 59 58 60 append = FALSE;59 int append = FALSE; 61 60 if ((N = get_argument (argc, argv, "-append"))) { 62 61 remove_argument (N, &argc, argv); 63 62 append = TRUE; 63 } 64 65 char *compress = NULL; 66 if ((N = get_argument (argc, argv, "-compress-mode"))) { 67 remove_argument (N, &argc, argv); 68 compress = strcreate(argv[N]); 69 remove_argument (N, &argc, argv); 70 } else if ((N = get_argument (argc, argv, "-compress"))) { 71 remove_argument (N, &argc, argv); 72 compress = strcreate("GZIP_1"); 73 if (!FITS) { 74 fprintf (stderr, "NOTE: write_vectors -compress has no effect on non-FITS\n"); 75 } 64 76 } 65 77 … … 105 117 106 118 if (FITS) { 107 int status = WriteVectorTableFITS (argv[1], FITS, vec, Nvec, append, format);119 int status = WriteVectorTableFITS (argv[1], FITS, vec, Nvec, append, compress, format); 108 120 free (vec); 109 121 return status; … … 243 255 gprint (GP_ERR, " -csv : write a comma-separated values file (eg, to read in excel)\n"); 244 256 gprint (GP_ERR, " -f \"format\" : provide formatting codes for output:\n"); 245 gprint (GP_ERR, " ascii / csv : format consists of c-style format codes in form % NN.Md\n");257 gprint (GP_ERR, " ascii / csv : format consists of c-style format codes in form %%NN.Md\n"); 246 258 gprint (GP_ERR, ", the following codes are allowed\n"); 247 gprint (GP_ERR, " % e -- double,%f -- float\n");248 gprint (GP_ERR, " % d -- int, %c -- char,%x -- hex int\n");259 gprint (GP_ERR, " %%e -- double, %%f -- float\n"); 260 gprint (GP_ERR, " %%d -- int, %%c -- char, %%x -- hex int\n"); 249 261 gprint (GP_ERR, " FITS : format consists of the following FITS binary table format codes:\n"); 250 262 gprint (GP_ERR, " B : 1 byte int\n"); -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/avextract.c
r38062 r38443 185 185 snprintf (hostfile, 1024, "%s/%s.cpt", HOSTDIR, skylist[0].regions[i]->name); 186 186 catalog.filename = (HOST_ID || PARALLEL_LOCAL) ? hostfile : skylist[0].filename[i]; 187 catalog.catflags = LOAD_AVES | LOAD_SECF;188 catalog.catflags |= needMeasure ? LOAD_MEAS : SKIP_MEAS;189 catalog.catflags |= needLensobj ? LOAD_LENSOBJ :SKIP_LENSOBJ;190 catalog.catflags |= needStarpar ? LOAD_STARPAR :SKIP_STARPAR;187 catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_SECFILT; 188 catalog.catflags |= needMeasure ? DVO_LOAD_MEASURE : DVO_SKIP_MEASURE; 189 catalog.catflags |= needLensobj ? DVO_LOAD_LENSOBJ : DVO_SKIP_LENSOBJ; 190 catalog.catflags |= needStarpar ? DVO_LOAD_STARPAR : DVO_SKIP_STARPAR; 191 191 catalog.Nsecfilt = 0; 192 192 … … 256 256 // write vectors to a table (this is used by parallel dvo operations, but can be used elsewhere) 257 257 if (RESULT_FILE && !SKIP_RESULTS) { 258 int status = WriteVectorTableFITS (RESULT_FILE, "RESULT", vec, Nreturn, FALSE, NULL);258 int status = WriteVectorTableFITS (RESULT_FILE, "RESULT", vec, Nreturn, FALSE, FALSE, NULL); 259 259 if (!status) { 260 260 goto escape; -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/avmatch.c
r37807 r38443 115 115 116 116 CoordsFile = abspath("coords.fits", 1024); 117 int status = WriteVectorTableFITS (CoordsFile, "COORDS", vec, 2, FALSE, NULL);117 int status = WriteVectorTableFITS (CoordsFile, "COORDS", vec, 2, FALSE, FALSE, NULL); 118 118 if (!status) goto escape; 119 119 } … … 190 190 snprintf (hostfile, 1024, "%s/%s.cpt", HOSTDIR, skylist[0].regions[i]->name); 191 191 catalog.filename = HOST_ID ? hostfile : skylist[0].filename[i]; 192 catalog.catflags = LOAD_AVES | LOAD_SECF;193 catalog.catflags |= needMeasure ? LOAD_MEAS : SKIP_MEAS;194 catalog.catflags |= needLensobj ? LOAD_LENSOBJ :SKIP_LENSOBJ;195 catalog.catflags |= needStarpar ? LOAD_STARPAR :SKIP_STARPAR;192 catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_SECFILT; 193 catalog.catflags |= needMeasure ? DVO_LOAD_MEASURE : DVO_SKIP_MEASURE; 194 catalog.catflags |= needLensobj ? DVO_LOAD_LENSOBJ : DVO_SKIP_LENSOBJ; 195 catalog.catflags |= needStarpar ? DVO_LOAD_STARPAR : DVO_SKIP_STARPAR; 196 196 catalog.Nsecfilt = 0; 197 197 … … 302 302 vec[i][0].Nelements = Nfound; 303 303 } 304 int status = WriteVectorTableFITS (RESULT_FILE, "RESULT", vec, Nfields + 1, FALSE, NULL);304 int status = WriteVectorTableFITS (RESULT_FILE, "RESULT", vec, Nfields + 1, FALSE, FALSE, NULL); 305 305 free (vec[Nfields]->elements.Int); 306 306 free (vec[Nfields]); -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/calextract.c
r34088 r38443 61 61 /* lock, load, unlock catalog */ 62 62 catalog.filename = skylist[0].filename[Nr]; 63 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_SECF;63 catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_SECFILT; 64 64 catalog.Nsecfilt = 0; 65 65 -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/calmextract.c
r34088 r38443 74 74 /* lock, load, unlock catalog */ 75 75 catalog.filename = skylist[0].filename[Nr]; 76 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_SECF;76 catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_SECFILT; 77 77 catalog.Nsecfilt = 0; 78 78 -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/catalog.c
r19823 r38443 315 315 /* lock, load, unlock catalog */ 316 316 catalog.filename = filename; 317 catalog.catflags = LOAD_AVES;317 catalog.catflags = DVO_LOAD_AVERAGE; 318 318 319 319 // an error exit status here is a significant error -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/ccd.c
r34088 r38443 69 69 /* lock, load, unlock catalog */ 70 70 catalog.filename = skylist[0].filename[k]; 71 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_SECF;71 catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_SECFILT; 72 72 catalog.Nsecfilt = 0; 73 73 -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/cmatch.c
r28241 r38443 29 29 /* load data from the photometry database file */ 30 30 catalog1.filename = filename; 31 catalog1.catflags = LOAD_AVES | LOAD_MEAS | LOAD_SECF;31 catalog1.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_SECFILT; 32 32 33 33 // an error exit status here is a significant error -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/cmd.c
r34088 r38443 68 68 /* lock, load, unlock catalog */ 69 69 catalog.filename = skylist[0].filename[j]; 70 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_SECF;70 catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_SECFILT; 71 71 catalog.Nsecfilt = 0; 72 72 -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/cmpReadFile.c
r29001 r38443 19 19 if (!gfits_fread_ftable (f, &table, "SMPFILE")) goto escape; 20 20 21 smpdata = gfits_table_get_SMPData (&table, &Nstars, NULL );21 smpdata = gfits_table_get_SMPData (&table, &Nstars, NULL, NULL); 22 22 if (!smpdata) { 23 23 fprintf (stderr, "ERROR: failed to read stars\n"); -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/ddmags.c
r15509 r38443 66 66 /* lock, load, unlock catalog */ 67 67 catalog.filename = skylist[0].filename[k]; 68 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_SECF;68 catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_SECFILT; 69 69 catalog.Nsecfilt = 0; 70 70 -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/dmagaves.c
r14401 r38443 58 58 /* lock, load, unlock catalog */ 59 59 catalog.filename = skylist[0].filename[j]; 60 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_SECF;60 catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_SECFILT; 61 61 catalog.Nsecfilt = 0; 62 62 -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/dmagmeas.c
r15509 r38443 66 66 /* lock, load, unlock catalog */ 67 67 catalog.filename = skylist[0].filename[j]; 68 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_SECF;68 catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_SECFILT; 69 69 catalog.Nsecfilt = 0; 70 70 -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/dmags.c
r15509 r38443 64 64 /* lock, load, unlock catalog */ 65 65 catalog.filename = skylist[0].filename[j]; 66 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_SECF;66 catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_SECFILT; 67 67 catalog.Nsecfilt = 0; 68 68 -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/dmt.c
r31635 r38443 77 77 /* lock, load, unlock catalog */ 78 78 catalog.filename = skylist[0].filename[k]; 79 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_SECF;79 catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_SECFILT; 80 80 catalog.Nsecfilt = 0; 81 81 -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/dvo_host_utils.c
r37807 r38443 230 230 // write vectors to a table (this is used by parallel dvo operations, but can be used elsewhere) 231 231 if (ResultFile) { 232 int status = WriteVectorTableFITS (ResultFile, "RESULT", vec, Nvec, FALSE, NULL);232 int status = WriteVectorTableFITS (ResultFile, "RESULT", vec, Nvec, FALSE, FALSE, NULL); 233 233 if (!status) { 234 234 gprint (GP_ERR, "failed to write result file %s\n", ResultFile); -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/extract.c
r31635 r38443 252 252 catalog.measure = (Measure *) NULL; 253 253 catalog.secfilt = (SecFilt *) NULL; 254 loadmode = LOAD_AVES | LOAD_SECF;254 loadmode = DVO_LOAD_AVERAGE | DVO_LOAD_SECFILT; 255 255 if ((mode == REF) || (mode == TYPE) || (mode == NPHOT) || (mode == NCODE)) 256 loadmode = loadmode | LOAD_MEAS;256 loadmode = loadmode | DVO_LOAD_MEASURE; 257 257 258 258 /* lock, load, unlock catalog */ -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/fitcolors.c
r34584 r38443 162 162 /* lock, load, unlock catalog */ 163 163 catalog[k].filename = skylist[0].filename[k]; 164 catalog[k].catflags = LOAD_AVES | LOAD_MEAS | LOAD_SECF;164 catalog[k].catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_SECFILT; 165 165 catalog[k].Nsecfilt = 0; 166 166 -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/fitsed.c
r37049 r38443 188 188 /* lock, load, unlock catalog */ 189 189 catalog.filename = skylist[0].filename[k]; 190 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_SECF;190 catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_SECFILT; 191 191 catalog.Nsecfilt = 0; 192 192 -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/gstar.c
r38436 r38443 254 254 255 255 /* lock, load, unlock catalog */ 256 catalog.catflags = LOAD_AVES | LOAD_SECF;257 catalog.catflags |= GetMeasures ? LOAD_MEAS : SKIP_MEAS;256 catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_SECFILT; 257 catalog.catflags |= GetMeasures ? DVO_LOAD_MEASURE : DVO_SKIP_MEASURE; 258 258 catalog.Nsecfilt = 0; 259 259 -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/imdata.c
r37807 r38443 136 136 /* get file name and open */ 137 137 catalog.filename = skylist[0].filename[j]; 138 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_SECF;138 catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_SECFILT; 139 139 catalog.Nsecfilt = 0; 140 140 -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/lcurve.c
r37049 r38443 76 76 /* set filename, read in header */ 77 77 catalog.filename = skylist[0].filename[0]; 78 catalog.catflags = LOAD_AVES | LOAD_MEAS;78 catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE; 79 79 catalog.Nsecfilt = 0; 80 80 -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/lightcurve.c
r37049 r38443 59 59 /* set filename, read in header */ 60 60 catalog.filename = skylist[0].filename[0]; 61 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_SECF;61 catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_SECFILT; 62 62 catalog.Nsecfilt = 0; 63 63 -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/mextract.c
r37807 r38443 19 19 return FALSE; 20 20 } 21 22 void gfits_uncompress_timing (); 21 23 22 24 int mextract (int argc, char **argv) { … … 229 231 snprintf (hostfile, 1024, "%s/%s.cpt", HOSTDIR, skylist[0].regions[i]->name); 230 232 catalog.filename = HOST_ID ? hostfile : skylist[0].filename[i]; 231 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_SECF;232 // catalog.catflags |= needLensing ? LOAD_LENSING :SKIP_LENSING;233 catalog.catflags |= needStarpar ? LOAD_STARPAR :SKIP_STARPAR;233 catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_SECFILT; 234 // catalog.catflags |= needLensing ? DVO_LOAD_LENSING : DVO_SKIP_LENSING; 235 catalog.catflags |= needStarpar ? DVO_LOAD_STARPAR : DVO_SKIP_STARPAR; 234 236 catalog.Nsecfilt = Nsecfilt; 235 237 … … 317 319 // write vectors to a table (this is used by parallel dvo operations, but can be used elsewhere) 318 320 if (RESULT_FILE && !SKIP_RESULTS) { 319 int status = WriteVectorTableFITS (RESULT_FILE, "RESULT", vec, Nreturn, FALSE, NULL);321 int status = WriteVectorTableFITS (RESULT_FILE, "RESULT", vec, Nreturn, FALSE, FALSE, NULL); 320 322 if (!status) goto escape; 321 323 } … … 330 332 SkyListFree (skylist); 331 333 FreeSkyRegionSelection (selection); 334 335 gfits_uncompress_timing(); 332 336 333 337 // fprintf (stderr, "done extr...\n"); -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/mmatch.c
r37807 r38443 150 150 // XXX this is now set for both cases... 151 151 CoordsFile = abspath("coords.fits", 1024); 152 int status = WriteVectorTableFITS (CoordsFile, "COORDS", vec, 2, FALSE, NULL);152 int status = WriteVectorTableFITS (CoordsFile, "COORDS", vec, 2, FALSE, FALSE, NULL); 153 153 if (!status) goto escape; 154 154 } … … 248 248 snprintf (hostfile, 1024, "%s/%s.cpt", HOSTDIR, skylist[0].regions[i]->name); 249 249 catalog.filename = HOST_ID ? hostfile : skylist[0].filename[i]; 250 catalog.catflags = LOAD_AVES | LOAD_SECF | LOAD_MEAS;251 catalog.catflags |= needStarpar ? LOAD_STARPAR :SKIP_STARPAR;250 catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_SECFILT | DVO_LOAD_MEASURE; 251 catalog.catflags |= needStarpar ? DVO_LOAD_STARPAR : DVO_SKIP_STARPAR; 252 252 catalog.Nsecfilt = Nsecfilt; 253 253 … … 349 349 vec[Nfields-1] = IDXvec; 350 350 } 351 int status = WriteVectorTableFITS (RESULT_FILE, "RESULT", vec, Nfields, FALSE, NULL);351 int status = WriteVectorTableFITS (RESULT_FILE, "RESULT", vec, Nfields, FALSE, FALSE, NULL); 352 352 if (!status) goto escape; 353 353 } -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/mmextract.c
r37807 r38443 183 183 /* lock, load, unlock catalog */ 184 184 catalog.filename = skylist[0].filename[i]; 185 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_SECF;185 catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_SECFILT; 186 186 catalog.Nsecfilt = Nsecfilt; 187 187 -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/objectcoverage.c
r37807 r38443 184 184 /* lock, load, unlock catalog */ 185 185 catalog.filename = skylist[0].filename[k]; 186 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_SECF;186 catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_SECFILT; 187 187 catalog.Nsecfilt = 0; 188 188 -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/paverage.c
r34088 r38443 105 105 for (j = 0; (j < skylist[0].Nregions) && !interrupt; j++) { 106 106 catalog.filename = skylist[0].filename[j]; 107 catalog.catflags = LOAD_AVES | LOAD_SECF;107 catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_SECFILT; 108 108 catalog.Nsecfilt = Nsecfilt; 109 109 -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/pmeasure.c
r37049 r38443 178 178 for (j = 0; (j < skylist[0].Nregions) && !interrupt; j++) { 179 179 catalog.filename = skylist[0].filename[j]; 180 catalog.catflags = LOAD_AVES | LOAD_MEAS;180 catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE; 181 181 catalog.Nsecfilt = 0; 182 182 -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/subpix.c
r37807 r38443 40 40 /* lock, load, unlock catalog */ 41 41 catalog.filename = skylist[0].filename[0]; 42 catalog.catflags = LOAD_AVES | LOAD_MEAS;42 catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE; 43 43 catalog.Nsecfilt = 0; 44 44 -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/include/dvomath.h
r38062 r38443 167 167 168 168 /* vector IO functions */ 169 int WriteVectorTableFITS PROTO((char *filename, char *extname, Vector **vec, int Nvec, int append, char * format));169 int WriteVectorTableFITS PROTO((char *filename, char *extname, Vector **vec, int Nvec, int append, char *compress, char *format)); 170 170 Vector **ReadVectorTableFITS PROTO((char *filename, char *extname, int *Nvec)); 171 171 -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/lib.data/SplineOps.c
r34584 r38443 178 178 gfits_create_table (&theader, &ftable); 179 179 180 gfits_set_bintable_column_reformat (&theader, &ftable, "X_KNOT", "double", myspline->xk, myspline->Nknots); 181 gfits_set_bintable_column_reformat (&theader, &ftable, "Y_KNOT", "double", myspline->yk, myspline->Nknots); 182 gfits_set_bintable_column_reformat (&theader, &ftable, "DY2_DX", "double", myspline->y2, myspline->Nknots); 180 // NOTE: if we want to compress the output table, use native byte order here (last element) 181 gfits_set_bintable_column_reformat (&theader, &ftable, "X_KNOT", "double", myspline->xk, myspline->Nknots, FALSE); 182 gfits_set_bintable_column_reformat (&theader, &ftable, "Y_KNOT", "double", myspline->yk, myspline->Nknots, FALSE); 183 gfits_set_bintable_column_reformat (&theader, &ftable, "DY2_DX", "double", myspline->y2, myspline->Nknots, FALSE); 183 184 184 185 if (!append) { -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/lib.shell/VectorIO.c
r37049 r38443 1 1 # include "opihi.h" 2 2 3 // write a set of vectors to a FITS file (vectors names become fits column names)4 int WriteVectorTable (Header *theader, FTable *ftable, char *extname, Vector **vec, int Nvec, char *format) {3 // write a set of vectors to a FITS FTable structure (vectors names become fits column names) 4 static int WriteVectorTable (FTable *ftable, char *extname, Vector **vec, int Nvec, char *format, char nativeOrder) { 5 5 6 6 int j; … … 8 8 char *tformat = NULL; 9 9 10 Header *theader = ftable->header; 10 11 gfits_create_table_header (theader, "BINTABLE", extname); 11 12 … … 58 59 for (j = 0; j < Nvec; j++) { 59 60 if (vec[j][0].type == OPIHI_FLT) { 60 gfits_set_bintable_column_reformat (theader, ftable, vec[j][0].name, "double", vec[j][0].elements.Flt, vec[j][0].Nelements );61 gfits_set_bintable_column_reformat (theader, ftable, vec[j][0].name, "double", vec[j][0].elements.Flt, vec[j][0].Nelements, nativeOrder); 61 62 } else { 62 gfits_set_bintable_column_reformat (theader, ftable, vec[j][0].name, "int", vec[j][0].elements.Int, vec[j][0].Nelements );63 gfits_set_bintable_column_reformat (theader, ftable, vec[j][0].name, "int", vec[j][0].elements.Int, vec[j][0].Nelements, nativeOrder); 63 64 } 64 65 } … … 70 71 } 71 72 73 # define VERBOSE 0 74 int dump_raw_table (FTable *table, char *message) { 75 # if (VERBOSE) 76 int i; 77 fprintf (stderr, "%s data: ", message); 78 for (i = 0; i < table->header->Naxis[0]*table->header->Naxis[1]; i++) { 79 fprintf (stderr, "0x%02hhx ", table->buffer[i]); 80 } 81 fprintf (stderr, "\n"); 82 # endif 83 return TRUE; 84 } 85 86 int dump_cmp_table (FTable *table, char *message) { 87 # if (VERBOSE) 88 int i; 89 fprintf (stderr, "%s pntr: ", message); 90 for (i = 0; i < table->header->Naxis[0]*table->header->Naxis[1]; i++) { 91 fprintf (stderr, "0x%02hhx ", table->buffer[i]); 92 } 93 fprintf (stderr, "\n"); 94 95 fprintf (stderr, "%s data: ", message); 96 for (i = 0; i < table->header->pcount; i++) { 97 fprintf (stderr, "0x%02hhx ", table->buffer[table->heap_start + i]); 98 } 99 fprintf (stderr, "\n"); 100 # endif 101 return TRUE; 102 } 103 72 104 // write a set of vectors to a FITS file (vectors names become fits column names) 73 int WriteVectorTableFITS (char *filename, char *extname, Vector **vec, int Nvec, int append, char * format) {74 75 Header header;76 Matrix matrix;77 Header theader;78 FTable ftable;105 int WriteVectorTableFITS (char *filename, char *extname, Vector **vec, int Nvec, int append, char *compress, char *format) { 106 107 Header rawheader; 108 Header cmpheader; 109 FTable rawtable; 110 FTable cmptable; 79 111 80 112 FILE *f = NULL; … … 91 123 } 92 124 93 if (!WriteVectorTable (&theader, &ftable, extname, vec, Nvec, format)) goto escape; 125 // init so free below does not fail if table is not created 126 gfits_init_header (&rawheader); 127 gfits_init_header (&cmpheader); 128 gfits_init_table (&rawtable); 129 gfits_init_table (&cmptable); 130 131 rawtable.header = &rawheader; 132 if (!WriteVectorTable (&rawtable, extname, vec, Nvec, format, (compress != NULL))) goto escape; 133 // NOTE : for compression, the table is constructed in native by order 134 135 FTable *outtable = &rawtable; 136 Header *outheader = &rawheader; 137 138 if (compress) { 139 cmptable.header = &cmpheader; 140 141 dump_raw_table (&rawtable, "wd raw"); 142 if (!gfits_compress_table (&rawtable, &cmptable, 0, compress)) goto escape; 143 144 int i, Nfields; 145 if (!gfits_scan (&cmpheader, "TFIELDS", "%d", 1, &Nfields)) goto escape; 146 for (i = 0; i < Nfields; i++) { 147 gfits_byteswap_varlength_column (&cmptable, i+1); 148 } 149 dump_cmp_table (&cmptable, "wd cmp"); 150 151 outtable = &cmptable; 152 outheader = &cmpheader; 153 } 94 154 95 155 if (!append) { 156 Header header; 157 Matrix matrix; 96 158 gfits_init_header (&header); 159 gfits_init_matrix (&matrix); 97 160 header.extend = TRUE; 98 161 gfits_create_header (&header); … … 103 166 gfits_free_matrix (&matrix); 104 167 } 105 gfits_fwrite_Theader (f, &theader); 106 gfits_fwrite_table (f, &ftable); 107 108 gfits_free_header (&theader); 109 gfits_free_table (&ftable); 168 169 // write the actual table data 170 gfits_fwrite_Theader (f, outheader); 171 gfits_fwrite_table (f, outtable); 172 173 gfits_free_header (&rawheader); 174 gfits_free_table (&rawtable); 175 176 if (compress) { 177 gfits_free_header (&cmpheader); 178 gfits_free_table (&cmptable); 179 } 110 180 111 181 fclose (f); … … 114 184 115 185 escape: 116 if (!append) { 117 gfits_free_header (&header); 118 gfits_free_matrix (&matrix); 119 } 120 gfits_free_header (&theader); 121 gfits_free_table (&ftable); 186 gfits_free_header (&rawheader); 187 gfits_free_table (&rawtable); 188 189 if (compress) { 190 gfits_free_header (&cmpheader); 191 gfits_free_table (&cmptable); 192 } 122 193 123 194 fclose (f); … … 249 320 ASSIGN_DATA(short, short, Int); 250 321 ASSIGN_DATA(int, int, Int); 251 ASSIGN_DATA(int64_t, int64_t, Int);322 ASSIGN_DATA(int64_t, int64_t, Flt); // int64_t has a problem: Int is too small, Flt is wrong precision 252 323 ASSIGN_DATA(float, float, Flt); 253 324 ASSIGN_DATA(double, double, Flt); … … 274 345 ASSIGN_DATA_TRANSPOSE(short, short, Int); 275 346 ASSIGN_DATA_TRANSPOSE(int, int, Int); 276 ASSIGN_DATA_TRANSPOSE(int64_t, int64_t, Int);347 ASSIGN_DATA_TRANSPOSE(int64_t, int64_t, Flt); 277 348 ASSIGN_DATA_TRANSPOSE(float, float, Flt); 278 349 ASSIGN_DATA_TRANSPOSE(double, double, Flt); -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/lib.shell/convert_to_RPN.c
r38062 r38443 58 58 if (!strcmp (argv[i], "lgamma")) { type = ST_UNARY; goto gotit; } 59 59 if (!strcmp (argv[i], "rnd")) { type = ST_UNARY; goto gotit; } 60 if (!strcmp (argv[i], "drnd")) { type = ST_UNARY; goto gotit; } 61 if (!strcmp (argv[i], "lrnd")) { type = ST_UNARY; goto gotit; } 62 if (!strcmp (argv[i], "mrnd")) { type = ST_UNARY; goto gotit; } 60 63 if (!strcmp (argv[i], "xramp")) { type = ST_UNARY; goto gotit; } 61 64 if (!strcmp (argv[i], "yramp")) { type = ST_UNARY; goto gotit; } -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/lib.shell/evaluate_stack.c
r38062 r38443 115 115 116 116 /* there are no valid unary string operators */ 117 push_error ("invalid operands for trinary operator (mismatch types?)"); 117 snprintf (line, 512, "invalid operands for trinary operator %s (mismatch types?)", stack[i].name); 118 push_error (line); 118 119 clear_stack (&tmp_stack); 119 120 return (FALSE); … … 210 211 211 212 /* there are no valid unary string operators */ 212 push_error ("syntax error: no valid string unary ops"); 213 snprintf (line, 512, "invalid operand for unary operator %s (undefined value?)", stack[i].name); 214 push_error (line); 213 215 clear_stack (&tmp_stack); 214 216 return (FALSE); -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/lib.shell/stack_math.c
r38062 r38443 12 12 // set up the possible operations : int OP int -> int, all else yield float 13 13 // OP is the operation performed on *M1 and *M2 14 # define SSS_FUNC(OP) { \14 # define SSS_FUNC(OP) { \ 15 15 if ((V1->type == ST_SCALAR_FLT) && (V2->type == ST_SCALAR_FLT) && (V3->type == ST_SCALAR_FLT)) { \ 16 opihi_flt M1 = V1[0].FltValue; \17 opihi_flt M2 = V2[0].FltValue; \18 opihi_flt M3 = V3[0].FltValue; \19 OUT[0].type = ST_SCALAR_FLT; \20 OUT[0].FltValue = OP; \16 opihi_flt M1 = V1[0].FltValue; \ 17 opihi_flt M2 = V2[0].FltValue; \ 18 opihi_flt M3 = V3[0].FltValue; \ 19 OUT[0].type = ST_SCALAR_FLT; \ 20 OUT[0].FltValue = OP; \ 21 21 break; \ 22 22 } \ 23 23 if ((V1->type == ST_SCALAR_INT) && (V2->type == ST_SCALAR_INT) && (V3->type == ST_SCALAR_INT)) { \ 24 opihi_int M1 = V1[0].IntValue; \25 opihi_int M2 = V2[0].IntValue; \26 opihi_int M3 = V3[0].IntValue; \27 OUT[0].type = ST_SCALAR_INT; \28 OUT[0].IntValue = OP; \24 opihi_int M1 = V1[0].IntValue; \ 25 opihi_int M2 = V2[0].IntValue; \ 26 opihi_int M3 = V3[0].IntValue; \ 27 OUT[0].type = ST_SCALAR_INT; \ 28 OUT[0].IntValue = OP; \ 29 29 break; \ 30 30 } \ … … 32 32 33 33 switch (op[0]) { 34 case '?': SSS_FUNC(M1 ? M2: M3);35 default:36 snprintf (line, 512, "error: op %c not defined!", op[0]);37 push_error (line);38 return (FALSE);39 }34 case '?': SSS_FUNC(M1 ? M2: M3); 35 default: 36 snprintf (line, 512, "error: op %c not defined!", op[0]); 37 push_error (line); 38 return (FALSE); 39 } 40 40 # undef SSS_FUNC 41 41 … … 68 68 // set up the possible operations : int OP int -> int, all else yield float 69 69 // OP is the operation performed on *M1 and *M2 70 # define VVV_FUNC(OP) { \70 # define VVV_FUNC(OP) { \ 71 71 if ((V1->vector->type == OPIHI_FLT) && (V2->vector->type == OPIHI_FLT) && (V3->vector->type == OPIHI_FLT)) { \ 72 72 CopyVector (OUT[0].vector, V1[0].vector); \ … … 394 394 // OP is the operation performed on *M1 and *M2 395 395 # define SV_FUNC(FTYPE,OP) { \ 396 if ((V1->type == ST_SCALAR_FLT) && (V2->vector->type == OPIHI_FLT)) { \396 if ((V1->type == ST_SCALAR_FLT) && (V2->vector->type == OPIHI_FLT)) { \ 397 397 CopyVector (OUT[0].vector, V2[0].vector); \ 398 398 opihi_flt M1 = V1[0].FltValue; \ … … 404 404 break; \ 405 405 } \ 406 if ((V1->type == ST_SCALAR_FLT) && (V2->vector->type != OPIHI_FLT)) { \406 if ((V1->type == ST_SCALAR_FLT) && (V2->vector->type != OPIHI_FLT)) { \ 407 407 MatchVector (OUT[0].vector, V2[0].vector, OPIHI_FLT); \ 408 408 opihi_flt M1 = V1[0].FltValue; \ … … 414 414 break; \ 415 415 } \ 416 if ((V1->type == ST_SCALAR_INT) && (V2->vector->type == OPIHI_FLT)) { \416 if ((V1->type == ST_SCALAR_INT) && (V2->vector->type == OPIHI_FLT)) { \ 417 417 CopyVector (OUT[0].vector, V2[0].vector); \ 418 418 opihi_int M1 = V1[0].IntValue; \ … … 434 434 break; \ 435 435 } \ 436 if ((V1->type == ST_SCALAR_INT) && (V2->vector->type != OPIHI_FLT)) { \436 if ((V1->type == ST_SCALAR_INT) && (V2->vector->type != OPIHI_FLT)) { \ 437 437 CopyVector (OUT[0].vector, V2[0].vector); \ 438 438 opihi_int M1 = V1[0].IntValue; \ … … 447 447 448 448 switch (op[0]) { 449 case '+': SV_FUNC(ST_SCALAR_INT, M1 + *M2);450 case '-': SV_FUNC(ST_SCALAR_INT, M1 - *M2);451 case '*': SV_FUNC(ST_SCALAR_INT, M1 * *M2);452 case '/': SV_FUNC(ST_SCALAR_FLT, M1 / (opihi_flt) *M2);453 case '%': SV_FUNC(ST_SCALAR_INT, (long long) M1 % (long long) *M2);454 case '^': SV_FUNC(ST_SCALAR_FLT, pow (M1, *M2));455 case '@': SV_FUNC(ST_SCALAR_FLT, DEG_RAD*atan2 (M1, *M2));456 case 'a': SV_FUNC(ST_SCALAR_FLT, DEG_RAD*atan2 (M1, *M2));457 case 'D': SV_FUNC(ST_SCALAR_INT, MIN (M1, *M2));458 case 'U': SV_FUNC(ST_SCALAR_INT, MAX (M1, *M2));459 case '<': SV_FUNC(ST_SCALAR_INT, (M1 < *M2) ? 1 : 0);460 case '>': SV_FUNC(ST_SCALAR_INT, (M1 > *M2) ? 1 : 0);461 case '&': SV_FUNC(ST_SCALAR_INT, ((long long)M1 & (long long)*M2));462 case '|': SV_FUNC(ST_SCALAR_INT, ((long long)M1 | (long long)*M2));463 case 'E': SV_FUNC(ST_SCALAR_INT, (M1 == *M2) ? 1 : 0);464 case 'N': SV_FUNC(ST_SCALAR_INT, (M1 != *M2) ? 1 : 0);465 case 'L': SV_FUNC(ST_SCALAR_INT, (M1 <= *M2) ? 1 : 0);466 case 'G': SV_FUNC(ST_SCALAR_INT, (M1 >= *M2) ? 1 : 0);467 case 'A': SV_FUNC(ST_SCALAR_INT, (M1 && *M2) ? 1 : 0);468 case 'O': SV_FUNC(ST_SCALAR_INT, (M1 || *M2) ? 1 : 0);469 default:470 snprintf (line, 512, "error: op %c not defined!", op[0]);471 push_error (line);472 return (FALSE);473 }449 case '+': SV_FUNC(ST_SCALAR_INT, M1 + *M2); 450 case '-': SV_FUNC(ST_SCALAR_INT, M1 - *M2); 451 case '*': SV_FUNC(ST_SCALAR_INT, M1 * *M2); 452 case '/': SV_FUNC(ST_SCALAR_FLT, M1 / (opihi_flt) *M2); 453 case '%': SV_FUNC(ST_SCALAR_INT, (long long) M1 % (long long) *M2); 454 case '^': SV_FUNC(ST_SCALAR_FLT, pow (M1, *M2)); 455 case '@': SV_FUNC(ST_SCALAR_FLT, DEG_RAD*atan2 (M1, *M2)); 456 case 'a': SV_FUNC(ST_SCALAR_FLT, DEG_RAD*atan2 (M1, *M2)); 457 case 'D': SV_FUNC(ST_SCALAR_INT, MIN (M1, *M2)); 458 case 'U': SV_FUNC(ST_SCALAR_INT, MAX (M1, *M2)); 459 case '<': SV_FUNC(ST_SCALAR_INT, (M1 < *M2) ? 1 : 0); 460 case '>': SV_FUNC(ST_SCALAR_INT, (M1 > *M2) ? 1 : 0); 461 case '&': SV_FUNC(ST_SCALAR_INT, ((long long)M1 & (long long)*M2)); 462 case '|': SV_FUNC(ST_SCALAR_INT, ((long long)M1 | (long long)*M2)); 463 case 'E': SV_FUNC(ST_SCALAR_INT, (M1 == *M2) ? 1 : 0); 464 case 'N': SV_FUNC(ST_SCALAR_INT, (M1 != *M2) ? 1 : 0); 465 case 'L': SV_FUNC(ST_SCALAR_INT, (M1 <= *M2) ? 1 : 0); 466 case 'G': SV_FUNC(ST_SCALAR_INT, (M1 >= *M2) ? 1 : 0); 467 case 'A': SV_FUNC(ST_SCALAR_INT, (M1 && *M2) ? 1 : 0); 468 case 'O': SV_FUNC(ST_SCALAR_INT, (M1 || *M2) ? 1 : 0); 469 default: 470 snprintf (line, 512, "error: op %c not defined!", op[0]); 471 push_error (line); 472 return (FALSE); 473 } 474 474 # undef SV_FUNC 475 475 476 476 /** free up any temporary buffers: **/ 477 477 if (V2[0].type == ST_VECTOR_TMP) { 478 free (V2[0].vector[0].elements.Ptr);479 free (V2[0].vector);480 }478 free (V2[0].vector[0].elements.Ptr); 479 free (V2[0].vector); 480 } 481 481 482 482 clear_stack (V1); … … 501 501 // OP is the operation performed on *M1 and *M2 502 502 # define VS_FUNC(FTYPE,OP) { \ 503 if ((V2->type == ST_SCALAR_FLT) && (V1->vector->type == OPIHI_FLT)) { \503 if ((V2->type == ST_SCALAR_FLT) && (V1->vector->type == OPIHI_FLT)) { \ 504 504 CopyVector (OUT[0].vector, V1[0].vector); \ 505 505 opihi_flt *M1 = V1[0].vector[0].elements.Flt; \ … … 511 511 break; \ 512 512 } \ 513 if ((V2->type == ST_SCALAR_FLT) && (V1->vector->type != OPIHI_FLT)) { \513 if ((V2->type == ST_SCALAR_FLT) && (V1->vector->type != OPIHI_FLT)) { \ 514 514 MatchVector (OUT[0].vector, V1[0].vector, OPIHI_FLT); \ 515 515 opihi_int *M1 = V1[0].vector[0].elements.Int; \ … … 521 521 break; \ 522 522 } \ 523 if ((V2->type == ST_SCALAR_INT) && (V1->vector->type == OPIHI_FLT)) { \523 if ((V2->type == ST_SCALAR_INT) && (V1->vector->type == OPIHI_FLT)) { \ 524 524 CopyVector (OUT[0].vector, V1[0].vector); \ 525 525 opihi_flt *M1 = V1[0].vector[0].elements.Flt; \ … … 541 541 break; \ 542 542 } \ 543 if ((V2->type == ST_SCALAR_INT) && (V1->vector->type != OPIHI_FLT)) { \543 if ((V2->type == ST_SCALAR_INT) && (V1->vector->type != OPIHI_FLT)) { \ 544 544 CopyVector (OUT[0].vector, V1[0].vector); \ 545 545 opihi_int *M1 = V1[0].vector[0].elements.Int; \ … … 554 554 555 555 switch (op[0]) { 556 case '+': VS_FUNC(ST_SCALAR_INT, *M1 + M2);557 case '-': VS_FUNC(ST_SCALAR_INT, *M1 - M2);558 case '*': VS_FUNC(ST_SCALAR_INT, *M1 * M2);559 case '/': VS_FUNC(ST_SCALAR_FLT, *M1 / (opihi_flt) M2);560 case '%': VS_FUNC(ST_SCALAR_INT, (long long) *M1 % (long long) M2);561 case '^': VS_FUNC(ST_SCALAR_FLT, pow (*M1, M2));562 case '@': VS_FUNC(ST_SCALAR_FLT, DEG_RAD*atan2 (*M1, M2));563 case 'a': VS_FUNC(ST_SCALAR_FLT, DEG_RAD*atan2 (*M1, M2));564 case 'D': VS_FUNC(ST_SCALAR_INT, MIN (*M1, M2));565 case 'U': VS_FUNC(ST_SCALAR_INT, MAX (*M1, M2));566 case '<': VS_FUNC(ST_SCALAR_INT, (*M1 < M2) ? 1 : 0);567 case '>': VS_FUNC(ST_SCALAR_INT, (*M1 > M2) ? 1 : 0);568 case '&': VS_FUNC(ST_SCALAR_INT, ((long long)*M1 & (long long)M2));569 case '|': VS_FUNC(ST_SCALAR_INT, ((long long)*M1 | (long long)M2));570 case 'E': VS_FUNC(ST_SCALAR_INT, (*M1 == M2) ? 1 : 0);571 case 'N': VS_FUNC(ST_SCALAR_INT, (*M1 != M2) ? 1 : 0);572 case 'L': VS_FUNC(ST_SCALAR_INT, (*M1 <= M2) ? 1 : 0);573 case 'G': VS_FUNC(ST_SCALAR_INT, (*M1 >= M2) ? 1 : 0);574 case 'A': VS_FUNC(ST_SCALAR_INT, (*M1 && M2) ? 1 : 0);575 case 'O': VS_FUNC(ST_SCALAR_INT, (*M1 || M2) ? 1 : 0);576 default:577 snprintf (line, 512, "error: op %c not defined!", op[0]);578 push_error (line);579 return (FALSE);580 }556 case '+': VS_FUNC(ST_SCALAR_INT, *M1 + M2); 557 case '-': VS_FUNC(ST_SCALAR_INT, *M1 - M2); 558 case '*': VS_FUNC(ST_SCALAR_INT, *M1 * M2); 559 case '/': VS_FUNC(ST_SCALAR_FLT, *M1 / (opihi_flt) M2); 560 case '%': VS_FUNC(ST_SCALAR_INT, (long long) *M1 % (long long) M2); 561 case '^': VS_FUNC(ST_SCALAR_FLT, pow (*M1, M2)); 562 case '@': VS_FUNC(ST_SCALAR_FLT, DEG_RAD*atan2 (*M1, M2)); 563 case 'a': VS_FUNC(ST_SCALAR_FLT, DEG_RAD*atan2 (*M1, M2)); 564 case 'D': VS_FUNC(ST_SCALAR_INT, MIN (*M1, M2)); 565 case 'U': VS_FUNC(ST_SCALAR_INT, MAX (*M1, M2)); 566 case '<': VS_FUNC(ST_SCALAR_INT, (*M1 < M2) ? 1 : 0); 567 case '>': VS_FUNC(ST_SCALAR_INT, (*M1 > M2) ? 1 : 0); 568 case '&': VS_FUNC(ST_SCALAR_INT, ((long long)*M1 & (long long)M2)); 569 case '|': VS_FUNC(ST_SCALAR_INT, ((long long)*M1 | (long long)M2)); 570 case 'E': VS_FUNC(ST_SCALAR_INT, (*M1 == M2) ? 1 : 0); 571 case 'N': VS_FUNC(ST_SCALAR_INT, (*M1 != M2) ? 1 : 0); 572 case 'L': VS_FUNC(ST_SCALAR_INT, (*M1 <= M2) ? 1 : 0); 573 case 'G': VS_FUNC(ST_SCALAR_INT, (*M1 >= M2) ? 1 : 0); 574 case 'A': VS_FUNC(ST_SCALAR_INT, (*M1 && M2) ? 1 : 0); 575 case 'O': VS_FUNC(ST_SCALAR_INT, (*M1 || M2) ? 1 : 0); 576 default: 577 snprintf (line, 512, "error: op %c not defined!", op[0]); 578 push_error (line); 579 return (FALSE); 580 } 581 581 # undef VS_FUNC 582 582 … … 584 584 585 585 if (V1[0].type == ST_VECTOR_TMP) { 586 free (V1[0].vector[0].elements.Ptr);587 free (V1[0].vector);588 }586 free (V1[0].vector[0].elements.Ptr); 587 free (V1[0].vector); 588 } 589 589 590 590 clear_stack (V1); … … 885 885 float *out = (float *)OUT[0].buffer[0].matrix.buffer; 886 886 887 # define MS_FUNC(OP) { \888 if (V2->type == ST_SCALAR_FLT) { \889 opihi_flt M2 = V2[0].FltValue; \887 # define MS_FUNC(OP) { \ 888 if (V2->type == ST_SCALAR_FLT) { \ 889 opihi_flt M2 = V2[0].FltValue; \ 890 890 for (i = 0; i < Npix; i++, out++, M1++) { \ 891 *out = OP; \892 } \893 break; \894 } \895 if (V2->type == ST_SCALAR_INT) { \896 opihi_int M2 = V2[0].IntValue; \891 *out = OP; \ 892 } \ 893 break; \ 894 } \ 895 if (V2->type == ST_SCALAR_INT) { \ 896 opihi_int M2 = V2[0].IntValue; \ 897 897 for (i = 0; i < Npix; i++, out++, M1++) { \ 898 *out = OP; \899 } \900 break; \901 } \898 *out = OP; \ 899 } \ 900 break; \ 901 } \ 902 902 } 903 903 … … 961 961 float *out = (float *)OUT[0].buffer[0].matrix.buffer; 962 962 963 # define SM_FUNC(OP) { \964 if (V1->type == ST_SCALAR_FLT) { \965 opihi_flt M1 = V1[0].FltValue; \963 # define SM_FUNC(OP) { \ 964 if (V1->type == ST_SCALAR_FLT) { \ 965 opihi_flt M1 = V1[0].FltValue; \ 966 966 for (i = 0; i < Npix; i++, out++, M2++) { \ 967 *out = OP; \968 } \969 break; \970 } \971 if (V1->type == ST_SCALAR_INT) { \972 opihi_int M1 = V1[0].IntValue; \967 *out = OP; \ 968 } \ 969 break; \ 970 } \ 971 if (V1->type == ST_SCALAR_INT) { \ 972 opihi_int M1 = V1[0].IntValue; \ 973 973 for (i = 0; i < Npix; i++, out++, M2++) { \ 974 *out = OP; \975 } \976 break; \977 } \974 *out = OP; \ 975 } \ 976 break; \ 977 } \ 978 978 } 979 979 … … 1023 1023 1024 1024 # define SS_FUNC(FTYPE,OP) { \ 1025 if ((V1->type == ST_SCALAR_FLT) && (V2->type == ST_SCALAR_FLT)) { \1025 if ((V1->type == ST_SCALAR_FLT) && (V2->type == ST_SCALAR_FLT)) { \ 1026 1026 opihi_flt M1 = V1[0].FltValue; \ 1027 1027 opihi_flt M2 = V2[0].FltValue; \ 1028 OUT[0].type = ST_SCALAR_FLT; \1028 OUT[0].type = ST_SCALAR_FLT; \ 1029 1029 OUT[0].FltValue = OP; \ 1030 1030 break; \ 1031 1031 } \ 1032 if ((V1->type == ST_SCALAR_FLT) && (V2->type == ST_SCALAR_INT)) { \1032 if ((V1->type == ST_SCALAR_FLT) && (V2->type == ST_SCALAR_INT)) { \ 1033 1033 opihi_flt M1 = V1[0].FltValue; \ 1034 1034 opihi_int M2 = V2[0].IntValue; \ 1035 OUT[0].type = ST_SCALAR_FLT; \1035 OUT[0].type = ST_SCALAR_FLT; \ 1036 1036 OUT[0].FltValue = OP; \ 1037 1037 break; \ 1038 1038 } \ 1039 if ((V1->type == ST_SCALAR_INT) && (V2->type == ST_SCALAR_FLT)) { \1039 if ((V1->type == ST_SCALAR_INT) && (V2->type == ST_SCALAR_FLT)) { \ 1040 1040 opihi_int M1 = V1[0].IntValue; \ 1041 1041 opihi_flt M2 = V2[0].FltValue; \ 1042 OUT[0].type = ST_SCALAR_FLT; \1042 OUT[0].type = ST_SCALAR_FLT; \ 1043 1043 OUT[0].FltValue = OP; \ 1044 1044 break; \ 1045 1045 } \ 1046 if ((FTYPE == ST_SCALAR_FLT) && (V1->type == ST_SCALAR_INT) && (V2->type == ST_SCALAR_INT)) { \1046 if ((FTYPE == ST_SCALAR_FLT) && (V1->type == ST_SCALAR_INT) && (V2->type == ST_SCALAR_INT)) { \ 1047 1047 opihi_int M1 = V1[0].IntValue; \ 1048 1048 opihi_int M2 = V2[0].IntValue; \ 1049 OUT[0].type = ST_SCALAR_FLT; \1049 OUT[0].type = ST_SCALAR_FLT; \ 1050 1050 OUT[0].FltValue = OP; \ 1051 1051 break; \ 1052 1052 } \ 1053 if ((V1->type == ST_SCALAR_INT) && (V2->type == ST_SCALAR_INT)) { \1053 if ((V1->type == ST_SCALAR_INT) && (V2->type == ST_SCALAR_INT)) { \ 1054 1054 opihi_int M1 = V1[0].IntValue; \ 1055 1055 opihi_int M2 = V2[0].IntValue; \ 1056 OUT[0].type = ST_SCALAR_INT; \1056 OUT[0].type = ST_SCALAR_INT; \ 1057 1057 OUT[0].IntValue = OP; \ 1058 1058 break; \ … … 1061 1061 1062 1062 switch (op[0]) { 1063 case '+': SS_FUNC(ST_SCALAR_INT, M1 + M2);1064 case '-': SS_FUNC(ST_SCALAR_INT, M1 - M2);1065 case '*': SS_FUNC(ST_SCALAR_INT, M1 * M2);1066 case '/': SS_FUNC(ST_SCALAR_FLT, M1 / (opihi_flt) M2);1067 case '%': SS_FUNC(ST_SCALAR_INT, (long long) M1 % (long long) M2);1068 case '^': SS_FUNC(ST_SCALAR_FLT, pow (M1, M2));1069 case '@': SS_FUNC(ST_SCALAR_FLT, DEG_RAD*atan2 (M1, M2));1070 case 'a': SS_FUNC(ST_SCALAR_FLT, DEG_RAD*atan2 (M1, M2));1071 case 'D': SS_FUNC(ST_SCALAR_INT, MIN (M1, M2));1072 case 'U': SS_FUNC(ST_SCALAR_INT, MAX (M1, M2));1073 case '<': SS_FUNC(ST_SCALAR_INT, (M1 < M2) ? 1 : 0);1074 case '>': SS_FUNC(ST_SCALAR_INT, (M1 > M2) ? 1 : 0);1075 case '&': SS_FUNC(ST_SCALAR_INT, ((long long)M1 & (long long)M2));1076 case '|': SS_FUNC(ST_SCALAR_INT, ((long long)M1 | (long long)M2));1077 case 'E': SS_FUNC(ST_SCALAR_INT, (M1 == M2) ? 1 : 0);1078 case 'N': SS_FUNC(ST_SCALAR_INT, (M1 != M2) ? 1 : 0);1079 case 'L': SS_FUNC(ST_SCALAR_INT, (M1 <= M2) ? 1 : 0);1080 case 'G': SS_FUNC(ST_SCALAR_INT, (M1 >= M2) ? 1 : 0);1081 case 'A': SS_FUNC(ST_SCALAR_INT, (M1 && M2) ? 1 : 0);1082 case 'O': SS_FUNC(ST_SCALAR_INT, (M1 || M2) ? 1 : 0);1083 default:1084 snprintf (line, 512, "error: op %c not defined!", op[0]);1085 push_error (line);1086 return (FALSE);1087 }1063 case '+': SS_FUNC(ST_SCALAR_INT, M1 + M2); 1064 case '-': SS_FUNC(ST_SCALAR_INT, M1 - M2); 1065 case '*': SS_FUNC(ST_SCALAR_INT, M1 * M2); 1066 case '/': SS_FUNC(ST_SCALAR_FLT, M1 / (opihi_flt) M2); 1067 case '%': SS_FUNC(ST_SCALAR_INT, (long long) M1 % (long long) M2); 1068 case '^': SS_FUNC(ST_SCALAR_FLT, pow (M1, M2)); 1069 case '@': SS_FUNC(ST_SCALAR_FLT, DEG_RAD*atan2 (M1, M2)); 1070 case 'a': SS_FUNC(ST_SCALAR_FLT, DEG_RAD*atan2 (M1, M2)); 1071 case 'D': SS_FUNC(ST_SCALAR_INT, MIN (M1, M2)); 1072 case 'U': SS_FUNC(ST_SCALAR_INT, MAX (M1, M2)); 1073 case '<': SS_FUNC(ST_SCALAR_INT, (M1 < M2) ? 1 : 0); 1074 case '>': SS_FUNC(ST_SCALAR_INT, (M1 > M2) ? 1 : 0); 1075 case '&': SS_FUNC(ST_SCALAR_INT, ((long long)M1 & (long long)M2)); 1076 case '|': SS_FUNC(ST_SCALAR_INT, ((long long)M1 | (long long)M2)); 1077 case 'E': SS_FUNC(ST_SCALAR_INT, (M1 == M2) ? 1 : 0); 1078 case 'N': SS_FUNC(ST_SCALAR_INT, (M1 != M2) ? 1 : 0); 1079 case 'L': SS_FUNC(ST_SCALAR_INT, (M1 <= M2) ? 1 : 0); 1080 case 'G': SS_FUNC(ST_SCALAR_INT, (M1 >= M2) ? 1 : 0); 1081 case 'A': SS_FUNC(ST_SCALAR_INT, (M1 && M2) ? 1 : 0); 1082 case 'O': SS_FUNC(ST_SCALAR_INT, (M1 || M2) ? 1 : 0); 1083 default: 1084 snprintf (line, 512, "error: op %c not defined!", op[0]); 1085 push_error (line); 1086 return (FALSE); 1087 } 1088 1088 # undef SS_FUNC 1089 1089 … … 1153 1153 } 1154 1154 1155 1156 1155 int S_unary (StackVar *OUT, StackVar *V1, char *op) { 1157 1156 1158 1157 char line[512]; // this is only used to report an error 1159 1158 1160 # define S_FUNC(OP,FTYPE) { \1161 if (V1->type == ST_SCALAR_FLT) { \1162 opihi_flt M1 = V1[0].FltValue; \1163 OUT[0].type = ST_SCALAR_FLT; \1164 OUT[0].FltValue = OP; \1165 clear_stack (V1); \1166 return (TRUE); \1167 } \1159 # define S_FUNC(OP,FTYPE) { \ 1160 if (V1->type == ST_SCALAR_FLT) { \ 1161 opihi_flt M1 = V1[0].FltValue; \ 1162 OUT[0].type = ST_SCALAR_FLT; \ 1163 OUT[0].FltValue = OP; \ 1164 clear_stack (V1); \ 1165 return (TRUE); \ 1166 } \ 1168 1167 if ((FTYPE == ST_SCALAR_FLT) && (V1->type == ST_SCALAR_INT)) { \ 1169 opihi_int M1 = V1[0].IntValue; \1170 OUT[0].type = ST_SCALAR_FLT; \1171 OUT[0].FltValue = OP; \1172 clear_stack (V1); \1173 return (TRUE); \1174 } \1168 opihi_int M1 = V1[0].IntValue; \ 1169 OUT[0].type = ST_SCALAR_FLT; \ 1170 OUT[0].FltValue = OP; \ 1171 clear_stack (V1); \ 1172 return (TRUE); \ 1173 } \ 1175 1174 if ((FTYPE == ST_SCALAR_INT) && (V1->type == ST_SCALAR_INT)) { \ 1176 opihi_int M1 = V1[0].IntValue; \1177 OUT[0].type = ST_SCALAR_INT; \1178 OUT[0].IntValue = OP; \1179 clear_stack (V1); \1180 return (TRUE); \1181 } \1175 opihi_int M1 = V1[0].IntValue; \ 1176 OUT[0].type = ST_SCALAR_INT; \ 1177 OUT[0].IntValue = OP; \ 1178 clear_stack (V1); \ 1179 return (TRUE); \ 1180 } \ 1182 1181 } 1183 1182 … … 1211 1210 if (!strcmp (op, "dacos")) S_FUNC(acos (M1)*DEG_RAD, ST_SCALAR_FLT); 1212 1211 if (!strcmp (op, "datan")) S_FUNC(atan (M1)*DEG_RAD, ST_SCALAR_FLT); 1213 if (!strcmp (op, "rnd")) S_FUNC(M1*0.0 + drand48(), ST_SCALAR_FLT); 1212 if (!strcmp (op, "rnd")) S_FUNC(0.0*M1 + drand48(), ST_SCALAR_FLT); 1213 if (!strcmp (op, "drnd")) S_FUNC(0.0*M1 + drand48(), ST_SCALAR_FLT); 1214 if (!strcmp (op, "lrnd")) S_FUNC(0*M1 + lrand48(), ST_SCALAR_INT); 1215 if (!strcmp (op, "mrnd")) S_FUNC(0*M1 + mrand48(), ST_SCALAR_INT); 1214 1216 if (!strcmp (op, "not")) S_FUNC(!(M1), ST_SCALAR_INT); 1215 1217 if (!strcmp (op, "--")) S_FUNC(-1*M1, ST_SCALAR_INT); // NOTE: opihi_int is signed, … … 1235 1237 OUT[0].type = ST_VECTOR_TMP; /*** <<--- says this is a temporary matrix ***/ 1236 1238 1237 # define V_FUNC(OP,FTYPE) { \1238 if (V1->vector->type == OPIHI_FLT) { \1239 CopyVector (OUT[0].vector, V1[0].vector); \1240 opihi_flt *M1 = V1[0].vector[0].elements.Flt; \1241 opihi_flt *out = OUT[0].vector[0].elements.Flt; \1242 for (i = 0; i < Nx; i++, out++, M1++) { \1243 *out = OP; \1244 } \1245 goto escape; \1246 } \1239 # define V_FUNC(OP,FTYPE) { \ 1240 if (V1->vector->type == OPIHI_FLT) { \ 1241 CopyVector (OUT[0].vector, V1[0].vector); \ 1242 opihi_flt *M1 = V1[0].vector[0].elements.Flt; \ 1243 opihi_flt *out = OUT[0].vector[0].elements.Flt; \ 1244 for (i = 0; i < Nx; i++, out++, M1++) { \ 1245 *out = OP; \ 1246 } \ 1247 goto escape; \ 1248 } \ 1247 1249 if ((V1->vector->type == OPIHI_INT) && (FTYPE == ST_SCALAR_FLT)) { \ 1248 MatchVector (OUT[0].vector, V1[0].vector, OPIHI_FLT); \1249 opihi_int *M1 = V1[0].vector[0].elements.Int; \1250 opihi_flt *out = OUT[0].vector[0].elements.Flt; \1251 for (i = 0; i < Nx; i++, out++, M1++) { \1252 *out = OP; \1253 } \1254 goto escape; \1255 } \1250 MatchVector (OUT[0].vector, V1[0].vector, OPIHI_FLT); \ 1251 opihi_int *M1 = V1[0].vector[0].elements.Int; \ 1252 opihi_flt *out = OUT[0].vector[0].elements.Flt; \ 1253 for (i = 0; i < Nx; i++, out++, M1++) { \ 1254 *out = OP; \ 1255 } \ 1256 goto escape; \ 1257 } \ 1256 1258 if ((V1->vector->type == OPIHI_INT) && (FTYPE == ST_SCALAR_INT)) { \ 1257 CopyVector (OUT[0].vector, V1[0].vector); \1258 opihi_int *M1 = V1[0].vector[0].elements.Int; \1259 opihi_int *out = OUT[0].vector[0].elements.Int; \1260 for (i = 0; i < Nx; i++, out++, M1++) { \1261 *out = OP; \1262 } \1263 goto escape; \1259 CopyVector (OUT[0].vector, V1[0].vector); \ 1260 opihi_int *M1 = V1[0].vector[0].elements.Int; \ 1261 opihi_int *out = OUT[0].vector[0].elements.Int; \ 1262 for (i = 0; i < Nx; i++, out++, M1++) { \ 1263 *out = OP; \ 1264 } \ 1265 goto escape; \ 1264 1266 } } 1265 1267 … … 1294 1296 if (!strcmp (op, "datan")) V_FUNC(atan(*M1)*DEG_RAD, ST_SCALAR_FLT); 1295 1297 if (!strcmp (op, "rnd")) V_FUNC(drand48(), ST_SCALAR_FLT); 1298 if (!strcmp (op, "drnd")) V_FUNC(drand48(), ST_SCALAR_FLT); 1299 if (!strcmp (op, "lrnd")) V_FUNC(lrand48(), ST_SCALAR_INT); 1300 if (!strcmp (op, "mrnd")) V_FUNC(mrand48(), ST_SCALAR_INT); 1296 1301 if (!strcmp (op, "ramp")) V_FUNC(i, ST_SCALAR_INT); 1297 1302 if (!strcmp (op, "zero")) V_FUNC(0, ST_SCALAR_INT); … … 1320 1325 } 1321 1326 1327 # define M_FUNC(OP) { for (i = 0; i < Npix; i++, out++, M1++) { *out = (OP); }} 1328 1322 1329 int M_unary (StackVar *OUT, StackVar *V1, char *op) { 1323 1330 … … 1337 1344 M1 = (float *) V1[0].buffer[0].matrix.buffer; 1338 1345 out = (float *)OUT[0].buffer[0].matrix.buffer; 1339 1346 1347 // if (!strcmp (op, "rint")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = nearbyint (*M1); }} 1348 1340 1349 if (!strcmp (op, "=")) { } 1341 if (!strcmp (op, "abs")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = fabs(*M1); }} 1342 if (!strcmp (op, "int")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = (opihi_flt)(long long)(*M1); }} 1343 1344 if (!strcmp (op, "floor")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = floor (*M1); }} 1345 if (!strcmp (op, "ceil")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = ceil (*M1); }} 1346 // if (!strcmp (op, "rint")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = nearbyint (*M1); }} 1347 1348 if (!strcmp (op, "exp")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = exp(*M1); }} 1349 if (!strcmp (op, "ten")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = pow(10.0,*M1); }} 1350 if (!strcmp (op, "log")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = log10(*M1); }} 1351 if (!strcmp (op, "ln")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = log(*M1); }} 1352 if (!strcmp (op, "sqrt")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = sqrt(*M1); }} 1353 if (!strcmp (op, "erf")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = erf(*M1); }} 1354 1355 if (!strcmp (op, "sinh")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = sinh(*M1); }} 1356 if (!strcmp (op, "cosh")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = cosh(*M1); }} 1357 if (!strcmp (op, "asinh")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = asinh(*M1); }} 1358 if (!strcmp (op, "acosh")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = acosh(*M1); }} 1359 if (!strcmp (op, "lgamma")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = lgamma(*M1); }} 1360 1361 if (!strcmp (op, "sin")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = sin(*M1); }} 1362 if (!strcmp (op, "cos")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = cos(*M1); }} 1363 if (!strcmp (op, "tan")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = tan(*M1); }} 1364 if (!strcmp (op, "dsin")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = sin(*M1*RAD_DEG); }} 1365 if (!strcmp (op, "dcos")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = cos(*M1*RAD_DEG); }} 1366 if (!strcmp (op, "dtan")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = tan(*M1*RAD_DEG); }} 1367 if (!strcmp (op, "asin")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = asin(*M1); }} 1368 if (!strcmp (op, "acos")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = acos(*M1); }} 1369 if (!strcmp (op, "atan")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = atan(*M1); }} 1370 if (!strcmp (op, "dasin")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = asin(*M1)*DEG_RAD; }} 1371 if (!strcmp (op, "dacos")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = acos(*M1)*DEG_RAD; }} 1372 if (!strcmp (op, "datan")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = atan(*M1)*DEG_RAD; }} 1373 if (!strcmp (op, "not")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = !(*M1); }} 1374 if (!strcmp (op, "--")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = -(*M1); }} 1375 if (!strcmp (op, "rnd")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = drand48(); }} 1376 if (!strcmp (op, "ramp")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = i; }} 1377 if (!strcmp (op, "zero")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = 0; }} 1378 if (!strcmp (op, "isinf")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = !finite(*M1); }} 1379 if (!strcmp (op, "isnan")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = isnan(*M1); }} 1350 if (!strcmp (op, "abs")) M_FUNC(fabs(*M1)); 1351 if (!strcmp (op, "int")) M_FUNC((opihi_flt)(long long)(*M1)); 1352 if (!strcmp (op, "floor")) M_FUNC(floor (*M1)); 1353 if (!strcmp (op, "ceil")) M_FUNC(ceil (*M1)); 1354 if (!strcmp (op, "exp")) M_FUNC(exp(*M1)); 1355 if (!strcmp (op, "ten")) M_FUNC(pow(10.0,*M1)); 1356 if (!strcmp (op, "log")) M_FUNC(log10(*M1)); 1357 if (!strcmp (op, "ln")) M_FUNC(log(*M1)); 1358 if (!strcmp (op, "sqrt")) M_FUNC(sqrt(*M1)); 1359 if (!strcmp (op, "erf")) M_FUNC(erf(*M1)); 1360 if (!strcmp (op, "sinh")) M_FUNC(sinh(*M1)); 1361 if (!strcmp (op, "cosh")) M_FUNC(cosh(*M1)); 1362 if (!strcmp (op, "asinh")) M_FUNC(asinh(*M1)); 1363 if (!strcmp (op, "acosh")) M_FUNC(acosh(*M1)); 1364 if (!strcmp (op, "lgamma")) M_FUNC(lgamma(*M1)); 1365 if (!strcmp (op, "sin")) M_FUNC(sin(*M1)); 1366 if (!strcmp (op, "cos")) M_FUNC(cos(*M1)); 1367 if (!strcmp (op, "tan")) M_FUNC(tan(*M1)); 1368 if (!strcmp (op, "dsin")) M_FUNC(sin(*M1*RAD_DEG)); 1369 if (!strcmp (op, "dcos")) M_FUNC(cos(*M1*RAD_DEG)); 1370 if (!strcmp (op, "dtan")) M_FUNC(tan(*M1*RAD_DEG)); 1371 if (!strcmp (op, "asin")) M_FUNC(asin(*M1)); 1372 if (!strcmp (op, "acos")) M_FUNC(acos(*M1)); 1373 if (!strcmp (op, "atan")) M_FUNC(atan(*M1)); 1374 if (!strcmp (op, "dasin")) M_FUNC(asin(*M1)*DEG_RAD); 1375 if (!strcmp (op, "dacos")) M_FUNC(acos(*M1)*DEG_RAD); 1376 if (!strcmp (op, "datan")) M_FUNC(atan(*M1)*DEG_RAD); 1377 if (!strcmp (op, "not")) M_FUNC(!(*M1)); 1378 if (!strcmp (op, "--")) M_FUNC(-(*M1)); 1379 if (!strcmp (op, "rnd")) M_FUNC(drand48()); 1380 if (!strcmp (op, "drnd")) M_FUNC(drand48()); 1381 if (!strcmp (op, "lrnd")) M_FUNC(lrand48()); 1382 if (!strcmp (op, "mrnd")) M_FUNC(mrand48()); 1383 if (!strcmp (op, "ramp")) M_FUNC(i); 1384 if (!strcmp (op, "zero")) M_FUNC(0); 1385 if (!strcmp (op, "isinf")) M_FUNC(!finite(*M1)); 1386 if (!strcmp (op, "isnan")) M_FUNC(isnan(*M1)); 1380 1387 1381 1388 /* xrm and yrm only make sense for 2D matrices. see special meaning for vectors */
Note:
See TracChangeset
for help on using the changeset viewer.
