IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 38443


Ignore:
Timestamp:
Jun 12, 2015, 9:26:15 PM (11 years ago)
Author:
eugene
Message:

merge changes from trunk

Location:
branches/eam_branches/ipp-20150419/Ohana/src/opihi
Files:
46 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi

  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/cmd.data

  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/cmd.data/Makefile

    r38282 r38443  
    9292$(SRC)/mget.$(ARCH).o           \
    9393$(SRC)/mget3d.$(ARCH).o         \
     94$(SRC)/mslice.$(ARCH).o         \
    9495$(SRC)/minterpolate.$(ARCH).o   \
    9596$(SRC)/medimage.$(ARCH).o       \
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/cmd.data/cast.c

    r36489 r38443  
    1717  // out type
    1818  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;
    2123  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;
    2230
    2331  if ((ovec = SelectVector (argv[1], ANYVECTOR, TRUE)) == NULL) goto error;
     
    3240    opihi_flt *vo = ovec[0].elements.Flt;
    3341    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      }
    3551    }
    3652    return (TRUE);
     
    4864    opihi_flt *vo = ovec[0].elements.Flt;
    4965    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      }
    5172    }
    5273    return (TRUE);
     
    6687
    6788usage:
    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");
    6991  return (FALSE);
    7092}
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/cmd.data/init.c

    r38282 r38443  
    8282int mget             PROTO((int, char **));
    8383int mget3d           PROTO((int, char **));
     84int mslice           PROTO((int, char **));
    8485int minterp          PROTO((int, char **));
    8586int medimage_command PROTO((int, char **));
     
    250251  {1, "mget",         mget,             "extract a vector from an image"},
    251252  {1, "mget3d",       mget3d,           "extract a vector from a 3D image"},
     253  {1, "mslice",       mslice,           "extract an image plane from a 3D image"},
    252254  {1, "imget",        mget,             "extract a vector from an image"},
    253255  {1, "minterp",      minterp,          "interpolate image pixels"},
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/cmd.data/rd.c

    r38062 r38443  
    99  Buffer *buf;
    1010
     11  int VERBOSE = FALSE;
     12  if ((N = get_argument (argc, argv, "-v"))) {
     13    remove_argument (N, &argc, argv);
     14    VERBOSE = TRUE;
     15  }
     16
    1117  int JustHead = FALSE;
    1218  if ((N = get_argument (argc, argv, "-head"))) {
    1319    remove_argument (N, &argc, argv);
    1420    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;
    1527  }
    1628
     
    8597      return (FALSE);
    8698    }
    87     if (gfits_extension_is_compressed (&buf[0].header)) {
     99    if (gfits_extension_is_compressed_image (&buf[0].header)) {
    88100        IsCompressed = TRUE;
    89101    }
     
    118130      Nword = 1;
    119131      IsCompressed = FALSE;
    120       if (gfits_extension_is_compressed (&buf[0].header)) {
     132      if (gfits_extension_is_compressed_image (&buf[0].header)) {
    121133        if (!strcmp (CCDKeyword, "EXTNAME")) Nword = 1;
    122134        IsCompressed = TRUE;
     
    170182  if (plane >= 0) {
    171183    // 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);
    173185    if (tooFar) {
    174186      gprint (GP_ERR, "-plane is too large: %d total planes\n", Nz);
     
    192204    ftable.header[0].buffer = NULL;
    193205    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
    196211    // uncompressing the image leaves the format as an extension
    197212    gfits_extended_to_primary (&buf[0].header, TRUE, "Standard FITS");
    198213    gfits_free_table (&ftable);
     214
     215    status = TRUE;
    199216    // XXX this currently does not work for a cube (we get a cube back, not a specific plane)
    200217  } else {
     
    233250  buf[0].unsign = buf[0].header.unsign;
    234251
    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]);
    237253
    238254  blank = 0xffff;
    239255  gfits_scan (&buf[0].header, "BLANK", "%d", 1, &blank);
    240256
     257  if (SwapRaw) {
     258    gfits_swap_raw (&buf[0].matrix);
     259  }
     260
    241261  /** now - convert the matrix values to floats for internal use **/
    242262  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  
    11# include "data.h"
     2int dump_raw_table (FTable *table, char *message);
     3int dump_cmp_table (FTable *table, char *message);
    24
    35FILE *f = (FILE *) NULL;
     
    412414  table.header = &header;
    413415
    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) ****/
    415417  if (Nextend > -1) {
    416418    // first extension is PHU, cannot be a table.
     
    429431    }
    430432    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 => 100
    452     // Ny = 100, start = 10, Nrows = 90
    453 
    454     if (!gfits_fread_ftable_range (f, padIfShort, &table, start, Nrows)) ESCAPE ("error reading table for extension %d\n", Nextend);
    455433  } else {
    456434    if (CCDKeyword == NULL) {
     
    460438      CCDKeyword = strcreate ("EXTNAME");
    461439    }
    462 
    463440    while (1) {
    464441      if (!gfits_load_header (f, &header)) {
     
    469446        return (TRUE); 
    470447      }
    471 
    472448      Nbytes = gfits_data_size (&header);
    473449
     
    482458        continue;
    483459      }
    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 
    508460      break;
    509461    }
     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);
    510504  }
    511505
     
    518512  Binary = !strcmp (type, "BINTABLE");
    519513  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  }
    520539
    521540  /* find columns which match requested vectors */
     
    527546    Nval = 0;
    528547    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");
    531550    } 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");
    536555   
    537556    vecType = OPIHI_INT;
    538     if (!strcmp (type, "double") || !strcmp (type, "float")) {
     557    if (!strcmp (type, "double") || !strcmp (type, "float") || !strcmp (type, "int64_t")) {
    539558      vecType = OPIHI_FLT;
    540559    }
     
    570589        else
    571590          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");
    573592        ResetVector (vec[j], vecType, Ny);
    574593      }
    575594
    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);
    577596
    578597    } else {
     
    584603        else
    585604          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");
    587606        ResetVector (vec[j], vecType, Nval);
    588607      }
    589608
    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);
    591610    }
    592611    free (data);
     
    594613  }
    595614  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);
    598617  return (TRUE);
    599618}
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/cmd.data/tv.c

    r38062 r38443  
    7171  int tooBig = buf[0].matrix.Naxis[2] ? (plane >= buf[0].matrix.Naxis[2]) : plane > 0;
    7272  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]);
    7474    return (FALSE);
    7575  }
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/cmd.data/vstats.c

    r35109 r38443  
    121121      goto skip;
    122122    }
     123    // we can hit inf if pmax and pmin are close to the max range
     124    if (isinf(dx)) dx = DBL_MAX / Nbin;
    123125
    124126    ALLOCATE (Nval, int, Nbin + 2);
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/cmd.data/wd.c

    r38062 r38443  
    1818  }
    1919
     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
    2030  outZero = 0;
    2131  newZero = FALSE;
     
    5464    if (outUnsign == -1) {
    5565      gprint (GP_ERR, "-unsign options: t, f, true, false\n");
     66      FREE (CompressMode);
    5667      return (FALSE);
    5768    }
     
    6273  if (argc != 3) {
    6374    gprint (GP_ERR, "USAGE: wd <buffer> <filename> [-bitpix N] [-bscale X] [-bzero X] [-extend] [-newplane]\n");
     75    FREE (CompressMode);
    6476    return (FALSE);
    6577  }
    6678
    67   if ((buf = SelectBuffer (argv[1], OLDBUFFER, TRUE)) == NULL) return (FALSE);
     79  if ((buf = SelectBuffer (argv[1], OLDBUFFER, TRUE)) == NULL) { FREE (CompressMode); return (FALSE); }
    6880
    6981  if (!newBitpix) outBitpix = buf[0].bitpix;
     
    159171    gfits_free_header (&temp_header);
    160172    gfits_free_matrix (&temp_matrix);
     173    FREE (CompressMode);
    161174    return (status);
    162175  }
    163176 
     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
    164215  /* the actual write-to-disk goes here */
    165216  if (!gfits_write_header (argv[2], &temp_header)) {
     
    167218    gfits_free_header (&temp_header);
    168219    gfits_free_matrix (&temp_matrix);
     220    FREE (CompressMode);
    169221    return (FALSE);
    170222  }
     
    174226    gfits_free_header (&temp_header);
    175227    gfits_free_matrix (&temp_matrix);
     228    FREE (CompressMode);
    176229    return (FALSE);
    177230  }
     
    180233  gfits_free_matrix (&temp_matrix);
    181234 
     235  FREE (CompressMode);
    182236  return (TRUE);
    183237}
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/cmd.data/write_vectors.c

    r35109 r38443  
    33int write_vectors (int argc, char **argv) {
    44 
    5   int append;
    65  int i, j, Nvec, Ne, N;
    76  FILE *f;
    87  char **fmtlist, *fmttype;
    9   char *p0, *p1, *p2, *format, *FITS;
     8  char *p0, *p1, *p2, *format;
    109  Vector **vec;
    1110
     
    3433
    3534  /* option generate a FITS output table */
    36   FITS = NULL;
     35  char *FITS = NULL;
    3736  if ((N = get_argument (argc, argv, "-fits"))) {
    3837    remove_argument (N, &argc, argv);
     
    5857  }
    5958
    60   append = FALSE;
     59  int append = FALSE;
    6160  if ((N = get_argument (argc, argv, "-append"))) {
    6261    remove_argument (N, &argc, argv);
    6362    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    }
    6476  }
    6577
     
    105117
    106118  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);
    108120    free (vec);
    109121    return status;
     
    243255    gprint (GP_ERR, "  -csv : write a comma-separated values file (eg, to read in excel)\n");
    244256    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");
    246258    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");
    249261    gprint (GP_ERR, "    FITS : format consists of the following FITS binary table format codes:\n");
    250262    gprint (GP_ERR, "      B : 1 byte int\n");   
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/avextract.c

    r38062 r38443  
    185185    snprintf (hostfile, 1024, "%s/%s.cpt", HOSTDIR, skylist[0].regions[i]->name);
    186186    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;
    191191    catalog.Nsecfilt = 0;
    192192
     
    256256  // write vectors to a table (this is used by parallel dvo operations, but can be used elsewhere)
    257257  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);
    259259    if (!status) {
    260260      goto escape;
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/avmatch.c

    r37807 r38443  
    115115
    116116      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);
    118118      if (!status) goto escape;
    119119    }
     
    190190    snprintf (hostfile, 1024, "%s/%s.cpt", HOSTDIR, skylist[0].regions[i]->name);
    191191    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;
    196196    catalog.Nsecfilt = 0;
    197197
     
    302302      vec[i][0].Nelements = Nfound;
    303303    }
    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);
    305305    free (vec[Nfields]->elements.Int);
    306306    free (vec[Nfields]);
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/calextract.c

    r34088 r38443  
    6161    /* lock, load, unlock catalog */
    6262    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;
    6464    catalog.Nsecfilt = 0;
    6565
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/calmextract.c

    r34088 r38443  
    7474    /* lock, load, unlock catalog */
    7575    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;
    7777    catalog.Nsecfilt = 0;
    7878
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/catalog.c

    r19823 r38443  
    315315      /* lock, load, unlock catalog */
    316316      catalog.filename = filename;
    317       catalog.catflags = LOAD_AVES;
     317      catalog.catflags = DVO_LOAD_AVERAGE;
    318318
    319319      // an error exit status here is a significant error
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/ccd.c

    r34088 r38443  
    6969    /* lock, load, unlock catalog */
    7070    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;
    7272    catalog.Nsecfilt = 0;
    7373
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/cmatch.c

    r28241 r38443  
    2929  /* load data from the photometry database file */
    3030  catalog1.filename = filename;
    31   catalog1.catflags = LOAD_AVES | LOAD_MEAS | LOAD_SECF;
     31  catalog1.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_SECFILT;
    3232
    3333  // an error exit status here is a significant error
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/cmd.c

    r34088 r38443  
    6868    /* lock, load, unlock catalog */
    6969    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;
    7171    catalog.Nsecfilt = 0;
    7272
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/cmpReadFile.c

    r29001 r38443  
    1919  if (!gfits_fread_ftable (f, &table, "SMPFILE")) goto escape;
    2020
    21   smpdata = gfits_table_get_SMPData (&table, &Nstars, NULL);
     21  smpdata = gfits_table_get_SMPData (&table, &Nstars, NULL, NULL);
    2222  if (!smpdata) {
    2323    fprintf (stderr, "ERROR: failed to read stars\n");
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/ddmags.c

    r15509 r38443  
    6666    /* lock, load, unlock catalog */
    6767    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;
    6969    catalog.Nsecfilt = 0;
    7070
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/dmagaves.c

    r14401 r38443  
    5858    /* lock, load, unlock catalog */
    5959    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;
    6161    catalog.Nsecfilt = 0;
    6262
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/dmagmeas.c

    r15509 r38443  
    6666    /* lock, load, unlock catalog */
    6767    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;
    6969    catalog.Nsecfilt = 0;
    7070
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/dmags.c

    r15509 r38443  
    6464    /* lock, load, unlock catalog */
    6565    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;
    6767    catalog.Nsecfilt = 0;
    6868
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/dmt.c

    r31635 r38443  
    7777    /* lock, load, unlock catalog */
    7878    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;
    8080    catalog.Nsecfilt = 0;
    8181
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/dvo_host_utils.c

    r37807 r38443  
    230230  // write vectors to a table (this is used by parallel dvo operations, but can be used elsewhere)
    231231  if (ResultFile) {
    232     int status = WriteVectorTableFITS (ResultFile, "RESULT", vec, Nvec, FALSE, NULL);
     232    int status = WriteVectorTableFITS (ResultFile, "RESULT", vec, Nvec, FALSE, FALSE, NULL);
    233233    if (!status) {
    234234      gprint (GP_ERR, "failed to write result file %s\n", ResultFile);
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/extract.c

    r31635 r38443  
    252252      catalog.measure = (Measure *) NULL;
    253253      catalog.secfilt = (SecFilt *) NULL;
    254       loadmode = LOAD_AVES | LOAD_SECF;
     254      loadmode = DVO_LOAD_AVERAGE | DVO_LOAD_SECFILT;
    255255      if ((mode == REF) || (mode == TYPE) || (mode == NPHOT) || (mode == NCODE))
    256         loadmode = loadmode | LOAD_MEAS;
     256        loadmode = loadmode | DVO_LOAD_MEASURE;
    257257
    258258      /* lock, load, unlock catalog */
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/fitcolors.c

    r34584 r38443  
    162162    /* lock, load, unlock catalog */
    163163    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;
    165165    catalog[k].Nsecfilt = 0;
    166166
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/fitsed.c

    r37049 r38443  
    188188    /* lock, load, unlock catalog */
    189189    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;
    191191    catalog.Nsecfilt = 0;
    192192
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/gstar.c

    r38436 r38443  
    254254
    255255  /* 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;
    258258  catalog.Nsecfilt = 0;
    259259
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/imdata.c

    r37807 r38443  
    136136    /* get file name and open */
    137137    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;
    139139    catalog.Nsecfilt = 0;
    140140
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/lcurve.c

    r37049 r38443  
    7676  /* set filename, read in header */
    7777  catalog.filename = skylist[0].filename[0];
    78   catalog.catflags = LOAD_AVES | LOAD_MEAS;
     78  catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE;
    7979  catalog.Nsecfilt = 0;
    8080
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/lightcurve.c

    r37049 r38443  
    5959  /* set filename, read in header */
    6060  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;
    6262  catalog.Nsecfilt = 0;
    6363
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/mextract.c

    r37807 r38443  
    1919    return FALSE;
    2020}
     21
     22void gfits_uncompress_timing ();
    2123
    2224int mextract (int argc, char **argv) {
     
    229231    snprintf (hostfile, 1024, "%s/%s.cpt", HOSTDIR, skylist[0].regions[i]->name);
    230232    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;
    234236    catalog.Nsecfilt = Nsecfilt;
    235237
     
    317319  // write vectors to a table (this is used by parallel dvo operations, but can be used elsewhere)
    318320  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);
    320322    if (!status) goto escape;
    321323  }
     
    330332  SkyListFree (skylist);
    331333  FreeSkyRegionSelection (selection);
     334
     335  gfits_uncompress_timing();
    332336
    333337  // fprintf (stderr, "done extr...\n");
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/mmatch.c

    r37807 r38443  
    150150      // XXX this is now set for both cases...
    151151      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);
    153153      if (!status) goto escape;
    154154    }
     
    248248    snprintf (hostfile, 1024, "%s/%s.cpt", HOSTDIR, skylist[0].regions[i]->name);
    249249    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;
    252252    catalog.Nsecfilt = Nsecfilt;
    253253
     
    349349      vec[Nfields-1] = IDXvec;
    350350    }
    351     int status = WriteVectorTableFITS (RESULT_FILE, "RESULT", vec, Nfields, FALSE, NULL);
     351    int status = WriteVectorTableFITS (RESULT_FILE, "RESULT", vec, Nfields, FALSE, FALSE, NULL);
    352352    if (!status) goto escape;
    353353  }
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/mmextract.c

    r37807 r38443  
    183183    /* lock, load, unlock catalog */
    184184    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;
    186186    catalog.Nsecfilt = Nsecfilt;
    187187
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/objectcoverage.c

    r37807 r38443  
    184184    /* lock, load, unlock catalog */
    185185    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;
    187187    catalog.Nsecfilt = 0;
    188188
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/paverage.c

    r34088 r38443  
    105105  for (j = 0; (j < skylist[0].Nregions) && !interrupt; j++) {
    106106    catalog.filename = skylist[0].filename[j];
    107     catalog.catflags = LOAD_AVES | LOAD_SECF;
     107    catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_SECFILT;
    108108    catalog.Nsecfilt = Nsecfilt;
    109109
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/pmeasure.c

    r37049 r38443  
    178178  for (j = 0; (j < skylist[0].Nregions) && !interrupt; j++) {
    179179    catalog.filename = skylist[0].filename[j];
    180     catalog.catflags = LOAD_AVES | LOAD_MEAS;
     180    catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE;
    181181    catalog.Nsecfilt = 0;
    182182
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/dvo/subpix.c

    r37807 r38443  
    4040  /* lock, load, unlock catalog */
    4141  catalog.filename = skylist[0].filename[0];
    42   catalog.catflags = LOAD_AVES | LOAD_MEAS;
     42  catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE;
    4343  catalog.Nsecfilt = 0;
    4444
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/include/dvomath.h

    r38062 r38443  
    167167
    168168/* vector IO functions */
    169 int           WriteVectorTableFITS  PROTO((char *filename, char *extname, Vector **vec, int Nvec, int append, char *format));
     169int           WriteVectorTableFITS  PROTO((char *filename, char *extname, Vector **vec, int Nvec, int append, char *compress, char *format));
    170170Vector      **ReadVectorTableFITS   PROTO((char *filename, char *extname, int *Nvec));
    171171
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/lib.data/SplineOps.c

    r34584 r38443  
    178178  gfits_create_table (&theader, &ftable);
    179179
    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);
    183184
    184185  if (!append) {
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/lib.shell/VectorIO.c

    r37049 r38443  
    11# include "opihi.h"
    22 
    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)
     4static int WriteVectorTable (FTable *ftable, char *extname, Vector **vec, int Nvec, char *format, char nativeOrder) {
    55 
    66  int j;
     
    88  char *tformat = NULL;
    99
     10  Header *theader = ftable->header;
    1011  gfits_create_table_header (theader, "BINTABLE", extname);
    1112
     
    5859  for (j = 0; j < Nvec; j++) {
    5960    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);
    6162    } 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);
    6364    }
    6465  }
     
    7071}
    7172 
     73# define VERBOSE 0
     74int 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
     86int 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
    72104// 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;
     105int 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;
    79111
    80112  FILE *f = NULL;
     
    91123  }
    92124
    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  }
    94154
    95155  if (!append) {
     156    Header header;
     157    Matrix matrix;
    96158    gfits_init_header (&header);
     159    gfits_init_matrix (&matrix);
    97160    header.extend = TRUE;
    98161    gfits_create_header (&header);
     
    103166    gfits_free_matrix (&matrix);
    104167  }
    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  }
    110180
    111181  fclose (f);
     
    114184
    115185 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  }
    122193
    123194  fclose (f);
     
    249320  ASSIGN_DATA(short,   short,   Int);
    250321  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
    252323  ASSIGN_DATA(float,   float,   Flt);
    253324  ASSIGN_DATA(double,  double,  Flt);
     
    274345  ASSIGN_DATA_TRANSPOSE(short,   short,   Int);
    275346  ASSIGN_DATA_TRANSPOSE(int,     int,     Int);
    276   ASSIGN_DATA_TRANSPOSE(int64_t, int64_t, Int);
     347  ASSIGN_DATA_TRANSPOSE(int64_t, int64_t, Flt);
    277348  ASSIGN_DATA_TRANSPOSE(float,   float,   Flt);
    278349  ASSIGN_DATA_TRANSPOSE(double,  double,  Flt);
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/lib.shell/convert_to_RPN.c

    r38062 r38443  
    5858    if (!strcmp (argv[i], "lgamma")) { type = ST_UNARY; goto gotit; }
    5959    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; }
    6063    if (!strcmp (argv[i], "xramp"))  { type = ST_UNARY; goto gotit; }
    6164    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  
    115115
    116116        /* 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);
    118119        clear_stack (&tmp_stack);
    119120        return (FALSE);
     
    210211
    211212        /* 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);
    213215        clear_stack (&tmp_stack);
    214216        return (FALSE);
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/lib.shell/stack_math.c

    r38062 r38443  
    1212  // set up the possible operations : int OP int -> int, all else yield float
    1313  // OP is the operation performed on *M1 and *M2
    14 # define SSS_FUNC(OP) {                                         \
     14# define SSS_FUNC(OP) {                                                 \
    1515    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;                                             \
    2121      break;                                                            \
    2222    }                                                                   \
    2323    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;                                             \
    2929      break;                                                            \
    3030    }                                                                   \
     
    3232
    3333  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}
    4040# undef SSS_FUNC
    4141
     
    6868  // set up the possible operations : int OP int -> int, all else yield float
    6969  // OP is the operation performed on *M1 and *M2
    70 # define VVV_FUNC(OP) {                                         \
     70# define VVV_FUNC(OP) {                                                 \
    7171    if ((V1->vector->type == OPIHI_FLT) && (V2->vector->type == OPIHI_FLT) && (V3->vector->type == OPIHI_FLT)) { \
    7272      CopyVector (OUT[0].vector, V1[0].vector);                         \
     
    394394  // OP is the operation performed on *M1 and *M2
    395395# 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)) { \
    397397      CopyVector (OUT[0].vector, V2[0].vector);                         \
    398398      opihi_flt  M1  =  V1[0].FltValue;                                 \
     
    404404      break;                                                            \
    405405    }                                                                   \
    406     if ((V1->type == ST_SCALAR_FLT) && (V2->vector->type != OPIHI_FLT)) {               \
     406    if ((V1->type == ST_SCALAR_FLT) && (V2->vector->type != OPIHI_FLT)) { \
    407407      MatchVector (OUT[0].vector, V2[0].vector, OPIHI_FLT);             \
    408408      opihi_flt  M1  =  V1[0].FltValue;                                 \
     
    414414      break;                                                            \
    415415    }                                                                   \
    416     if ((V1->type == ST_SCALAR_INT) && (V2->vector->type == OPIHI_FLT)) {               \
     416    if ((V1->type == ST_SCALAR_INT) && (V2->vector->type == OPIHI_FLT)) { \
    417417      CopyVector (OUT[0].vector, V2[0].vector);                         \
    418418      opihi_int  M1  =  V1[0].IntValue;                                 \
     
    434434      break;                                                            \
    435435    }                                                                   \
    436     if ((V1->type == ST_SCALAR_INT) && (V2->vector->type != OPIHI_FLT)) {               \
     436    if ((V1->type == ST_SCALAR_INT) && (V2->vector->type != OPIHI_FLT)) { \
    437437      CopyVector (OUT[0].vector, V2[0].vector);                         \
    438438      opihi_int  M1  =  V1[0].IntValue;                                 \
     
    447447
    448448  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}
    474474# undef SV_FUNC
    475475
    476476  /** free up any temporary buffers: **/
    477477  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}
    481481
    482482  clear_stack (V1);
     
    501501  // OP is the operation performed on *M1 and *M2
    502502# 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)) { \
    504504      CopyVector (OUT[0].vector, V1[0].vector);                         \
    505505      opihi_flt *M1  =  V1[0].vector[0].elements.Flt;                   \
     
    511511      break;                                                            \
    512512    }                                                                   \
    513     if ((V2->type == ST_SCALAR_FLT) && (V1->vector->type != OPIHI_FLT)) {               \
     513    if ((V2->type == ST_SCALAR_FLT) && (V1->vector->type != OPIHI_FLT)) { \
    514514      MatchVector (OUT[0].vector, V1[0].vector, OPIHI_FLT);             \
    515515      opihi_int *M1  =  V1[0].vector[0].elements.Int;                   \
     
    521521      break;                                                            \
    522522    }                                                                   \
    523     if ((V2->type == ST_SCALAR_INT) && (V1->vector->type == OPIHI_FLT)) {               \
     523    if ((V2->type == ST_SCALAR_INT) && (V1->vector->type == OPIHI_FLT)) { \
    524524      CopyVector (OUT[0].vector, V1[0].vector);                         \
    525525      opihi_flt *M1  =  V1[0].vector[0].elements.Flt;                   \
     
    541541      break;                                                            \
    542542    }                                                                   \
    543     if ((V2->type == ST_SCALAR_INT) && (V1->vector->type != OPIHI_FLT)) {               \
     543    if ((V2->type == ST_SCALAR_INT) && (V1->vector->type != OPIHI_FLT)) { \
    544544      CopyVector (OUT[0].vector, V1[0].vector);                         \
    545545      opihi_int *M1  =  V1[0].vector[0].elements.Int;                   \
     
    554554
    555555  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}
    581581# undef VS_FUNC
    582582
     
    584584
    585585  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}
    589589
    590590  clear_stack (V1);
     
    885885  float *out   = (float *)OUT[0].buffer[0].matrix.buffer;
    886886
    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;            \
    890890      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;            \
    897897      for (i = 0; i < Npix; i++, out++, M1++) { \
    898         *out = OP;                                      \
    899       }                                                 \
    900       break;                                            \
    901     }                                                   \
     898        *out = OP;                              \
     899      }                                         \
     900      break;                                    \
     901    }                                           \
    902902  }
    903903
     
    961961  float *out   = (float *)OUT[0].buffer[0].matrix.buffer;
    962962
    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;            \
    966966      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;            \
    973973      for (i = 0; i < Npix; i++, out++, M2++) { \
    974         *out = OP;                                      \
    975       }                                                 \
    976       break;                                            \
    977     }                                                   \
     974        *out = OP;                              \
     975      }                                         \
     976      break;                                    \
     977    }                                           \
    978978  }
    979979
     
    10231023
    10241024# 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)) {   \
    10261026      opihi_flt M1 = V1[0].FltValue;                                    \
    10271027      opihi_flt M2 = V2[0].FltValue;                                    \
    1028       OUT[0].type = ST_SCALAR_FLT;                                              \
     1028      OUT[0].type = ST_SCALAR_FLT;                                      \
    10291029      OUT[0].FltValue = OP;                                             \
    10301030      break;                                                            \
    10311031    }                                                                   \
    1032     if ((V1->type == ST_SCALAR_FLT) && (V2->type == ST_SCALAR_INT)) {                   \
     1032    if ((V1->type == ST_SCALAR_FLT) && (V2->type == ST_SCALAR_INT)) {   \
    10331033      opihi_flt M1 = V1[0].FltValue;                                    \
    10341034      opihi_int M2 = V2[0].IntValue;                                    \
    1035       OUT[0].type = ST_SCALAR_FLT;                                              \
     1035      OUT[0].type = ST_SCALAR_FLT;                                      \
    10361036      OUT[0].FltValue = OP;                                             \
    10371037      break;                                                            \
    10381038    }                                                                   \
    1039     if ((V1->type == ST_SCALAR_INT) && (V2->type == ST_SCALAR_FLT)) {                   \
     1039    if ((V1->type == ST_SCALAR_INT) && (V2->type == ST_SCALAR_FLT)) {   \
    10401040      opihi_int M1 = V1[0].IntValue;                                    \
    10411041      opihi_flt M2 = V2[0].FltValue;                                    \
    1042       OUT[0].type = ST_SCALAR_FLT;                                              \
     1042      OUT[0].type = ST_SCALAR_FLT;                                      \
    10431043      OUT[0].FltValue = OP;                                             \
    10441044      break;                                                            \
    10451045    }                                                                   \
    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)) { \
    10471047      opihi_int M1 = V1[0].IntValue;                                    \
    10481048      opihi_int M2 = V2[0].IntValue;                                    \
    1049       OUT[0].type = ST_SCALAR_FLT;                                              \
     1049      OUT[0].type = ST_SCALAR_FLT;                                      \
    10501050      OUT[0].FltValue = OP;                                             \
    10511051      break;                                                            \
    10521052    }                                                                   \
    1053     if ((V1->type == ST_SCALAR_INT) && (V2->type == ST_SCALAR_INT)) {                   \
     1053    if ((V1->type == ST_SCALAR_INT) && (V2->type == ST_SCALAR_INT)) {   \
    10541054      opihi_int M1 = V1[0].IntValue;                                    \
    10551055      opihi_int M2 = V2[0].IntValue;                                    \
    1056       OUT[0].type = ST_SCALAR_INT;                                              \
     1056      OUT[0].type = ST_SCALAR_INT;                                      \
    10571057      OUT[0].IntValue = OP;                                             \
    10581058      break;                                                            \
     
    10611061
    10621062  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}
    10881088# undef SS_FUNC
    10891089
     
    11531153}
    11541154
    1155 
    11561155int S_unary (StackVar *OUT, StackVar *V1, char *op) {
    11571156
    11581157  char line[512]; // this is only used to report an error
    11591158 
    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    }                                                                   \
    11681167    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    }                                                                   \
    11751174    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    }                                                                   \
    11821181  }
    11831182
     
    12111210  if (!strcmp (op, "dacos"))  S_FUNC(acos (M1)*DEG_RAD, ST_SCALAR_FLT);
    12121211  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);
    12141216  if (!strcmp (op, "not"))    S_FUNC(!(M1), ST_SCALAR_INT);
    12151217  if (!strcmp (op, "--"))     S_FUNC(-1*M1, ST_SCALAR_INT); // NOTE: opihi_int is signed,
     
    12351237  OUT[0].type = ST_VECTOR_TMP; /*** <<--- says this is a temporary matrix ***/
    12361238
    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    }                                                                   \
    12471249    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    }                                                                   \
    12561258    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;                                                      \
    12641266    } }                                                 
    12651267
     
    12941296  if (!strcmp (op, "datan"))  V_FUNC(atan(*M1)*DEG_RAD, ST_SCALAR_FLT);
    12951297  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);
    12961301  if (!strcmp (op, "ramp"))   V_FUNC(i, ST_SCALAR_INT);
    12971302  if (!strcmp (op, "zero"))   V_FUNC(0, ST_SCALAR_INT);
     
    13201325}
    13211326
     1327# define M_FUNC(OP) { for (i = 0; i < Npix; i++, out++, M1++) { *out = (OP); }}
     1328
    13221329int M_unary (StackVar *OUT, StackVar *V1, char *op) {
    13231330
     
    13371344  M1  = (float *) V1[0].buffer[0].matrix.buffer;
    13381345  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 
    13401349  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));
    13801387
    13811388  /* xrm and yrm only make sense for 2D matrices. see special meaning for vectors */
Note: See TracChangeset for help on using the changeset viewer.