Changeset 38341
- Timestamp:
- May 31, 2015, 8:36:04 AM (11 years ago)
- Location:
- branches/eam_branches/ohana.20150429/src/opihi
- Files:
-
- 5 edited
-
cmd.data/read_vectors.c (modified) (7 diffs)
-
cmd.data/wd.c (modified) (4 diffs)
-
lib.shell/VectorIO.c (modified) (2 diffs)
-
lib.shell/convert_to_RPN.c (modified) (1 diff)
-
lib.shell/stack_math.c (modified) (24 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ohana.20150429/src/opihi/cmd.data/read_vectors.c
r38340 r38341 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 int IsCompressed = FALSE; 415 416 /* 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) ****/ 417 417 if (Nextend > -1) { 418 418 // first extension is PHU, cannot be a table. … … 431 431 } 432 432 if (!gfits_load_header (f, &header)) ESCAPE ("error reading header for extension %d\n", Nextend); 433 434 IsCompressed = gfits_extension_is_compressed_table (&header);435 436 if (getSizes && !IsCompressed) {437 read_table_sizes (&header);438 if (CCDKeyword != NULL) free (CCDKeyword);439 gfits_free_header (&header);440 return TRUE;441 }442 if (IsCompressed) {443 if (getSizes) {444 gprint (GP_ERR, "%s[%s] is compressed: -sizes is invalid\n", filename, extname);445 gfits_free_header (&header);446 return FALSE;447 }448 if ((start > 0) || (Nrows > -1)) {449 gprint (GP_ERR, "%s[%s] is compressed: must read entire table\n", filename, extname);450 gfits_free_header (&header);451 return FALSE;452 }453 }454 455 if (Nrows == -1) {456 Nrows = header.Naxis[1] - start;457 }458 if (start < 0) ESCAPE ("invalid range: start < 0\n");459 if (start >= header.Naxis[1]) ESCAPE ("invalid range: start >= Ny (%d)\n", header.Naxis[1]);460 if (Nrows < 0) ESCAPE ("invalid range: Nrows < 0\n");461 462 // just a warning:463 if (start + Nrows > header.Naxis[1]) {464 if (VERBOSE) gprint (GP_ERR, "NOTE: reading last block will return only %d rows\n", header.Naxis[1] - start);465 }466 467 // Ny = 100, start = 0, Nrows = -1 -> Nrows => 100468 // Ny = 100, start = 10, Nrows = 90469 470 if (!gfits_fread_ftable_range (f, padIfShort, &table, start, Nrows)) ESCAPE ("error reading table for extension %d\n", Nextend);471 433 } else { 472 434 if (CCDKeyword == NULL) { … … 476 438 CCDKeyword = strcreate ("EXTNAME"); 477 439 } 478 479 440 while (1) { 480 441 if (!gfits_load_header (f, &header)) { … … 485 446 return (TRUE); 486 447 } 487 488 448 Nbytes = gfits_data_size (&header); 489 449 … … 498 458 continue; 499 459 } 500 501 IsCompressed = gfits_extension_is_compressed_table (&header);502 503 if (getSizes && !IsCompressed) {504 read_table_sizes (&header);505 if (CCDKeyword != NULL) free (CCDKeyword);506 gfits_free_header (&header);507 return TRUE;508 }509 if (IsCompressed) {510 if (getSizes) {511 gprint (GP_ERR, "%s[%s] is compressed: -sizes is invalid\n", filename, extname);512 gfits_free_header (&header);513 return FALSE;514 }515 if ((start > 0) || (Nrows > -1)) {516 gprint (GP_ERR, "%s[%s] is compressed: must read entire table\n", filename, extname);517 gfits_free_header (&header);518 return FALSE;519 }520 }521 522 if (Nrows == -1) {523 Nrows = header.Naxis[1] - start;524 }525 if (start < 0) ESCAPE ("invalid range: start < 0\n");526 if (start >= header.Naxis[1]) ESCAPE ("invalid range: start >= Ny (%d)\n", header.Naxis[1]);527 if (Nrows < 0) ESCAPE ("invalid range: Nrows < 0\n");528 529 // just a warning:530 if (start + Nrows > header.Naxis[1]) {531 if (VERBOSE) gprint (GP_ERR, "NOTE: reading last block will return only %d rows\n", header.Naxis[1] - start);532 }533 534 if (!gfits_fread_ftable_range (f, padIfShort, &table, start, Nrows)) ESCAPE ("error reading table for extension %d\n", Nextend);535 460 break; 536 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 (%d)\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 %d 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); 537 504 } 538 505 … … 553 520 if (IsCompressed) { 554 521 rawtable.header = &rawheader; 522 523 dump_cmp_table (&table, "rd cmp"); 555 524 if (!gfits_uncompress_table (&table, &rawtable)) ESCAPE ("failed to uncompress table"); 525 dump_raw_table (&rawtable, "rd raw"); 526 556 527 outheader = &rawheader; 557 528 outtable = &rawtable; -
branches/eam_branches/ohana.20150429/src/opihi/cmd.data/wd.c
r38340 r38341 3 3 int wd (int argc, char **argv) { 4 4 5 int N, Extend , Compress;5 int N, Extend; 6 6 int newUnsign, newBitpix, newScale, newZero; 7 7 int outUnsign, outBitpix; … … 18 18 } 19 19 20 Compress = FALSE;21 if ((N = get_argument (argc, argv, "-compress"))) {22 remove_argument (N, &argc, argv);23 Compress = TRUE;24 }25 26 20 char *CompressMode = NULL; 27 21 if ((N = get_argument (argc, argv, "-compress-mode"))) { … … 29 23 CompressMode = strcreate(argv[N]); 30 24 remove_argument (N, &argc, argv); 31 } 32 if (!CompressMode) CompressMode = strcreate("GZIP_1"); 25 } else if ((N = get_argument (argc, argv, "-compress"))) { 26 remove_argument (N, &argc, argv); 27 CompressMode = strcreate("GZIP_1"); 28 } 33 29 34 30 outZero = 0; … … 180 176 181 177 // not compatible with extend 182 if (Compress ) {178 if (CompressMode) { 183 179 Header myHeader; 184 180 Matrix myMatrix; -
branches/eam_branches/ohana.20150429/src/opihi/lib.shell/VectorIO.c
r38340 r38341 71 71 } 72 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 73 104 // write a set of vectors to a FITS file (vectors names become fits column names) 74 105 int WriteVectorTableFITS (char *filename, char *extname, Vector **vec, int Nvec, int append, char *compress, char *format) { … … 106 137 if (compress) { 107 138 cmptable.header = &cmpheader; 139 140 dump_raw_table (&rawtable, "wd raw"); 108 141 if (!gfits_compress_table (&rawtable, &cmptable, 10, compress)) goto escape; 142 dump_cmp_table (&cmptable, "wd cmp"); 143 109 144 outtable = &cmptable; 110 145 outheader = &cmpheader; -
branches/eam_branches/ohana.20150429/src/opihi/lib.shell/convert_to_RPN.c
r38062 r38341 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/ohana.20150429/src/opihi/lib.shell/stack_math.c
r38062 r38341 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.
