Changeset 12431
- Timestamp:
- Mar 13, 2007, 2:39:51 PM (19 years ago)
- Location:
- trunk/psLib
- Files:
-
- 34 edited
-
src/db/psDB.c (modified) (6 diffs)
-
src/fits/psFits.c (modified) (2 diffs)
-
src/fits/psFitsTable.c (modified) (2 diffs)
-
src/imageops/psImageGeomManip.c (modified) (15 diffs)
-
src/imageops/psImageGeomManip.h (modified) (9 diffs)
-
src/imageops/psImageMaskOps.c (modified) (2 diffs)
-
src/imageops/psImagePixelExtract.c (modified) (5 diffs)
-
src/imageops/psImagePixelManip.c (modified) (7 diffs)
-
src/imageops/psImagePixelManip.h (modified) (4 diffs)
-
src/imageops/psImageStats.c (modified) (2 diffs)
-
src/imageops/psImageStructManip.c (modified) (3 diffs)
-
src/imageops/psImageStructManip.h (modified) (2 diffs)
-
src/math/psBinaryOp.c (modified) (3 diffs)
-
src/math/psUnaryOp.c (modified) (5 diffs)
-
src/mathtypes/psImage.c (modified) (21 diffs)
-
src/mathtypes/psImage.h (modified) (9 diffs)
-
src/mathtypes/psScalar.c (modified) (4 diffs)
-
src/mathtypes/psScalar.h (modified) (5 diffs)
-
src/mathtypes/psVector.c (modified) (12 diffs)
-
src/mathtypes/psVector.h (modified) (5 diffs)
-
src/sys/psType.h (modified) (9 diffs)
-
test/imageops/tap_psImageGeomManip.c (modified) (2 diffs)
-
test/imageops/tap_psImageInterpolate.c (modified) (2 diffs)
-
test/imageops/tap_psImagePixelManip.c (modified) (7 diffs)
-
test/math/tap_psMatrix02.c (modified) (3 diffs)
-
test/math/tap_psMatrixVectorArithmetic01.c (modified) (10 diffs)
-
test/math/tap_psMatrixVectorArithmetic02.c (modified) (35 diffs)
-
test/math/tap_psMatrixVectorArithmetic03.c (modified) (4 diffs)
-
test/mathtypes/tap_psImage.c (modified) (3 diffs)
-
test/mathtypes/tap_psScalar.c (modified) (3 diffs)
-
test/mathtypes/tap_psVector.c (modified) (3 diffs)
-
test/sys/tap_psMemory.c (modified) (2 diffs)
-
test/types/tap_psMetadataConfigFormat.c (modified) (1 diff)
-
test/types/tap_psMetadata_printing.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/db/psDB.c
r12394 r12431 12 12 * @author Joshua Hoblitt 13 13 * 14 * @version $Revision: 1.1 39$ $Name: not supported by cvs2svn $15 * @date $Date: 2007-03-1 0 01:24:40 $14 * @version $Revision: 1.140 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2007-03-14 00:39:50 $ 16 16 * 17 17 * Copyright (C) 2005-2006 Joshua Hoblitt, University of Hawaii … … 504 504 case PS_DATA_F64: 505 505 PS_STR_ARRAY_TO_PTYPE(column->data.F64, stringColumn, atof, psF64, PS_DATA_F64); 506 break;507 case PS_TYPE_C32:508 // this is a bogus SQL type509 PS_STR_ARRAY_TO_PTYPE(column->data.C32, stringColumn, atof, psC32, PS_TYPE_C32);510 break;511 case PS_TYPE_C64:512 // this is a bogus SQL type513 PS_STR_ARRAY_TO_PTYPE(column->data.C64, stringColumn, atof, psC64, PS_TYPE_C64);514 506 break; 515 507 case PS_DATA_BOOL: … … 2189 2181 psDBAddToLookupTable(pTypeToSQLlookupTable, PS_DATA_F32, "FLOAT"); 2190 2182 psDBAddToLookupTable(pTypeToSQLlookupTable, PS_DATA_F64, "DOUBLE"); 2191 psDBAddToLookupTable(pTypeToSQLlookupTable, PS_TYPE_C32, "PS_TYPE_C32 is not supported");2192 psDBAddToLookupTable(pTypeToSQLlookupTable, PS_TYPE_C64, "PS_TYPE_C64 is not supported");2193 2183 // XXX Since BOOL is added after S8 all "TINYINT" data will appear in 2194 2184 // the database as boolean data. There does not seem to be any way to … … 2336 2326 psDBAddVoidToLookupTable(pTypeToMysqlLookupTable, PS_DATA_F32, psDBMySQLTypeAlloc(MYSQL_TYPE_FLOAT, false)); 2337 2327 psDBAddVoidToLookupTable(pTypeToMysqlLookupTable, PS_DATA_F64, psDBMySQLTypeAlloc(MYSQL_TYPE_DOUBLE, false)); 2338 // bogus type2339 psDBAddVoidToLookupTable(pTypeToMysqlLookupTable, PS_TYPE_C32, psDBMySQLTypeAlloc(MYSQL_TYPE_VAR_STRING, false));2340 // bogus type2341 psDBAddVoidToLookupTable(pTypeToMysqlLookupTable, PS_TYPE_C64, psDBMySQLTypeAlloc(MYSQL_TYPE_VAR_STRING, false));2342 2328 psDBAddVoidToLookupTable(pTypeToMysqlLookupTable, PS_DATA_BOOL, psDBMySQLTypeAlloc(MYSQL_TYPE_TINY, true)); 2343 2329 // XXX: removed PS_DATA_PTR, can this be removed too? … … 2468 2454 PS_NAN_ALLOC(myNaN, psF64, NAN); 2469 2455 break; 2470 case PS_TYPE_C32:2471 // this is a bogus SQL type2472 PS_NAN_ALLOC(myNaN, psC32, NAN);2473 break;2474 case PS_TYPE_C64:2475 // this is a bogus SQL type2476 PS_NAN_ALLOC(myNaN, psC64, NAN);2477 break;2478 2456 case PS_DATA_BOOL: 2479 2457 // XXX: what is NaN for a bool? … … 2522 2500 case PS_DATA_F64: 2523 2501 isNaN = PS_IS_NAN(psF64, data, NAN); 2524 break;2525 case PS_TYPE_C32:2526 // this is a bogus SQL type2527 isNaN = PS_IS_NAN(psC32, data, NAN);2528 break;2529 case PS_TYPE_C64:2530 // this is a bogus SQL type2531 isNaN = PS_IS_NAN(psC64, data, NAN);2532 2502 break; 2533 2503 case PS_DATA_BOOL: -
trunk/psLib/src/fits/psFits.c
r11998 r12431 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1.6 1$ $Name: not supported by cvs2svn $10 * @date $Date: 2007-0 2-22 21:47:29$9 * @version $Revision: 1.62 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2007-03-14 00:39:50 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 524 524 case TDOUBLE: 525 525 return PS_TYPE_F64; 526 case TCOMPLEX:527 return PS_TYPE_C32;528 case TDBLCOMPLEX:529 return PS_TYPE_C64;530 526 case TLOGICAL: 531 527 return PS_TYPE_BOOL; -
trunk/psLib/src/fits/psFitsTable.c
r11686 r12431 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1.2 5$ $Name: not supported by cvs2svn $10 * @date $Date: 2007-0 2-07 23:52:53$9 * @version $Revision: 1.26 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2007-03-14 00:39:50 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 447 447 case PS_TYPE_F64: 448 448 return 'D'; 449 case PS_TYPE_C32:450 return 'C';451 case PS_TYPE_C64:452 return 'M';453 449 case PS_TYPE_BOOL: 454 450 return 'L'; -
trunk/psLib/src/imageops/psImageGeomManip.c
r12330 r12431 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1.3 7$ $Name: not supported by cvs2svn $13 * @date $Date: 2007-03- 08 22:12:56$12 * @version $Revision: 1.38 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2007-03-14 00:39:50 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 20 20 #endif 21 21 22 #include <complex.h>23 22 #include <math.h> // for isfinite(), etc. 24 23 #include <stdlib.h> … … 158 157 PS_IMAGE_REBIN_CASE(F32); 159 158 PS_IMAGE_REBIN_CASE(F64); 160 // PS_IMAGE_REBIN_CASE(C32); Not valid since psVectorStats doesn't allow161 // PS_IMAGE_REBIN_CASE(C64); Not valid since psVectorStats doesn't allow162 159 163 160 default: { … … 241 238 PSIMAGE_RESAMPLE_CASE(F32) 242 239 PSIMAGE_RESAMPLE_CASE(F64) 243 PSIMAGE_RESAMPLE_CASE(C32)244 PSIMAGE_RESAMPLE_CASE(C64)245 240 default: { 246 241 char* typeStr; … … 312 307 const psImage* input, 313 308 float angle, 314 double complexexposed,309 double exposed, 315 310 psImageInterpolateMode mode) 316 311 { … … 356 351 PSIMAGE_ROTATE_LEFT_90(F32); 357 352 PSIMAGE_ROTATE_LEFT_90(F64); 358 PSIMAGE_ROTATE_LEFT_90(C32);359 PSIMAGE_ROTATE_LEFT_90(C64);360 353 361 354 default: { … … 402 395 PSIMAGE_ROTATE_180_CASE(F32); 403 396 PSIMAGE_ROTATE_180_CASE(F64); 404 PSIMAGE_ROTATE_180_CASE(C32);405 PSIMAGE_ROTATE_180_CASE(C64);406 397 407 398 default: { … … 447 438 PSIMAGE_ROTATE_RIGHT_90(F32); 448 439 PSIMAGE_ROTATE_RIGHT_90(F64); 449 PSIMAGE_ROTATE_RIGHT_90(C32);450 PSIMAGE_ROTATE_RIGHT_90(C64);451 440 452 441 default: { … … 504 493 505 494 #define PSIMAGE_ROTATE_ARBITRARY_LOOP(TYPE,MODE) { \ 506 if ( creal(exposed)< PS_MIN_##TYPE || \507 creal(exposed)> PS_MAX_##TYPE || \508 cimag(exposed)< PS_MIN_##TYPE || \509 cimag(exposed)> PS_MAX_##TYPE) { \495 if (exposed < PS_MIN_##TYPE || \ 496 exposed > PS_MAX_##TYPE || \ 497 exposed < PS_MIN_##TYPE || \ 498 exposed > PS_MAX_##TYPE) { \ 510 499 psError(PS_ERR_BAD_PARAMETER_VALUE, true, \ 511 500 _("Specified %s value, %g%+gi, is not the the range of input psImage's valid pixel values (%s), i.e. [%g:%g]."), \ 512 501 "exposed", \ 513 creal(exposed),cimag(exposed), \502 exposed, exposed, \ 514 503 PS_TYPE_##TYPE##_NAME, \ 515 504 (double)PS_MIN_##TYPE,(double)PS_MAX_##TYPE); \ … … 566 555 PSIMAGE_ROTATE_ARBITRARY_LOOP(F64,MODE); \ 567 556 break; \ 568 case PS_TYPE_C32: \569 PSIMAGE_ROTATE_ARBITRARY_LOOP(C32,MODE); \570 break; \571 case PS_TYPE_C64: \572 PSIMAGE_ROTATE_ARBITRARY_LOOP(C64,MODE); \573 break; \574 557 default: { \ 575 558 char* typeStr; \ … … 690 673 float dx, 691 674 float dy, 692 double complexexposed,675 double exposed, 693 676 psImageInterpolateMode mode) 694 677 { … … 714 697 #define PSIMAGE_SHIFT_CASE(MODE,TYPE) \ 715 698 case PS_TYPE_##TYPE: \ 716 if ( creal(exposed)< PS_MIN_##TYPE || \717 creal(exposed)> PS_MAX_##TYPE || \718 cimag(exposed)< PS_MIN_##TYPE || \719 cimag(exposed)> PS_MAX_##TYPE) { \699 if (exposed < PS_MIN_##TYPE || \ 700 exposed > PS_MAX_##TYPE || \ 701 exposed < PS_MIN_##TYPE || \ 702 exposed > PS_MAX_##TYPE) { \ 720 703 psError(PS_ERR_BAD_PARAMETER_VALUE, true, \ 721 704 _("Specified %s value, %g%+gi, is not the the range of input psImage's valid pixel values (%s), i.e. [%g:%g]."), \ 722 705 "exposed", \ 723 creal(exposed),cimag(exposed), \706 exposed,exposed, \ 724 707 PS_TYPE_##TYPE##_NAME, \ 725 708 (double)PS_MIN_##TYPE,(double)PS_MAX_##TYPE); \ … … 755 738 PSIMAGE_SHIFT_CASE(MODE,F32); \ 756 739 PSIMAGE_SHIFT_CASE(MODE,F64); \ 757 PSIMAGE_SHIFT_CASE(MODE,C32); \ 758 PSIMAGE_SHIFT_CASE(MODE,C64); \ 759 \ 740 \ 760 741 default: { \ 761 742 char* typeStr; \ … … 1029 1010 FLIP_X_CASE(PS_TYPE_F32, F32); 1030 1011 FLIP_X_CASE(PS_TYPE_F64, F64); 1031 FLIP_X_CASE(PS_TYPE_C32, C32);1032 FLIP_X_CASE(PS_TYPE_C64, C64);1033 1012 default: 1034 1013 psFree(output); … … 1050 1029 FLIP_Y_CASE(PS_TYPE_F32, F32); 1051 1030 FLIP_Y_CASE(PS_TYPE_F64, F64); 1052 FLIP_Y_CASE(PS_TYPE_C32, C32);1053 FLIP_Y_CASE(PS_TYPE_C64, C64);1054 1031 default: 1055 1032 psFree(output); -
trunk/psLib/src/imageops/psImageGeomManip.h
r11248 r12431 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1.1 8$ $Name: not supported by cvs2svn $9 * @date $Date: 2007-0 1-23 22:47:23$8 * @version $Revision: 1.19 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2007-03-14 00:39:50 $ 10 10 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii 11 11 */ … … 27 27 * specified the number of pixels used to define a new pixel in the output image. 28 28 * The output image is generated from all input image pixels. This function is 29 * defined for psU8, psS8, psS16, psF32, psF64 , psC32, and psC64.29 * defined for psU8, psS8, psS16, psF32, psF64. 30 30 * 31 31 * @return psImage new image formed by rebinning input image. … … 65 65 * center pixel of the image. The rotation is specified in the sense that a 66 66 * positive angle is an anti-clockwise rotation. This function must be 67 * defined for the following types: psU8, psU16, psS8, psS16, psF32, psF64, 68 * psC32, psC64. 67 * defined for the following types: psU8, psU16, psS8, psS16, psF32, psF64. 69 68 * 70 69 * @return psImage* the rotated image result. … … 74 73 const psImage* input, ///< input image 75 74 float angle, ///< the rotation angle in radians. 76 double complex exposed,///< the output image pixel values for non-imagery areas75 double exposed, ///< the output image pixel values for non-imagery areas 77 76 psImageInterpolateMode mode ///< the interpolation mode used 78 77 ); … … 85 84 * output image are lost. Newly exposed pixels are set to the value given by 86 85 * exposed. This function must be defined for the following types: psU8, 87 * psU16, psS8, psS16, psF32, psF64 , psC32, psC64.86 * psU16, psS8, psS16, psF32, psF64. 88 87 * 89 88 * @return psImage* the shifted image result. … … 94 93 float dx, ///< the shift in x direction. 95 94 float dy, ///< the shift in y direction. 96 double complex exposed,///< the output image pixel values for non-imagery areas95 double exposed, ///< the output image pixel values for non-imagery areas 97 96 psImageInterpolateMode mode ///< the interpolation mode to use 98 97 ); … … 105 104 * output image are lost. Newly exposed pixels are set to the value given by 106 105 * exposed. This function must be defined for the following types: psU8, 107 * psU16, psS8, psS16, psF32, psF64 , psC32, psC64.106 * psU16, psS8, psS16, psF32, psF64. 108 107 * 109 108 * This implementation uses a NxN kernel generated based on the interpolation method 110 109 * the image is first shifted by a fractional amount with the kernel, then 111 * shifted in place by an integer amount. 110 * shifted in place by an integer amount. 112 111 * 113 112 * XXX the integer shift portion is not implemented … … 136 135 * The output image is the same dimensions as the input image. Edge pixels 137 136 * wrap to the other side (no values are lost). This function is 138 * defined for psU8, psS8, psS16, psF32, psF64 , psC32, and psC64.137 * defined for psU8, psS8, psS16, psF32, psF64. 139 138 * 140 139 * @return psImage* the rolled version of the input image. … … 169 168 * return to the user. This function must be capable of handling the following 170 169 * types for the input (with corresponding types for the output): psF32, psF64. 171 170 172 171 * 173 172 * @return psImage* The transformed image. -
trunk/psLib/src/imageops/psImageMaskOps.c
r10999 r12431 8 8 * @author David Robbins, MHPCC 9 9 * 10 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $11 * @date $Date: 2007-0 1-09 22:38:52$10 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2007-03-14 00:39:50 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 18 18 #endif 19 19 20 #include <complex.h>21 20 #include <math.h> // for isfinite(), etc. 22 21 #include <stdlib.h> -
trunk/psLib/src/imageops/psImagePixelExtract.c
r10999 r12431 8 8 * @author Robert DeSonia, MHPCC 9 9 * 10 * @version $Revision: 1.3 0$ $Name: not supported by cvs2svn $11 * @date $Date: 2007-0 1-09 22:38:52$10 * @version $Revision: 1.31 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2007-03-14 00:39:50 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 103 103 VECTOR_STORE_ROW_CASE(F32); 104 104 VECTOR_STORE_ROW_CASE(F64); 105 VECTOR_STORE_ROW_CASE(C32);106 VECTOR_STORE_ROW_CASE(C64);107 105 default: 108 106 psError(PS_ERR_BAD_PARAMETER_TYPE, true, … … 193 191 VECTOR_STORE_COL_CASE(F32); 194 192 VECTOR_STORE_COL_CASE(F64); 195 VECTOR_STORE_COL_CASE(C32);196 VECTOR_STORE_COL_CASE(C64);197 193 default: 198 194 psError(PS_ERR_BAD_PARAMETER_TYPE, true, … … 463 459 PSIMAGE_CUT_VERTICAL(F32); 464 460 PSIMAGE_CUT_VERTICAL(F64); 465 PSIMAGE_CUT_VERTICAL(C32); // Not a requirement466 PSIMAGE_CUT_VERTICAL(C64); // Not a requirement467 461 default: { 468 462 char* typeStr; … … 715 709 LINEAR_CUT_CASE(F32); 716 710 LINEAR_CUT_CASE(F64); 717 LINEAR_CUT_CASE(C32);718 LINEAR_CUT_CASE(C64);719 711 720 712 default: { -
trunk/psLib/src/imageops/psImagePixelManip.c
r12256 r12431 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1.2 2$ $Name: not supported by cvs2svn $13 * @date $Date: 2007-03- 06 03:09:58$12 * @version $Revision: 1.23 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2007-03-14 00:39:50 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 20 20 #endif 21 21 22 #include <complex.h>23 22 #include <math.h> // for isfinite(), etc. 24 23 #include <stdlib.h> … … 90 89 break; 91 90 92 #define psImageClipCaseComplex(type,absfcn)\93 case PS_TYPE_##type: { \94 if (vmin < PS_MIN_##type || vmin > PS_MAX_##type) { \95 psError(PS_ERR_BAD_PARAMETER_VALUE, true, \96 _("Specified %s value, %g, is outside of psImage type's range (%s: %g to %g)."), \97 "vmin",vmin, PS_TYPE_##type##_NAME, \98 (psF64)PS_MIN_##type,(psF64)PS_MAX_##type); \99 } \100 if (vmax > PS_MAX_##type || vmax < PS_MIN_##type) { \101 psError(PS_ERR_BAD_PARAMETER_VALUE, true, \102 _("Specified %s value, %g, is outside of psImage type's range (%s: %g to %g)."), \103 "vmax",vmax, PS_TYPE_##type##_NAME, \104 (psF64)PS_MIN_##type,(psF64)PS_MAX_##type); \105 } \106 for (psU32 row = 0;row<numRows;row++) { \107 ps##type* inputRow = input->data.type[row]; \108 for (psU32 col = 0; col < numCols; col++) { \109 if (absfcn(inputRow[col]) < min) { \110 inputRow[col] = (ps##type)vmin; \111 numClipped++; \112 } else if (absfcn(inputRow[col]) > max) { \113 inputRow[col] = (ps##type)vmax; \114 numClipped++; \115 } \116 } \117 } \118 } \119 break;120 121 91 psImageClipCase(S8) 122 92 psImageClipCase(S16) … … 129 99 psImageClipCase(F32) 130 100 psImageClipCase(F64) 131 psImageClipCaseComplex(C32, cabsf)132 psImageClipCaseComplex(C64, cabs)133 101 134 102 default: { … … 174 142 psImageClipNaNCase(F32) 175 143 psImageClipNaNCase(F64) 176 psImageClipNaNCase(C32)177 psImageClipNaNCase(C64)178 144 179 145 default: { … … 331 297 psImageOverlayCase(F32,NAN); 332 298 psImageOverlayCase(F64,NAN); 333 psImageOverlayCase(C32,NAN);334 psImageOverlayCase(C64,NAN);335 299 336 300 default: { … … 347 311 } 348 312 349 int psImageClipComplexRegion(psImage* input,350 double complex min,351 double complex vmin,352 double complex max,353 double complex vmax)354 {355 psS32 numClipped = 0;356 psU32 numRows;357 psU32 numCols;358 psF64 realMin = creal(min);359 psF64 imagMin = cimag(min);360 psF64 realMax = creal(max);361 psF64 imagMax = cimag(max);362 363 if (input == NULL) {364 psError(PS_ERR_BAD_PARAMETER_NULL, true,365 _("Can not operate on a NULL psImage."));366 return 0;367 }368 369 if (realMax < realMin) {370 psError(PS_ERR_BAD_PARAMETER_VALUE, true,371 _("Specified real-portion of min value, %g, can not be greater than the real-portion of max value, %g."),372 (double)realMin, (double)realMax);373 return 0;374 }375 if (imagMax < imagMin) {376 psError(PS_ERR_BAD_PARAMETER_VALUE, true,377 _("Specified imaginary-portion of min value, %g, can not be greater than the imaginary-portion of max value, %g."),378 (double)imagMin, (double)imagMax);379 return 0;380 }381 382 numRows = input->numRows;383 numCols = input->numCols;384 385 #define psImageClipComplexRegionCase(type,realfcn,imagfcn) \386 case PS_TYPE_##type: { \387 if (realfcn(vmin) < PS_MIN_##type || imagfcn(vmin) < PS_MIN_##type || \388 realfcn(vmin) > PS_MAX_##type || imagfcn(vmin) > PS_MAX_##type ) { \389 psError(PS_ERR_BAD_PARAMETER_VALUE, true, \390 _("Specified %s value, %g%+gi, is not the the range of input psImage's valid pixel values (%s), i.e. [%g:%g]."), \391 "vmin", creal(vmin), cimag(vmin), \392 PS_TYPE_##type##_NAME, PS_MIN_##type, PS_MAX_##type); \393 break; \394 } \395 if (realfcn(vmax) > PS_MAX_##type || imagfcn(vmax) > PS_MAX_##type || \396 realfcn(vmax) < PS_MIN_##type || imagfcn(vmax) < PS_MIN_##type ) { \397 psError(PS_ERR_BAD_PARAMETER_VALUE, true, \398 _("Specified %s value, %g%+gi, is not the the range of input psImage's valid pixel values (%s), i.e. [%g:%g]."), \399 "vmax", creal(vmax), cimag(vmax), \400 PS_TYPE_##type##_NAME, PS_MIN_##type, PS_MAX_##type); \401 break; \402 } \403 for (psU32 row = 0;row<numRows;row++) { \404 ps##type* inputRow = input->data.type[row]; \405 for (psU32 col = 0; col < numCols; col++) { \406 if ( (realfcn(inputRow[col]) > realMax) || (imagfcn(inputRow[col]) > imagMax) ) { \407 inputRow[col] = (ps##type)vmax; \408 numClipped++; \409 } else if ( (realfcn(inputRow[col]) < realMin) || (imagfcn(inputRow[col]) < imagMin) ){ \410 inputRow[col] = (ps##type)vmin; \411 numClipped++; \412 } \413 } \414 } \415 } \416 break;417 418 switch (input->type.type) {419 420 psImageClipComplexRegionCase(C32, crealf, cimagf)421 psImageClipComplexRegionCase(C64, creal, cimag)422 423 default: {424 char* typeStr;425 PS_TYPE_NAME(typeStr,input->type.type);426 psError(PS_ERR_BAD_PARAMETER_TYPE, true,427 _("Specified psImage type, %s, is not supported."),428 typeStr);429 }430 }431 432 return numClipped;433 } -
trunk/psLib/src/imageops/psImagePixelManip.h
r11248 r12431 5 5 * @author Robert DeSonia, MHPCC 6 6 * 7 * @version $Revision: 1.1 6$ $Name: not supported by cvs2svn $8 * @date $Date: 2007-0 1-23 22:47:23$7 * @version $Revision: 1.17 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2007-03-14 00:39:50 $ 9 9 * 10 10 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 26 26 * All pixels with values less than min are set to the value vmin. all pixels 27 27 * with values greater than max are set to the value vmax. This function is 28 * defined for psU8, psU16, psS8, psS16, psF32, psF64 , psC32, and psC64.28 * defined for psU8, psU16, psS8, psS16, psF32, psF64. 29 29 * 30 30 * @return int The number of clipped pixels … … 38 38 ); 39 39 40 /** Clip image values outside of a specified complex region41 *42 * All pixels outside of the rectangular region in complex space formed by43 * the min and max input parameters are set to the value vmax (if either44 * the real or imaginary portion exceeds the respective max values), or vmin.45 * This function is defined for psC32, and psC64 imagery only.46 *47 * @return int The number of clipped pixels48 */49 int psImageClipComplexRegion(50 psImage* input, ///< the image to clip51 double complex min, ///< the minimum image value allowed52 double complex vmin, ///< the value pixels < min are set to53 double complex max, ///< the maximum image value allowed54 double complex vmax ///< the value pixels > max are set to55 );56 57 40 /** Clip NaN image pixels to given value. 58 41 * 59 42 * Pixels with NaN, +Inf, or -Inf values are set to the specified value. This 60 * function is defined for psF32, psF64 , psC32, and psC64.43 * function is defined for psF32, psF64. 61 44 * 62 45 * @return int The number of clipped pixels … … 74 57 * OVERLAY value to image value), "-" (subtract OVERLAY from image), "*" 75 58 * (multiply OVERLAY times image), "/" (divide image by OVERLAY). This 76 * function is defined for psU8, psS8, psS16, psF32, psF64 , psC32, and psC64.59 * function is defined for psU8, psS8, psS16, psF32, psF64. 77 60 * 78 61 * @return int 0 if success, non-zero if failed. -
trunk/psLib/src/imageops/psImageStats.c
r11760 r12431 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.10 5$ $Name: not supported by cvs2svn $12 * @date $Date: 2007-0 2-13 03:08:17$11 * @version $Revision: 1.106 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2007-03-14 00:39:50 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 634 634 case PS_TYPE_F32: 635 635 case PS_TYPE_F64: 636 case PS_TYPE_C32:637 case PS_TYPE_C64:638 636 default: 639 637 // XXX this should include the mask type (as a string) -
trunk/psLib/src/imageops/psImageStructManip.c
r10999 r12431 8 8 * @author Robert DeSonia, MHPCC 9 9 * 10 * @version $Revision: 1.1 3$ $Name: not supported by cvs2svn $11 * @date $Date: 2007-0 1-09 22:38:52$10 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2007-03-14 00:39:50 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 239 239 PSIMAGE_ELEMENT_COPY(input,F64,OUT,OUTTYPE,elements); \ 240 240 break; \ 241 case PS_TYPE_C32: \242 PSIMAGE_ELEMENT_COPY(input,C32,OUT,OUTTYPE,elements); \243 break; \244 case PS_TYPE_C64: \245 PSIMAGE_ELEMENT_COPY(input,C64,OUT,OUTTYPE,elements); \246 break; \247 241 default: \ 248 242 break; \ … … 280 274 case PS_TYPE_F64: 281 275 PSIMAGE_COPY_CASE(output, F64); 282 break;283 case PS_TYPE_C32:284 PSIMAGE_COPY_CASE(output, C32);285 break;286 case PS_TYPE_C64:287 PSIMAGE_COPY_CASE(output, C64);288 276 break; 289 277 default: { -
trunk/psLib/src/imageops/psImageStructManip.h
r11248 r12431 5 5 * @author Robert DeSonia, MHPCC 6 6 * 7 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $8 * @date $Date: 2007-0 1-23 22:47:23$7 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2007-03-14 00:39:50 $ 9 9 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii 10 10 */ … … 29 29 * parent image in that dimension. The entire subraster must be contained within the raster of 30 30 * the parent image. Note that the refCounter for the parent should be incremented. This 31 * function must be defined for the following types: psU8, psU16, psS8, psS16, psF32, psF64, 32 * psC32, psC64. 31 * function must be defined for the following types: psU8, psU16, psS8, psS16, psF32, psF64. 33 32 * 34 33 * @return psImage* : Pointer to psImage. -
trunk/psLib/src/math/psBinaryOp.c
r10999 r12431 30 30 * @author Robert DeSonia, MHPCC 31 31 * 32 * @version $Revision: 1.1 2$ $Name: not supported by cvs2svn $33 * @date $Date: 2007-0 1-09 22:38:52$32 * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $ 33 * @date $Date: 2007-03-14 00:39:50 $ 34 34 * 35 35 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 323 323 DIM1##_##DIM2(OUT,IN1,OP,IN2,F64); \ 324 324 break; \ 325 case PS_TYPE_C32: \ 326 DIM1##_##DIM2(OUT,IN1,OP,IN2,C32); \ 327 break; \ 328 case PS_TYPE_C64: \ 329 DIM1##_##DIM2(OUT,IN1,OP,IN2,C64); \ 330 break; \ 331 default: \ 332 /* char* strType; \ 333 PS_TYPE_NAME(strType,IN1->type); \ 334 psError(PS_ERR_BAD_PARAMETER_TYPE, true, \ 335 _("Specified data type, %s, is not supported."), \ 336 strType); */ \ 337 if (OUT != IN1 && OUT != IN2) { \ 338 psFree(OUT); \ 325 default: { \ 326 char* strType; \ 327 PS_TYPE_NAME(strType,IN1->type); \ 328 psError(PS_ERR_BAD_PARAMETER_TYPE, true, \ 329 _("Specified data type, %s, is not supported."), \ 330 strType); \ 331 if (OUT != IN1 && OUT != IN2) { \ 332 psFree(OUT); \ 333 } \ 334 return NULL; \ 339 335 } \ 340 return NULL; \341 336 } 342 337 … … 364 359 } else { \ 365 360 psError(PS_ERR_BAD_PARAMETER_VALUE, true, \ 366 "Types (%x,%x) are not appropriate for logical OR.\n", IN1->type, IN2->type); \361 "Types (%x,%x) are not appropriate for logical OR.\n", IN1->type, IN2->type); \ 367 362 return NULL; \ 368 363 } \ 369 364 } else if (!strncmp(OP, "^", 1)) { \ 370 if (PS_IS_PSELEMTYPE_COMPLEX(IN1->type)) { \ 371 BINARY_TYPE(DIM1,DIM2,OUT,IN1,cpow(*i1,*i2),IN2); \ 372 } else { \ 373 BINARY_TYPE(DIM1,DIM2,OUT,IN1,pow(*i1,*i2),IN2); \ 374 } \ 365 BINARY_TYPE(DIM1,DIM2,OUT,IN1,pow(*i1,*i2),IN2); \ 375 366 } else if (!strncmp(OP, "min", 3)) { \ 376 if (PS_IS_PSELEMTYPE_COMPLEX(IN1->type)) { \ 377 psError(PS_ERR_BAD_PARAMETER_VALUE, true, \ 378 _("The minimum operation is not supported with complex data.")); \ 379 if (OUT != IN1 && OUT != IN2) { \ 380 psFree(OUT); \ 381 } \ 382 return NULL; \ 383 } else { \ 384 BINARY_TYPE(DIM1,DIM2,OUT,IN1,fmin(*i1,*i2),IN2); \ 385 } \ 367 BINARY_TYPE(DIM1,DIM2,OUT,IN1,fmin(*i1,*i2),IN2); \ 386 368 } else if (!strncmp(OP, "max", 3)) { \ 387 if (PS_IS_PSELEMTYPE_COMPLEX(IN1->type)) { \ 388 psError(PS_ERR_BAD_PARAMETER_VALUE, true, \ 389 _("The maximum operation is not supported with complex data.")); \ 390 if (OUT != IN1 && OUT != IN2) { \ 391 psFree(OUT); \ 392 } \ 393 return NULL; \ 394 } else { \ 395 BINARY_TYPE(DIM1,DIM2,OUT,IN1,fmax(*i1,*i2),IN2); \ 396 } \ 369 BINARY_TYPE(DIM1,DIM2,OUT,IN1,fmax(*i1,*i2),IN2); \ 397 370 } else { \ 398 371 psError(PS_ERR_BAD_PARAMETER_VALUE, true, \ 399 _("Specified operation, %s, is not supported."), \372 _("Specified operation, %s, is not supported."), \ 400 373 OP); \ 401 374 if (OUT != IN1 && OUT != IN2) { \ -
trunk/psLib/src/math/psUnaryOp.c
r10999 r12431 31 31 * @author Robert DeSonia, MHPCC 32 32 * 33 * @version $Revision: 1.1 3$ $Name: not supported by cvs2svn $34 * @date $Date: 2007-0 1-09 22:38:53$33 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 34 * @date $Date: 2007-03-14 00:39:50 $ 35 35 * 36 36 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 45 45 ******************************************************************************/ 46 46 #include <string.h> 47 #include <complex.h>48 47 #include <math.h> 49 48 #include <stdint.h> … … 123 122 #define UNARY_TYPE(DIM,OUT,IN,OP) \ 124 123 switch (IN->type) { \ 124 case PS_TYPE_U8: \ 125 DIM(OUT,IN,OP,U8); \ 126 break; \ 127 case PS_TYPE_U16: \ 128 DIM(OUT,IN,OP,U16); \ 129 break; \ 130 case PS_TYPE_U32: \ 131 DIM(OUT,IN,OP,U32); \ 132 break; \ 133 case PS_TYPE_U64: \ 134 DIM(OUT,IN,OP,U64); \ 135 break; \ 136 case PS_TYPE_S8: \ 137 DIM(OUT,IN,OP,S8); \ 138 break; \ 139 case PS_TYPE_S16: \ 140 DIM(OUT,IN,OP,S16); \ 141 break; \ 125 142 case PS_TYPE_S32: \ 126 143 DIM(OUT,IN,OP,S32); \ 127 144 break; \ 145 case PS_TYPE_S64: \ 146 DIM(OUT,IN,OP,S64); \ 147 break; \ 128 148 case PS_TYPE_F32: \ 129 149 DIM(OUT,IN,OP,F32); \ … … 131 151 case PS_TYPE_F64: \ 132 152 DIM(OUT,IN,OP,F64); \ 133 break; \134 case PS_TYPE_C32: \135 DIM(OUT,IN,OP,C32); \136 break; \137 case PS_TYPE_S8: \138 DIM(OUT,IN,OP,C32); \139 break; \140 case PS_TYPE_U8: \141 DIM(OUT,IN,OP,C32); \142 break; \143 case PS_TYPE_S16: \144 DIM(OUT,IN,OP,C32); \145 break; \146 case PS_TYPE_U16: \147 DIM(OUT,IN,OP,C32); \148 break; \149 case PS_TYPE_U32: \150 DIM(OUT,IN,OP,C32); \151 break; \152 case PS_TYPE_S64: \153 DIM(OUT,IN,OP,C32); \154 break; \155 case PS_TYPE_U64: \156 DIM(OUT,IN,OP,C32); \157 break; \158 case PS_TYPE_C64: \159 DIM(OUT,IN,OP,C32); \160 153 break; \ 161 154 default: { \ … … 174 167 #define UNARY_OP(DIM,OUT,IN,OP) \ 175 168 if(!strncmp(OP, "abs", 3)) { \ 176 if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) { \ 177 UNARY_TYPE(DIM,OUT,IN,cabs((double complex)*i1)); \ 178 } else { \ 179 UNARY_TYPE(DIM,OUT,IN,fabs((double)*i1)); \ 180 } \ 169 UNARY_TYPE(DIM,OUT,IN,fabs((double)*i1)); \ 181 170 } else if(!strncmp(OP, "sqrt", 4)) { \ 182 if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) { \ 183 UNARY_TYPE(DIM,OUT,IN,csqrt((double complex)*i1)); \ 184 } else { \ 185 UNARY_TYPE(DIM,OUT,IN,sqrt((double)*i1)); \ 186 } \ 171 UNARY_TYPE(DIM,OUT,IN,sqrt((double)*i1)); \ 187 172 } else if(!strncmp(OP, "exp", 3)) { \ 188 if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) { \ 189 UNARY_TYPE(DIM,OUT,IN,cexp((double complex)*i1)); \ 190 } else { \ 191 UNARY_TYPE(DIM,OUT,IN,exp((double)*i1)); \ 192 } \ 173 UNARY_TYPE(DIM,OUT,IN,exp((double)*i1)); \ 193 174 } else if(!strncmp(OP, "ln", 2)) { \ 194 if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) { \ 195 UNARY_TYPE(DIM,OUT,IN,clog((double complex)*i1)); \ 196 } else { \ 197 UNARY_TYPE(DIM,OUT,IN,log((double)*i1)); \ 198 } \ 175 UNARY_TYPE(DIM,OUT,IN,log((double)*i1)); \ 199 176 } else if(!strncmp(OP, "ten", 3)) { \ 200 if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) { \ 201 UNARY_TYPE(DIM,OUT,IN,cpow(10.0,(double complex)*i1)); \ 202 } else { \ 203 UNARY_TYPE(DIM,OUT,IN,pow(10.0,(double)*i1)); \ 204 } \ 177 UNARY_TYPE(DIM,OUT,IN,pow(10.0,(double)*i1)); \ 205 178 } else if(!strncmp(OP, "log", 3)) { \ 206 if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) { \ 207 UNARY_TYPE(DIM,OUT,IN,clog((double complex)*i1)/log(10.0)); \ 208 } else { \ 209 UNARY_TYPE(DIM,OUT,IN,log10((double)*i1)); \ 210 } \ 179 UNARY_TYPE(DIM,OUT,IN,log10((double)*i1)); \ 211 180 } else if(!strncmp(OP, "sin", 3)) { \ 212 if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) { \ 213 UNARY_TYPE(DIM,OUT,IN,csin((double complex)*i1)); \ 214 } else { \ 215 UNARY_TYPE(DIM,OUT,IN,sin((double)*i1)); \ 216 } \ 181 UNARY_TYPE(DIM,OUT,IN,sin((double)*i1)); \ 217 182 } else if(!strncmp(OP, "dsin", 4)) { \ 218 if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) { \ 219 UNARY_TYPE(DIM,OUT,IN,csin((double complex)*i1*D2R)); \ 220 } else { \ 221 UNARY_TYPE(DIM,OUT,IN,sin((double)*i1*D2R)); \ 222 } \ 183 UNARY_TYPE(DIM,OUT,IN,sin((double)*i1*D2R)); \ 223 184 } else if(!strncmp(OP, "cos", 3)) { \ 224 if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) { \ 225 UNARY_TYPE(DIM,OUT,IN,ccos((double complex)*i1)); \ 226 } else { \ 227 UNARY_TYPE(DIM,OUT,IN,cos((double)*i1)); \ 228 } \ 185 UNARY_TYPE(DIM,OUT,IN,cos((double)*i1)); \ 229 186 } else if(!strncmp(OP, "dcos", 4)) { \ 230 if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) { \ 231 UNARY_TYPE(DIM,OUT,IN,ccos((double complex)*i1*D2R)); \ 232 } else { \ 233 UNARY_TYPE(DIM,OUT,IN,cos((double)*i1*D2R)); \ 234 } \ 187 UNARY_TYPE(DIM,OUT,IN,cos((double)*i1*D2R)); \ 235 188 } else if(!strncmp(OP, "tan", 3)) { \ 236 if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) { \ 237 UNARY_TYPE(DIM,OUT,IN,ctan((double complex)*i1)); \ 238 } else { \ 239 UNARY_TYPE(DIM,OUT,IN,tan((double)*i1)); \ 240 } \ 189 UNARY_TYPE(DIM,OUT,IN,tan((double)*i1)); \ 241 190 } else if(!strncmp(OP, "dtan", 4)) { \ 242 if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) { \ 243 UNARY_TYPE(DIM,OUT,IN,ctan((double complex)*i1*D2R)); \ 244 } else { \ 245 UNARY_TYPE(DIM,OUT,IN,tan((double)*i1*D2R)); \ 246 } \ 191 UNARY_TYPE(DIM,OUT,IN,tan((double)*i1*D2R)); \ 247 192 } else if(!strncmp(OP, "asin", 4)) { \ 248 if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) { \ 249 UNARY_TYPE(DIM,OUT,IN,casin((double complex)*i1)); \ 250 } else { \ 251 UNARY_TYPE(DIM,OUT,IN,asin((double)*i1)); \ 252 } \ 193 UNARY_TYPE(DIM,OUT,IN,asin((double)*i1)); \ 253 194 } else if(!strncmp(OP, "dasin", 5)) { \ 254 if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) { \ 255 UNARY_TYPE(DIM,OUT,IN,R2D*casin((double complex)*i1)); \ 256 } else { \ 257 UNARY_TYPE(DIM,OUT,IN,(R2D*asin((double)*i1))); \ 258 } \ 195 UNARY_TYPE(DIM,OUT,IN,(R2D*asin((double)*i1))); \ 259 196 } else if(!strncmp(OP, "acos", 4)) { \ 260 if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) { \ 261 UNARY_TYPE(DIM,OUT,IN,cacos((double complex)*i1)); \ 262 } else { \ 263 UNARY_TYPE(DIM,OUT,IN,acos((double)*i1)); \ 264 } \ 197 UNARY_TYPE(DIM,OUT,IN,acos((double)*i1)); \ 265 198 } else if(!strncmp(OP, "dacos", 5)) { \ 266 if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) { \ 267 UNARY_TYPE(DIM,OUT,IN,R2D*cacos((double complex)*i1)); \ 268 } else { \ 269 UNARY_TYPE(DIM,OUT,IN,R2D*acos((double)*i1)); \ 270 } \ 199 UNARY_TYPE(DIM,OUT,IN,R2D*acos((double)*i1)); \ 271 200 } else if(!strncmp(OP, "atan", 4)) { \ 272 if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) { \ 273 UNARY_TYPE(DIM,OUT,IN,catan((double complex)*i1)); \ 274 } else { \ 275 UNARY_TYPE(DIM,OUT,IN,atan((double)*i1)); \ 276 } \ 201 UNARY_TYPE(DIM,OUT,IN,atan((double)*i1)); \ 277 202 } else if(!strncmp(OP, "datan", 5)) { \ 278 if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) { \ 279 UNARY_TYPE(DIM,OUT,IN,R2D*catan((double complex)*i1)); \ 280 } else { \ 281 UNARY_TYPE(DIM,OUT,IN,R2D*atan((double)*i1)); \ 282 } \ 203 UNARY_TYPE(DIM,OUT,IN,R2D*atan((double)*i1)); \ 283 204 } else { \ 284 205 psError(PS_ERR_BAD_PARAMETER_VALUE, true, _("Specified operation, %s, is not supported."), OP); \ -
trunk/psLib/src/mathtypes/psImage.c
r12381 r12431 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1.12 4$ $Name: not supported by cvs2svn $12 * @date $Date: 2007-03- 09 20:16:40 $11 * @version $Revision: 1.125 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2007-03-14 00:39:50 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 31 31 #include "psString.h" 32 32 33 34 35 #define SQUARE(x) ((x)*(x))36 #define MIN(x,y) (((x) > (y)) ? (y) : (x))37 #define MAX(x,y) (((x) > (y)) ? (x) : (y))38 33 39 34 static void imageFree(psImage* image) … … 209 204 int x, 210 205 int y, 211 double complexvalue)206 double value) 212 207 { 213 208 PS_ASSERT_IMAGE_NON_NULL(image, false); … … 276 271 IMAGE_SET_CASE(F32); 277 272 IMAGE_SET_CASE(F64); 278 IMAGE_SET_CASE(C32);279 IMAGE_SET_CASE(C64);280 273 default: 281 274 psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Invalid psImage Data Type\n"); … … 286 279 } 287 280 288 double complexpsImageGet(const psImage *image,281 double psImageGet(const psImage *image, 289 282 int x, 290 283 int y) … … 354 347 IMAGE_GET_CASE(F32); 355 348 IMAGE_GET_CASE(F64); 356 IMAGE_GET_CASE(C32);357 IMAGE_GET_CASE(C64);358 349 default: 359 350 psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Invalid psImage Data Type\n"); … … 485 476 PSIMAGE_BUFFER_COPY(F64,OUTTYPE); \ 486 477 break; \ 487 case PS_TYPE_C32: \488 PSIMAGE_BUFFER_COPY(C32,OUTTYPE); \489 break; \490 case PS_TYPE_C64: \491 PSIMAGE_BUFFER_COPY(C64,OUTTYPE); \492 break; \493 478 default: \ 494 479 break; \ … … 526 511 case PS_TYPE_F64: 527 512 PSIMAGE_BUFFER_COPY_CASE(output, F64); 528 break;529 case PS_TYPE_C32:530 PSIMAGE_BUFFER_COPY_CASE(output, C32);531 break;532 case PS_TYPE_C64:533 PSIMAGE_BUFFER_COPY_CASE(output, C64);534 513 break; 535 514 default: { … … 593 572 } 594 573 595 double complexpsImagePixelInterpolate(const psImage* input,574 double psImagePixelInterpolate(const psImage* input, 596 575 float x, 597 576 float y, 598 577 const psImage* mask, 599 578 psMaskType maskVal, 600 double complexunexposedValue,579 double unexposedValue, 601 580 psImageInterpolateMode mode) 602 581 { … … 660 639 PSIMAGE_PIXEL_INTERPOLATE_CASE(F32); 661 640 PSIMAGE_PIXEL_INTERPOLATE_CASE(F64); 662 PSIMAGE_PIXEL_INTERPOLATE_CASE(C32);663 PSIMAGE_PIXEL_INTERPOLATE_CASE(C64);664 641 default: { 665 642 char* typeStr; … … 729 706 float y, \ 730 707 const psImage* mask, \ 731 ps U32maskVal, \708 psMaskType maskVal, \ 732 709 RETURNTYPE unexposedValue) \ 733 710 { \ … … 759 736 PSIMAGE_PIXEL_INTERPOLATE_FLAT(F32,psF64) 760 737 PSIMAGE_PIXEL_INTERPOLATE_FLAT(F64,psF64) 761 PSIMAGE_PIXEL_INTERPOLATE_FLAT(C32,psC64)762 PSIMAGE_PIXEL_INTERPOLATE_FLAT(C64,psC64)763 738 764 739 #define PSIMAGE_PIXEL_INTERPOLATE_BILINEAR(TYPE, RETURNTYPE, SUFFIX, FRACFUNC) \ … … 768 743 float y, \ 769 744 const psImage* mask, \ 770 ps U32maskVal, \745 psMaskType maskVal, \ 771 746 RETURNTYPE unexposedValue) \ 772 747 { \ 773 748 int floorX = floor((x) - 0.5); \ 774 749 int floorY = floor((y) - 0.5); \ 775 psF64fracX = x - 0.5 - floorX; \776 psF64fracY = y - 0.5 - floorY; \777 psS32lastX = input->numCols - 1; \778 psS32lastY = input->numRows - 1; \779 ps##TYPE V00 = 0; \780 ps##TYPE V01 = 0; \781 ps##TYPE V10 = 0; \782 ps##TYPE V11 = 0; \783 bool valid00 = false; \784 bool valid01 = false; \785 bool valid10 = false; \786 bool valid11 = false; \750 float fracX = x - 0.5 - floorX; \ 751 float fracY = y - 0.5 - floorY; \ 752 int lastX = input->numCols - 1; \ 753 int lastY = input->numRows - 1; \ 754 ps##TYPE V00; \ 755 ps##TYPE V01; \ 756 ps##TYPE V10; \ 757 ps##TYPE V11; \ 758 bool valid00; \ 759 bool valid01; \ 760 bool valid10; \ 761 bool valid11; \ 787 762 \ 788 763 if (floorY >= 0 && floorY <= lastY) { \ … … 791 766 valid00 = (mask == NULL) || \ 792 767 ((mask->data.PS_TYPE_MASK_DATA[floorY][floorX] & maskVal) == 0); \ 768 } else { \ 769 valid00 = false; \ 793 770 } \ 794 771 if (floorX >= -1 && floorX < lastX) { \ … … 796 773 valid10 = (mask == NULL) || \ 797 774 ((mask->data.PS_TYPE_MASK_DATA[floorY][floorX+1] & maskVal) == 0); \ 775 } else { \ 776 valid10 = false; \ 798 777 } \ 778 } else { \ 779 valid00 = false; \ 780 valid10 = false; \ 799 781 } \ 800 782 if (floorY >= -1 && floorY < lastY) { \ … … 803 785 valid01 = (mask == NULL) || \ 804 786 ((mask->data.PS_TYPE_MASK_DATA[floorY+1][floorX] & maskVal) == 0); \ 787 } else { \ 788 valid01 = false; \ 805 789 } \ 806 790 if (floorX >= -1 && floorX < lastX) { \ … … 808 792 valid11 = (mask == NULL) || \ 809 793 ((mask->data.PS_TYPE_MASK_DATA[floorY+1][floorX+1] & maskVal) == 0); \ 794 } else { \ 795 valid11 = false; \ 810 796 } \ 797 } else { \ 798 valid01 = false; \ 799 valid11 = false; \ 811 800 } \ 812 801 \ … … 814 803 if (valid00 && valid10 && valid01 && valid11) { \ 815 804 /* formula from the ADD */ \ 816 /* XXX this had V01 and V10 exchanged! */ \817 805 return V00*FRACFUNC((1.0-fracX)*(1.0-fracY)) + V10*FRACFUNC(fracX*(1.0-fracY)) + \ 818 806 V01*FRACFUNC(fracY*(1.0-fracX)) + V11*FRACFUNC(fracX*fracY); \ … … 864 852 float y, \ 865 853 const psImage* mask, \ 866 ps U32maskVal, \854 psMaskType maskVal, \ 867 855 RETURNTYPE unexposedValue) \ 868 856 { \ … … 917 905 PSIMAGE_PIXEL_INTERPOLATE_BILINEAR(F32,psF64,F32,) 918 906 PSIMAGE_PIXEL_INTERPOLATE_BILINEAR(F64,psF64,F64,) 919 PSIMAGE_PIXEL_INTERPOLATE_BILINEAR(C32,psC64,C32,)920 PSIMAGE_PIXEL_INTERPOLATE_BILINEAR(C64,psC64,C64,)921 907 922 908 PSIMAGE_PIXEL_INTERPOLATE_BICUBE(U8,psF64,U8,) … … 930 916 PSIMAGE_PIXEL_INTERPOLATE_BICUBE(F32,psF64,F32,) 931 917 PSIMAGE_PIXEL_INTERPOLATE_BICUBE(F64,psF64,F64,) 932 PSIMAGE_PIXEL_INTERPOLATE_BICUBE(C32,psC64,C32,)933 PSIMAGE_PIXEL_INTERPOLATE_BICUBE(C64,psC64,C64,)934 918 935 919 // Variance Version 936 PSIMAGE_PIXEL_INTERPOLATE_BILINEAR(U8,psF64,VARIANCE_U8,SQUARE) 937 PSIMAGE_PIXEL_INTERPOLATE_BILINEAR(U16,psF64,VARIANCE_U16,SQUARE) 938 PSIMAGE_PIXEL_INTERPOLATE_BILINEAR(U32,psF64,VARIANCE_U32,SQUARE) 939 PSIMAGE_PIXEL_INTERPOLATE_BILINEAR(U64,psF64,VARIANCE_U64,SQUARE) 940 PSIMAGE_PIXEL_INTERPOLATE_BILINEAR(S8,psF64,VARIANCE_S8,SQUARE) 941 PSIMAGE_PIXEL_INTERPOLATE_BILINEAR(S16,psF64,VARIANCE_S16,SQUARE) 942 PSIMAGE_PIXEL_INTERPOLATE_BILINEAR(S32,psF64,VARIANCE_S32,SQUARE) 943 PSIMAGE_PIXEL_INTERPOLATE_BILINEAR(S64,psF64,VARIANCE_S64,SQUARE) 944 PSIMAGE_PIXEL_INTERPOLATE_BILINEAR(F32,psF64,VARIANCE_F32,SQUARE) 945 PSIMAGE_PIXEL_INTERPOLATE_BILINEAR(F64,psF64,VARIANCE_F64,SQUARE) 946 PSIMAGE_PIXEL_INTERPOLATE_BILINEAR(C32,psC64,VARIANCE_C32,SQUARE) 947 PSIMAGE_PIXEL_INTERPOLATE_BILINEAR(C64,psC64,VARIANCE_C64,SQUARE) 920 PSIMAGE_PIXEL_INTERPOLATE_BILINEAR(U8,psF64,VARIANCE_U8,PS_SQR) 921 PSIMAGE_PIXEL_INTERPOLATE_BILINEAR(U16,psF64,VARIANCE_U16,PS_SQR) 922 PSIMAGE_PIXEL_INTERPOLATE_BILINEAR(U32,psF64,VARIANCE_U32,PS_SQR) 923 PSIMAGE_PIXEL_INTERPOLATE_BILINEAR(U64,psF64,VARIANCE_U64,PS_SQR) 924 PSIMAGE_PIXEL_INTERPOLATE_BILINEAR(S8,psF64,VARIANCE_S8,PS_SQR) 925 PSIMAGE_PIXEL_INTERPOLATE_BILINEAR(S16,psF64,VARIANCE_S16,PS_SQR) 926 PSIMAGE_PIXEL_INTERPOLATE_BILINEAR(S32,psF64,VARIANCE_S32,PS_SQR) 927 PSIMAGE_PIXEL_INTERPOLATE_BILINEAR(S64,psF64,VARIANCE_S64,PS_SQR) 928 PSIMAGE_PIXEL_INTERPOLATE_BILINEAR(F32,psF64,VARIANCE_F32,PS_SQR) 929 PSIMAGE_PIXEL_INTERPOLATE_BILINEAR(F64,psF64,VARIANCE_F64,PS_SQR) -
trunk/psLib/src/mathtypes/psImage.h
r12381 r12431 9 9 * @author Joshua Hoblitt, University of Hawaii 10 10 * 11 * @version $Revision: 1. 89$ $Name: not supported by cvs2svn $12 * @date $Date: 2007-03- 09 20:16:40$11 * @version $Revision: 1.90 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2007-03-14 00:39:51 $ 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii 14 14 */ … … 20 20 /// @{ 21 21 22 #include <complex.h>23 22 #include <stdio.h> 24 23 #include "psType.h" … … 70 69 psF32** F32; ///< Single-precision float data. 71 70 psF64** F64; ///< Double-precision float data. 72 psC32** C32; ///< Single-precision complex data.73 psC64** C64; ///< Double-precision complex data.74 71 psPtr* V; ///< Pointer to data. 75 72 } data; ///< Union for data types. … … 143 140 bool psImageSet( 144 141 psImage *image, ///< the image to set 145 int x, ///< x-position146 int y, ///< y-position147 double complex value///< specified value to set142 int x, ///< x-position 143 int y, ///< y-position 144 double value ///< specified value to set 148 145 ); 149 146 … … 152 149 * A negative value for the x or y positions means index from the end. 153 150 * 154 * @return complex: The value at the specified x,y position.155 */ 156 double complexpsImageGet(151 * @return double: The value at the specified x,y position. 152 */ 153 double psImageGet( 157 154 const psImage *image, ///< the image from which to get 158 155 int x, ///< x-position … … 230 227 /** Interpolate image pixel value given floating point coordinates. 231 228 * 232 * @return complexPixel value interpolated from image or unexposedValue if229 * @return double Pixel value interpolated from image or unexposedValue if 233 230 * given x,y doesn't coorespond to a valid image location 234 231 */ 235 double complexpsImagePixelInterpolate(232 double psImagePixelInterpolate( 236 233 const psImage* input, ///< input image for interpolation 237 234 float x, ///< column location to derive value of … … 239 236 const psImage* mask, ///< if not NULL, the mask of the input image 240 237 psMaskType maskVal, ///< the mask value 241 double complex unexposedValue,///< return value if x,y location is not in image.238 double unexposedValue, ///< return value if x,y location is not in image. 242 239 psImageInterpolateMode mode ///< interpolation mode 243 240 ); … … 250 247 float y, /**< row location ot derive value of */ \ 251 248 const psImage* mask, /**< if not NULL, the mask of the input image */ \ 252 ps U32 maskVal,/**< the mask value */ \249 psMaskType maskVal, /**< the mask value */ \ 253 250 RETURNTYPE unexposedValue /**< return value if x,y location is not in image. */ \ 254 251 ); … … 264 261 PIXEL_INTERPOLATE_FCN_PROTOTYPE(MODE##_S64,psF64) \ 265 262 PIXEL_INTERPOLATE_FCN_PROTOTYPE(MODE##_F32,psF64) \ 266 PIXEL_INTERPOLATE_FCN_PROTOTYPE(MODE##_F64,psF64) \ 267 PIXEL_INTERPOLATE_FCN_PROTOTYPE(MODE##_C32,psC64) \ 268 PIXEL_INTERPOLATE_FCN_PROTOTYPE(MODE##_C64,psC64) 263 PIXEL_INTERPOLATE_FCN_PROTOTYPE(MODE##_F64,psF64) 269 264 270 265 #ifndef SWIG -
trunk/psLib/src/mathtypes/psScalar.c
r11697 r12431 8 8 * @author Ross Harman, MHPCC 9 9 * 10 * @version $Revision: 1.2 7$ $Name: not supported by cvs2svn $11 * @date $Date: 2007-0 2-08 02:42:46$10 * @version $Revision: 1.28 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2007-03-14 00:39:51 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 34 34 unsigned int lineno, 35 35 const char *func, 36 double complexvalue,36 double value, 37 37 psElemType type) 38 38 { … … 75 75 case PS_TYPE_F64: 76 76 scalar->data.F64 = (psF64) value; 77 break;78 case PS_TYPE_C32:79 scalar->data.C32 = (psC32) value;80 break;81 case PS_TYPE_C64:82 scalar->data.C64 = (psC64) value;83 77 break; 84 78 default: … … 148 142 newScalar = p_psScalarAlloc(file, lineno, func, value->data.F64, dataType); 149 143 break; 150 case PS_TYPE_C32:151 newScalar = p_psScalarAlloc(file, lineno, func, value->data.C32, dataType);152 break;153 case PS_TYPE_C64:154 newScalar = p_psScalarAlloc(file, lineno, func, value->data.C64, dataType);155 break;156 144 default: 157 145 psError(PS_ERR_BAD_PARAMETER_TYPE, true, -
trunk/psLib/src/mathtypes/psScalar.h
r11697 r12431 8 8 * @author Joshua Hoblitt, University of Hawaii 9 9 * 10 * @version $Revision: 1.2 2$ $Name: not supported by cvs2svn $11 * @date $Date: 2007-0 2-08 02:42:46$10 * @version $Revision: 1.23 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2007-03-14 00:39:51 $ 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii 13 13 */ … … 41 41 psF32 F32; ///< Single-precision float data. 42 42 psF64 F64; ///< Double-precision float data. 43 psC32 C32; ///< Single-precision complex data.44 psC64 C64; ///< Double-precision complex data.45 43 } data; ///< Union for data types. 46 44 } … … 56 54 * 57 55 * Uses psLib memory allocation functions to create scalar data as defined by the psType type. 58 * Accepts a complex 64 bit float for input value, as max size, but resizes according to 59 * correct type. 56 * Accepts a double for input value, as max size, but resizes according to correct type. 60 57 * 61 58 * @return psScalar* Pointer to a new psScalar. … … 63 60 #ifdef DOXYGEN 64 61 psScalar* psScalarAlloc( 65 double complex value,///< Data to be put into psScalar62 double value, ///< Data to be put into psScalar 66 63 psElemType type ///< Type of data to be held by psScalar 67 64 ); … … 71 68 unsigned int lineno, ///< Line number of caller 72 69 const char *func, ///< Function name of caller 73 double complex value,///< Data to be put into psScalar70 double value, ///< Data to be put into psScalar 74 71 psElemType type ///< Type of data to be held by psScalar 75 72 ); -
trunk/psLib/src/mathtypes/psVector.c
r12381 r12431 10 10 * @author Joshua Hoblitt, University of Hawaii 11 11 * 12 * @version $Revision: 1.9 5$ $Name: not supported by cvs2svn $13 * @date $Date: 2007-03- 09 20:16:40$12 * @version $Revision: 1.96 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2007-03-14 00:39:51 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 33 33 #include "psAssert.h" 34 34 #include "psString.h" 35 36 typedef struct37 {38 union {39 psU8* U8; ///< Unsigned 8-bit integer data.40 psU16* U16; ///< Unsigned 16-bit integer data.41 psU32* U32; ///< Unsigned 32-bit integer data.42 psU64* U64; ///< Unsigned 64-bit integer data.43 psS8* S8; ///< Signed 8-bit integer data.44 psS16* S16; ///< Signed 16-bit integer data.45 psS32* S32; ///< Signed 32-bit integer data.46 psS64* S64; ///< Signed 64-bit integer data.47 psF32* F32; ///< Single-precision float data.48 psF64* F64; ///< Double-precision float data.49 psC32* C32; ///< Single-precision complex data.50 psC64* C64; ///< Double-precision complex data.51 } data;52 psU32 index;53 }54 indexedVector;55 56 static void vectorFree(psVector* psVec);57 35 58 36 static void vectorFree(psVector* psVec) … … 270 248 PSVECTOR_COPY_SAME_CASE(F32); 271 249 PSVECTOR_COPY_SAME_CASE(F64); 272 PSVECTOR_COPY_SAME_CASE(C32);273 PSVECTOR_COPY_SAME_CASE(C64);274 250 default: { 275 251 char* typeStr; … … 326 302 PSVECTOR_COPY(F64,OUTTYPE); \ 327 303 break; \ 328 case PS_TYPE_C32: \329 PSVECTOR_COPY(C32,OUTTYPE); \330 break; \331 case PS_TYPE_C64: \332 PSVECTOR_COPY(C64,OUTTYPE); \333 break; \334 304 default: { \ 335 305 char* typeStr; \ … … 355 325 PSVECTOR_COPY_CASE(F32); 356 326 PSVECTOR_COPY_CASE(F64); 357 PSVECTOR_COPY_CASE(C32);358 PSVECTOR_COPY_CASE(C64);359 327 default: { 360 328 char* typeStr; … … 560 528 break; 561 529 562 #define APPEND_ELEMENTS_CASE_COMPLEX(TYPE,CREAL,CIMAG) \563 case PS_TYPE_##TYPE: \564 for (lcv=0; lcv < size && ! full; lcv++) { \565 snprintf(tempStr, maxLength, "%s%g%+gi", prefix, \566 CREAL(vector->data.TYPE[lcv]), \567 CIMAG(vector->data.TYPE[lcv])); \568 strncat(str,tempStr,maxLength); \569 full = (strlen(str) > maxLength-2); \570 prefix = ","; \571 } \572 break;573 574 530 int lcv; 575 531 char* prefix = "["; … … 585 541 APPEND_ELEMENTS_CASE(F32,double,"%g") 586 542 APPEND_ELEMENTS_CASE(F64,double,"%g") 587 APPEND_ELEMENTS_CASE_COMPLEX(C32,crealf,cimagf)588 APPEND_ELEMENTS_CASE_COMPLEX(C64,creal,cimag)589 543 default: 590 544 snprintf(str,maxLength,"[...]"); … … 822 776 bool psVectorSet(psVector *input, 823 777 long position, 824 double complexvalue)778 double value) 825 779 { 826 780 if (input == NULL) { … … 880 834 input->data.F64[position] = (psF64)value; 881 835 break; 882 case PS_TYPE_C32:883 input->data.C32[position] = (psC32)value;884 break;885 case PS_TYPE_C64:886 input->data.C64[position] = (psC64)value;887 break;888 836 default: 889 837 psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Invalid psVector Data Type\n"); … … 894 842 } 895 843 896 double complexpsVectorGet(const psVector *input,844 double psVectorGet(const psVector *input, 897 845 long position) 898 846 { … … 941 889 case PS_TYPE_F64: 942 890 return input->data.F64[position]; 943 break;944 case PS_TYPE_C32:945 return input->data.C32[position];946 break;947 case PS_TYPE_C64:948 return input->data.C64[position];949 891 break; 950 892 default: … … 992 934 case PS_TYPE_F32: 993 935 case PS_TYPE_F64: 994 case PS_TYPE_C32:995 case PS_TYPE_C64:996 936 default: 997 937 psError(PS_ERR_BAD_PARAMETER_TYPE, true, -
trunk/psLib/src/mathtypes/psVector.h
r12381 r12431 10 10 * @author Joshua Hoblitt, University of Hawaii 11 11 * 12 * @version $Revision: 1.6 6$ $Name: not supported by cvs2svn $13 * @date $Date: 2007-03- 09 20:16:40$12 * @version $Revision: 1.67 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2007-03-14 00:39:51 $ 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii 15 15 */ … … 45 45 psF32* F32; ///< Single-precision float data. 46 46 psF64* F64; ///< Double-precision float data. 47 psC32* C32; ///< Single-precision complex data.48 psC64* C64; ///< Double-precision complex data.49 47 } data; 50 48 void *lock; ///< Optional lock for thread safety. … … 227 225 /** Sort an array of floats. 228 226 * 229 * Sorts an array of floats in ascending order. This function is valid for 230 * all non-complex data types. 227 * Sorts an array of floats in ascending order. 231 228 * 232 229 * @return psVector* Pointer to sorted psVector. … … 334 331 */ 335 332 bool psVectorSet( 336 psVector *input, ///< Input vector to set337 long position, ///< vector position338 double complex value///< value to set333 psVector *input, ///< Input vector to set 334 long position, ///< vector position 335 double value ///< value to set 339 336 ); 340 337 … … 344 341 * A negative position means index from the end. 345 342 * 346 * @return complex: Value of the input vector at the specified position.347 */ 348 double complexpsVectorGet(343 * @return double: Value of the input vector at the specified position. 344 */ 345 double psVectorGet( 349 346 const psVector *input, ///< Input vector from which to get value 350 347 long position ///< vector position -
trunk/psLib/src/sys/psType.h
r11694 r12431 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1.5 6$ $Name: not supported by cvs2svn $13 * @date $Date: 2007-0 2-08 01:59:28$12 * @version $Revision: 1.57 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2007-03-14 00:39:51 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 22 22 /// @{ 23 23 24 #include <complex.h>25 24 #include <stdint.h> 26 25 #include <float.h> … … 50 49 typedef float psF32; ///< 32-bit floating point 51 50 typedef double psF64; ///< 64-bit floating point 52 53 #ifdef SWIG54 /** 32-bit complex value */55 typedef struct56 {57 float re, im;58 }59 psC32;60 61 62 /** 64-bit complex value */63 typedef struct64 {65 double re,im;66 }67 psC64;68 69 70 #else // SWIG71 typedef float complex psC32; ///< complex with 32-bit floating point Real and Imagary numbers72 typedef double complex psC64; ///< complex with 64-bit floating point Real and Imagary numbers73 #endif // !SWIG74 75 51 typedef char* psString; ///< string value 76 52 typedef void* psPtr; ///< void pointer 53 77 54 // XXX psBool can't be removed until all macros that 'generate' this type are 78 55 // fixed -JH … … 98 75 PS_TYPE_F32 = 0x0404, ///< Single-precision Floating point. 99 76 PS_TYPE_F64 = 0x0408, ///< Double-precision floating point. 100 PS_TYPE_C32 = 0x0808, ///< Complex numbers consisting of single-precision floating point.101 PS_TYPE_C64 = 0x0810, ///< Complex numbers consisting of double-precision floating point.102 77 PS_TYPE_BOOL = 0x1301 ///< Boolean. 103 78 } psElemType; … … 170 145 #define PS_MIN_F32 -FLT_MAX /**< minimum valid psF32 value */ 171 146 #define PS_MIN_F64 -DBL_MAX /**< minimum valid psF64 value */ 172 #define PS_MIN_C32 -FLT_MAX /**< minimum valid real or imaginary psC32 value */173 #define PS_MIN_C64 -DBL_MAX /**< minimum valid real or imaginary psC32 value */174 147 175 148 #define PS_MAX_S8 INT8_MAX /**< maximum valid psS8 value */ … … 183 156 #define PS_MAX_F32 FLT_MAX /**< maximum valid psF32 value */ 184 157 #define PS_MAX_F64 DBL_MAX /**< maximum valid psF64 value */ 185 #define PS_MAX_C32 FLT_MAX /**< maximum valid real or imaginary psC32 value */186 #define PS_MAX_C64 DBL_MAX /**< maximum valid real or imaginary psC32 value */187 158 188 159 #define PS_TYPE_BOOL_NAME "psBool" … … 197 168 #define PS_TYPE_F32_NAME "psF32" 198 169 #define PS_TYPE_F64_NAME "psF64" 199 #define PS_TYPE_C32_NAME "psC32"200 #define PS_TYPE_C64_NAME "psC64"201 170 202 171 #define PS_TYPE_NAME(value,type) \ … … 234 203 case PS_TYPE_F64: \ 235 204 value = PS_TYPE_F64_NAME; \ 236 break; \237 case PS_TYPE_C32: \238 value = PS_TYPE_C32_NAME; \239 break; \240 case PS_TYPE_C64: \241 value = PS_TYPE_C64_NAME; \242 205 break; \ 243 206 default: \ … … 261 224 /// Macro to determine if the psElemType is unsigned. 262 225 #define PS_IS_PSELEMTYPE_UNSIGNED(x) ((x & 0x200) == 0x200) 263 /// Macro to determine if the psElemType is a real (non-complex)floating-point type.226 /// Macro to determine if the psElemType is a real floating-point type. 264 227 #define PS_IS_PSELEMTYPE_REAL(x) ((x & 0x400) == 0x400) 265 /// Macro to determine if the psElemType is complex number type.266 #define PS_IS_PSELEMTYPE_COMPLEX(x) ((x & 0x800) == 0x800)267 228 /// Macro to determine if the psElemType is boolean type. 268 229 #define PS_IS_PSELEMTYPE_BOOL(x) ((x & 0x1000) == 0x1000) -
trunk/psLib/test/imageops/tap_psImageGeomManip.c
r12250 r12431 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $9 * @date $Date: 2007-03- 06 02:37:41 $8 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2007-03-14 00:39:51 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 531 531 testRollType(S16); 532 532 testRollType(F64); 533 testRollType(C32);534 testRollType(C64);535 533 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 536 534 } -
trunk/psLib/test/imageops/tap_psImageInterpolate.c
r11398 r12431 5 5 * @author Eric Van Alst, MHPCC 6 6 * 7 * @version $Revision: 1. 1$7 * @version $Revision: 1.2 $ 8 8 * $Name: not supported by cvs2svn $ 9 * @date $Date: 2007-0 1-30 00:13:01 $9 * @date $Date: 2007-03-14 00:39:51 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 68 68 CHECK_INTERP_BY_TYPE(F32) 69 69 CHECK_INTERP_BY_TYPE(F64) 70 CHECK_INTERP_BY_TYPE(C32)71 CHECK_INTERP_BY_TYPE(C64)72 70 73 71 // testInterpolateError(void) -
trunk/psLib/test/imageops/tap_psImagePixelManip.c
r12405 r12431 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $9 * @date $Date: 2007-03-1 2 20:46:45$8 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2007-03-14 00:39:51 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 96 96 } 97 97 98 #define testImageClipByComplexType(datatype) \99 { \100 psU32 c = 128; \101 psU32 r = 256; \102 psF64 min; \103 psF64 max; \104 psS32 numClipped = 0; \105 psS32 retVal; \106 psMemId id = psMemGetId(); \107 psImage *img = psImageAlloc(c,r,PS_TYPE_##datatype); \108 for (psU32 row=0;row<r;row++) { \109 ps##datatype* imgRow = img->data.datatype[row]; \110 for (psU32 col=0;col<c;col++) { \111 imgRow[col] = (ps##datatype)(row+I*col); \112 } \113 } \114 min = (float)r/2.0f; \115 max = (float)r; \116 \117 retVal = psImageClip(img,min,-1.0f,max,-2.0f); \118 \119 numClipped = 0; \120 bool errorFlag = false; \121 for (psU32 row=0;row<r;row++) { \122 ps##datatype* imgRow = img->data.datatype[row]; \123 for (psU32 col=0;col<c;col++) { \124 ps##datatype value = row+I*col; \125 if (cabs(value) < min) { \126 numClipped++; \127 value = -1.0f; \128 } else if (cabs(value) > max) { \129 numClipped++; \130 value = -2.0f; \131 } \132 if (fabsf(creal(imgRow[col])-creal(value)) > FLT_EPSILON || \133 fabsf(cimag(imgRow[col])-cimag(value)) > FLT_EPSILON) { \134 diag("Pixel value is not as expected (%.2f+%.2fi vs %.2f+%.2fi) at %u,%u", \135 creal(imgRow[col]),cimag(imgRow[col]),creal(value),cimag(value),col,row); \136 errorFlag = true; \137 } \138 } \139 } \140 ok(!errorFlag, "psImageClip() produced the correct data values"); \141 ok(retVal == numClipped, "Got the expected number of clips"); \142 psFree(img); \143 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); \144 }145 146 98 testImageClipByType(F64); 147 99 testImageClipByType(F32); … … 152 104 testImageClipByType(U16); 153 105 testImageClipByType(U8); 154 testImageClipByComplexType(C32);155 testImageClipByComplexType(C64);156 157 106 158 107 psF64 min=0.0; … … 241 190 testImageClipNaNByType(F32); 242 191 testImageClipNaNByType(F64); 243 testImageClipNaNByType(C32);244 testImageClipNaNByType(C64);245 192 246 193 // Verify the retuned integer is zero, psImage structure input is unmodified … … 251 198 252 199 // Verify program execution doesn't stop if the input image type is something 253 // other than F32, F64 , C32, C64.200 // other than F32, F64. 254 201 img = psImageAlloc(c,r,PS_TYPE_S32); 255 202 // Following should be an error (incorrect type) … … 260 207 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 261 208 } 262 263 264 // testImageClipComplexRegion()265 {266 psMemId id = psMemGetId();267 psImage* img = NULL;268 psU32 c = 1024;269 psU32 r = 2048;270 psS32 numClipped = 0;271 psS32 retVal;272 273 // psImageClipNaN shall modified pixel values of NaN with a specified value274 275 // 1. Create a complex image with a wide range of complex values276 //277 // 2. call psImageClipComplexRegion with min and max where there is at least278 // 2 pixels in the image above) that is:279 // a) real(p) < real(min) && complex(p) < complex(min),280 // b) real(p) < real(min) && complex(min) < complex(p) < complex(max)281 // c) real(min) < real(p) < real(max) && complex(p) < complex(min)282 // d) real(min) < real(p) < real(max) && complex(min) < complex(p) < complex(max)283 // e) real(p) > real(max) && complex(min) < complex(p) < complex(max)284 // f) real(pmin) < real(p) < real(max) && complex(p) > complex(max)285 // g) real(p) > real(max) && complex(p) > complex(max)286 // h) real(p) < real(min) && complex(p) > complex(max)287 // i) real(p) > real(max) && complex(p) < complex(min)288 //289 // 3. verify that All pixels in case (a), (b), and (c) have the value vmin290 //291 // 4. verify that all pixels in case (d) are unchanged from input292 //293 // 5. verify that all pixels in case (e), (f), (g), (h), and (i) have the294 // value vmax295 #define testImageClipComplexByType(datatype,MIN,MAX) \296 { \297 psMemId id = psMemGetId(); \298 img = psImageAlloc(c,r,PS_TYPE_##datatype); \299 for (unsigned row=0;row<r;row++) { \300 ps##datatype* imgRow = img->data.datatype[row]; \301 for (unsigned col=0;col<c;col++) { \302 imgRow[col] = row+I*col; \303 } \304 } \305 \306 retVal = psImageClipComplexRegion(img,MIN,-1.0-1.0*I,MAX,-2.0-2.0*I); \307 \308 numClipped = 0; \309 bool errorFlag = false; \310 for (unsigned row=0;row<r;row++) { \311 ps##datatype* imgRow = img->data.datatype[row]; \312 for (unsigned col=0;col<c;col++) { \313 ps##datatype value = (ps##datatype)(row+I*col); \314 if ( (row > creal(MAX)) || (col > cimag(MAX)) ) { \315 numClipped++; \316 value = -2.0-2.0*I; \317 } else if ((row < creal(MIN)) || (col < cimag(MIN)) ) { \318 numClipped++; \319 value = -1.0-1.0*I; \320 } \321 if (cabs(imgRow[col]-value) > FLT_EPSILON) { \322 diag("Pixel value is not as expected (%g%+gi vs %g%+gi) at %d,%d", \323 creal(imgRow[col]),cimag(imgRow[col]),creal(value),cimag(value),col,row); \324 errorFlag = true; \325 } \326 } \327 } \328 ok(!errorFlag, "psImageClip() produced the correct data values"); \329 ok(retVal == numClipped, "Got the expected number of clips"); \330 psFree(img); \331 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); \332 }333 334 complex double min = ((double)r)/5.0+I*((double)c)/4.0;335 complex double max = ((double)r)/3.0+I*((double)c)/2.0;336 337 // Testing clipping at %g%+gi to %g%+gi for psC32, creal(min),cimag(min),creal(max),cimag(max));338 339 testImageClipComplexByType(C32,min,max);340 341 // Testing clipping at %g%+gi to %g%+gi for psC64, creal(min),cimag(min),creal(max),cimag(max));342 testImageClipComplexByType(C64,min,max);343 344 // 6. Call psImageClipComplexRegion with NULL input parameter; should error345 // but not stop execution.346 // Following should be an error347 // XXX: Verify error348 retVal = psImageClipComplexRegion(NULL,0,0,0,0);349 ok(retVal == 0, "Expected zero return for clips of a NULL image");350 351 img = psImageAlloc(c,r,PS_TYPE_C32);352 for (unsigned row=0;row<r;row++)353 {354 psC32* imgRow = img->data.C32[row];355 for (unsigned col=0;col<c;col++) {356 imgRow[col] = row+I*col;357 }358 }359 360 // 7. Call psImageClipComplexRegion with min > max; should error and return 0,361 // but not stop execution362 // Following should be an error363 // XXX: Verify error364 retVal = psImageClipComplexRegion(img,10.0+I*1.0,-1.0,5.0+5.0*I,-2.0);365 ok(retVal == 0, "Expected zero return for creal(min)>creal(max)");366 367 // Following should be an error368 // XXX: Verify error369 retVal = psImageClipComplexRegion(img,1.0+I*10.0,-1.0,5.0+5.0*I,-2.0);370 ok(retVal == 0, "Expected zero return for cimag(min)>cimag(max)");371 372 // Following should be an error373 // XXX: Verify error374 retVal = psImageClipComplexRegion(img,10.0+I*10.0,-1.0,5.0+5.0*I,-2.0);375 ok(retVal == 0, "Expected zero return for min>max");376 377 // 8. Call psImageClipComplexRegion with the follow vmin/vmax values; each378 // should error and return 0, but not stop execution379 // a) vmin < datatype region's minimum380 // b) vmax < datatype region's minimum381 // c) vmin > datatype region's maximum382 // d) vmax > datatype region's maximum383 // Following should be an error384 // XXX: Verify error385 retVal = psImageClipComplexRegion(img,386 1.0+I*1.0,387 -2.0*(double)FLT_MAX,388 5.0+5.0*I,389 0.0);390 ok(retVal == 0, "Expected zero return for vmin not in datatype range");391 392 // Following should be an error393 // XXX: Verify error394 retVal = psImageClipComplexRegion(img,395 1.0+I*1.0,396 2.0*(double)FLT_MAX,397 5.0+5.0*I,398 0.0);399 ok(retVal == 0, "Expected zero return for vmin not in datatype range");400 401 // Following should be an error402 // XXX: Verify error403 retVal = psImageClipComplexRegion(img,404 1.0+I*1.0,405 FLT_EPSILON-2.0*(double)FLT_MAX*I,406 5.0+5.0*I,407 0.0);408 ok(retVal == 0, "Expected zero return for vmin not in datatype range");409 410 // Following should be an error411 // XXX: Verify error412 retVal = psImageClipComplexRegion(img,413 1.0+I*1.0,414 FLT_EPSILON+2.0*(double)FLT_MAX*I,415 5.0+5.0*I,416 0.0);417 ok(retVal == 0, "Expected zero return for vmin not in datatype range");418 419 // Following should be an error420 // XXX: Verify error421 retVal = psImageClipComplexRegion(img,422 1.0+I*1.0,423 0.0,424 5.0+5.0*I,425 -2.0*(double)FLT_MAX);426 ok(retVal == 0, "Expected zero return for vmax not in datatype range");427 428 // Following should be an error429 // XXX: Verify error430 retVal = psImageClipComplexRegion(img,431 1.0+I*1.0,432 0.0,433 5.0+5.0*I,434 2.0*(double)FLT_MAX);435 ok(retVal == 0, "Expected zero return for vmax not in datatype range");436 437 // Following should be an error438 // XXX: Verify error439 retVal = psImageClipComplexRegion(img,440 1.0+I*1.0,441 0.0,442 5.0+5.0*I,443 FLT_EPSILON-2.0*(double)FLT_MAX*I);444 ok(retVal == 0, "Expected zero return for vmax not in datatype range");445 446 // Following should be an error447 // XXX: Verify error448 retVal = psImageClipComplexRegion(img,449 1.0+I*1.0,450 0.0,451 5.0+5.0*I,452 FLT_EPSILON+2.0*(double)FLT_MAX*I);453 ok(retVal == 0, "Expected zero return for vmax not in datatype range");454 455 // now check if vmin > vmax is OK456 for (unsigned row=0;row<r;row++)457 {458 psC32* imgRow = img->data.C32[row];459 for (unsigned col=0;col<c;col++) {460 imgRow[col] = row+I*col;461 }462 }463 retVal = psImageClipComplexRegion(img,464 1.0+I*1.0,465 10.0,466 5.0+5.0*I,467 0.0);468 ok(retVal != 0, "Didn't expect zero return for vmin > vmax");469 psFree(img);470 img = NULL;471 472 // 9. Call psImageClipComplexRegion with the max value out of datatype's473 // range; should clip as expected (see step 1-5). Repeat with min value474 // out of datatype's range.475 476 testImageClipComplexByType(C32,-(double)FLT_MAX*2.0-I*(double)FLT_MAX*2.0,10.0+I*10.0);477 testImageClipComplexByType(C32,10.0+I*10.0,(double)FLT_MAX*2.0+I*(double)FLT_MAX*2.0);478 479 // Verify program execution doesn't stop if the input image type is something480 // other than C32, C64.481 img = psImageAlloc(c,r,PS_TYPE_S32);482 // Following should be an error (incorrect type)483 // XXX: Verify error484 retVal = psImageClipComplexRegion(img,2.0,10.0,5.0,0.0);485 ok(retVal == 0, "Expected zero return for clip of incorrect image type");486 psFree(img);487 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");488 }489 490 209 491 210 // testImageOverlay() … … 568 287 569 288 570 // testOverlayType(C64);571 // testOverlayType(C32);572 289 // testOverlayType(F64); 573 290 // testOverlayType(F32); -
trunk/psLib/test/math/tap_psMatrix02.c
r10816 r12431 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $15 * @date $Date: 200 6-12-20 20:02:29$14 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2007-03-14 00:39:51 $ 16 16 * 17 17 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 56 56 psMemId id = psMemGetId(); 57 57 psImage *outImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64); 58 psImage *badImage1 = (psImage*)psImageAlloc(3, 3, PS_TYPE_ C32);58 psImage *badImage1 = (psImage*)psImageAlloc(3, 3, PS_TYPE_U8); 59 59 psMemIncrRefCounter(outImage); 60 60 ok(psMatrixTranspose(outImage, badImage1) == NULL, "psMatrixTranspose(): inImage = outImage results in NULL return"); … … 69 69 psMemId id = psMemGetId(); 70 70 psImage *inImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64); 71 psImage *badImage1 = (psImage*)psImageAlloc(3, 3, PS_TYPE_ C32);71 psImage *badImage1 = (psImage*)psImageAlloc(3, 3, PS_TYPE_U8); 72 72 badImage1 = psMatrixTranspose(badImage1, inImage); 73 73 ok(badImage1 != NULL, "psMatrixTranspose() results in non-NULL return"); -
trunk/psLib/test/math/tap_psMatrixVectorArithmetic01.c
r11397 r12431 4 4 * 5 5 * This test driver tests combinations of matrix, vector, and scalar binary operations including: 6 * Matrix-matrix with +,-,*,/ with S32, F32, F64 , C327 * Matrix-vector with +,-,*,/ with S32, F32, F64 , C328 * Matrix-scalar with +,-,*,/ with S32, F32, F64 , C326 * Matrix-matrix with +,-,*,/ with S32, F32, F64 7 * Matrix-vector with +,-,*,/ with S32, F32, F64 8 * Matrix-scalar with +,-,*,/ with S32, F32, F64 9 9 * 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $13 * @date $Date: 2007-0 1-30 00:11:31 $12 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2007-03-14 00:39:51 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 140 140 ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-matrix, +, F64)"); 141 141 ok(memoryFlag== false, "no memory leaks"); 142 testBinaryOpMM(+,C32,10.0+10.0i,10.0+10.0i,3,2,errorFlag,memoryFlag);143 ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-matrix, +, C32)");144 ok(memoryFlag== false, "no memory leaks");145 142 testBinaryOpMM(-,S32,20,10,3,2,errorFlag,memoryFlag); 146 143 ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-matrix, -, S32)"); … … 161 158 ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-matrix, *, F64)"); 162 159 ok(memoryFlag== false, "no memory leaks"); 163 testBinaryOpMM(*,C32,20.0+20.0i,10.0+10.0i,3,2,errorFlag,memoryFlag);164 ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-matrix, *, C32)");165 ok(memoryFlag== false, "no memory leaks");166 160 testBinaryOpMM(/,S32,20,10,3,2,errorFlag,memoryFlag); 167 161 ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-matrix, /, S32)"); … … 172 166 testBinaryOpMM(/,F64,20.0,10.0,3,2,errorFlag,memoryFlag); 173 167 ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-matrix, /, F64)"); 174 ok(memoryFlag== false, "no memory leaks");175 testBinaryOpMM(/,C32,20.0+20.0i,10.0+10.0i,3,2,errorFlag,memoryFlag);176 ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-matrix, /, C32)");177 168 ok(memoryFlag== false, "no memory leaks"); 178 169 … … 187 178 ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-vector, +, F64)"); 188 179 ok(memoryFlag== false, "no memory leaks"); 189 testBinaryOpMV(+,C32,10.0+10.0i,5.0+5.0i,3,2,errorFlag,memoryFlag);190 ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-vector, +, C32)");191 ok(memoryFlag== false, "no memory leaks");192 180 testBinaryOpMV(-,S32,20,5,3,2,errorFlag,memoryFlag); 193 181 ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-vector, -, S32)"); … … 208 196 ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-vector, *, F64)"); 209 197 ok(memoryFlag== false, "no memory leaks"); 210 testBinaryOpMV(*,C32,20.0+20.0i,5.0+5.0i,3,2,errorFlag,memoryFlag);211 ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-vector, *, C32)");212 ok(memoryFlag== false, "no memory leaks");213 198 testBinaryOpMV(/,S32,20,5,3,2,errorFlag,memoryFlag); 214 199 ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-vector, /, S32)"); … … 219 204 testBinaryOpMV(/,F64,20.0,5.0,3,2,errorFlag,memoryFlag); 220 205 ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-vector, /, F64)"); 221 ok(memoryFlag== false, "no memory leaks");222 testBinaryOpMV(/,C32,20.0+20.0i,5.0+5.0i,3,2,errorFlag,memoryFlag);223 ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-vector, /, C32)");224 206 ok(memoryFlag== false, "no memory leaks"); 225 207 … … 234 216 ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-scalar, +, F64)"); 235 217 ok(memoryFlag== false, "no memory leaks"); 236 testBinaryOpMS(+,C32,10.0+10.0i,5.0+5.0i,3,2,errorFlag,memoryFlag);237 ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-scalar, +, C32)");238 ok(memoryFlag== false, "no memory leaks");239 218 testBinaryOpMS(-,S32,20,5,3,2,errorFlag,memoryFlag); 240 219 ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-scalar, -, S32)"); … … 255 234 ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-scalar, *, F64)"); 256 235 ok(memoryFlag== false, "no memory leaks"); 257 testBinaryOpMS(*,C32,20.0+20.0i,5.0+5.0i,3,2,errorFlag,memoryFlag);258 ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-scalar, *, C32)");259 ok(memoryFlag== false, "no memory leaks");260 236 testBinaryOpMS(/,S32,20,5,3,2,errorFlag,memoryFlag); 261 237 ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-scalar, /, S32)"); … … 267 243 ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-scalar, /, F64)"); 268 244 ok(memoryFlag== false, "no memory leaks"); 269 testBinaryOpMS(/,C32,20.0+20.0i,5.0+5.0i,3,2,errorFlag,memoryFlag);270 ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-scalar, /, C32)");271 ok(memoryFlag== false, "no memory leaks");272 245 return 0; 273 246 } -
trunk/psLib/test/math/tap_psMatrixVectorArithmetic02.c
r10945 r12431 5 5 * 6 6 * This test driver tests combinations of matrix, vector, and scalar unary operations including: 7 * Matrix with all math operators with S32, F32, F64 , C328 * Vector with all math operators with S32, F32, F64 , C327 * Matrix with all math operators with S32, F32, F64 8 * Vector with all math operators with S32, F32, F64 9 9 * 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $13 * @date $Date: 2007-0 1-06 00:48:54$12 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2007-03-14 00:39:51 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 142 142 ok(errorFlag== false, "psUnaryOp(): abs was successful"); 143 143 ok(memoryFlag== false, "no memory leaks"); 144 testUnaryOpM( abs, C32, -10.0 - 10.0i, 0.0 + 0.0i, 3, 2,10+10i, errorFlag, memoryFlag);145 ok(errorFlag== false, "psUnaryOp(): abs was successful");146 ok(memoryFlag== false, "no memory leaks");147 144 testUnaryOpM( exp, S32, 10, 0, 3, 2, exp(10), errorFlag, memoryFlag); 148 145 ok(errorFlag== false, "psUnaryOp(): exp was successful"); … … 154 151 ok(errorFlag== false, "psUnaryOp(): exp was successful"); 155 152 ok(memoryFlag== false, "no memory leaks"); 156 testUnaryOpM( exp, C32, 1.0 + 1.0i, 0.0 + 0.0i, 3, 2, cexp(1.0+1.0i), errorFlag, memoryFlag);157 ok(errorFlag== false, "psUnaryOp(): exp was successful");158 ok(memoryFlag== false, "no memory leaks");159 153 testUnaryOpM( ln, S32, 10, 0, 3, 2, clog(10), errorFlag, memoryFlag); 160 154 ok(errorFlag== false, "psUnaryOp(): ln was successful"); … … 166 160 ok(errorFlag== false, "psUnaryOp(): ln was successful"); 167 161 ok(memoryFlag== false, "no memory leaks"); 168 testUnaryOpM( ln, C32, 10.0 + 10.0i, 0.0 + 0.0i, 3, 2, clog(10.0+10.0i), errorFlag, memoryFlag);169 ok(errorFlag== false, "psUnaryOp(): ln was successful");170 ok(memoryFlag== false, "no memory leaks");171 162 testUnaryOpM( ten, S32, 3, 0, 3, 2, 1000, errorFlag, memoryFlag); 172 163 ok(errorFlag== false, "psUnaryOp(): ten was successful"); … … 178 169 ok(errorFlag== false, "psUnaryOp(): ten was successful"); 179 170 ok(memoryFlag== false, "no memory leaks"); 180 testUnaryOpM( ten, C32, 1.0 + 0.0i, 0.0 + 0.0i, 3, 2, 10.0, errorFlag, memoryFlag);181 ok(errorFlag== false, "psUnaryOp(): ten was successful");182 ok(memoryFlag== false, "no memory leaks");183 171 testUnaryOpM( log, S32, 1000, 0, 3, 2, 3, errorFlag, memoryFlag); 184 172 ok(errorFlag== false, "psUnaryOp(): log was successful"); … … 190 178 ok(errorFlag== false, "psUnaryOp(): log was successful"); 191 179 ok(memoryFlag== false, "no memory leaks"); 192 testUnaryOpM( log, C32, 1000.0 + 0.0i, 0.0 + 0.0i, 3, 2, 3, errorFlag, memoryFlag);193 ok(errorFlag== false, "psUnaryOp(): log was successful");194 ok(memoryFlag== false, "no memory leaks");195 180 testUnaryOpM( sin, S32, M_PI_2, 0, 3, 2, 1, errorFlag, memoryFlag); 196 181 ok(errorFlag== false, "psUnaryOp(): sin was successful"); … … 202 187 ok(errorFlag== false, "psUnaryOp(): sin was successful"); 203 188 ok(memoryFlag== false, "no memory leaks"); 204 testUnaryOpM( sin, C32, M_PI_2 + 0.0i, 0.0 + 0.0i, 3, 2, 1.0, errorFlag, memoryFlag);205 ok(errorFlag== false, "psUnaryOp(): sin was successful");206 ok(memoryFlag== false, "no memory leaks");207 189 testUnaryOpM( dsin, S32, 90, 0, 3, 2 , 1, errorFlag, memoryFlag); 208 190 ok(errorFlag== false, "psUnaryOp(): dsin was successful"); … … 214 196 ok(errorFlag== false, "psUnaryOp(): dsin was successful"); 215 197 ok(memoryFlag== false, "no memory leaks"); 216 testUnaryOpM( dsin, C32, 90.0 + 00.0i, 0.0 + 0.0i, 3, 2, 1.0, errorFlag, memoryFlag);217 ok(errorFlag== false, "psUnaryOp(): dsin was successful");218 ok(memoryFlag== false, "no memory leaks");219 198 testUnaryOpM( cos, S32, 0, 0, 3, 2, 1, errorFlag, memoryFlag); 220 199 ok(errorFlag== false, "psUnaryOp(): cos was successful"); … … 226 205 ok(errorFlag== false, "psUnaryOp(): cos was successful"); 227 206 ok(memoryFlag== false, "no memory leaks"); 228 testUnaryOpM( cos, C32, 0.0 + 0.0i, 0.0 + 0.0i, 3, 2, 1.0, errorFlag, memoryFlag);229 ok(errorFlag== false, "psUnaryOp(): cos was successful");230 ok(memoryFlag== false, "no memory leaks");231 207 testUnaryOpM( dcos, S32, 0, 0, 3, 2, 1, errorFlag, memoryFlag); 232 208 ok(errorFlag== false, "psUnaryOp(): dcos was successful"); … … 238 214 ok(errorFlag== false, "psUnaryOp(): dcos was successful"); 239 215 ok(memoryFlag== false, "no memory leaks"); 240 testUnaryOpM( dcos, C32, 0.0 + 0.0i, 0.0 + 0.0i, 3, 2, 1.0, errorFlag, memoryFlag);241 ok(errorFlag== false, "psUnaryOp(): dcos was successful");242 ok(memoryFlag== false, "no memory leaks");243 216 testUnaryOpM( tan, S32, M_PI_4, 0, 3, 2, 1, errorFlag, memoryFlag); 244 217 ok(errorFlag== false, "psUnaryOp(): tan was successful"); … … 250 223 ok(errorFlag== false, "psUnaryOp(): tan was successful"); 251 224 ok(memoryFlag== false, "no memory leaks"); 252 testUnaryOpM( tan, C32, M_PI_4 + 0.0i, 0.0 + 0.0i, 3, 2, 1, errorFlag, memoryFlag);253 ok(errorFlag== false, "psUnaryOp(): tan was successful");254 ok(memoryFlag== false, "no memory leaks");255 225 testUnaryOpM( dtan, S32, 45, 0, 3, 2, 1, errorFlag, memoryFlag); 256 226 ok(errorFlag== false, "psUnaryOp(): dtan was successful"); … … 262 232 ok(errorFlag== false, "psUnaryOp(): dtan was successful"); 263 233 ok(memoryFlag== false, "no memory leaks"); 264 testUnaryOpM( dtan, C32, 45.0 + 45.0i, 0.0 + 0.0i, 3, 2, 1.0, errorFlag, memoryFlag);265 ok(errorFlag== false, "psUnaryOp(): dtan was successful");266 ok(memoryFlag== false, "no memory leaks");267 234 testUnaryOpM( asin, S32, 1, 0, 3, 2, M_PI_2, errorFlag, memoryFlag); 268 235 ok(errorFlag== false, "psUnaryOp(): asin was successful"); … … 274 241 ok(errorFlag== false, "psUnaryOp(): asin was successful"); 275 242 ok(memoryFlag== false, "no memory leaks"); 276 testUnaryOpM( asin, C32, 1.0 + 1.0i, 0.0 + 0.0i, 3, 2, M_PI_2, errorFlag, memoryFlag);277 ok(errorFlag== false, "psUnaryOp(): asin was successful");278 ok(memoryFlag== false, "no memory leaks");279 243 testUnaryOpM( dasin, S32, 1.0, 0, 3, 2, 90, errorFlag, memoryFlag); 280 244 ok(errorFlag== false, "psUnaryOp(): dasin was successful"); … … 286 250 ok(errorFlag== false, "psUnaryOp(): dasin was successful"); 287 251 ok(memoryFlag== false, "no memory leaks"); 288 testUnaryOpM( dasin, C32, 1.0 + 1.0i, 0.0 + 0.0i, 3, 2, 90.0, errorFlag, memoryFlag);289 ok(errorFlag== false, "psUnaryOp(): dasin was successful");290 ok(memoryFlag== false, "no memory leaks");291 252 testUnaryOpM( acos, S32, 0, 0, 3, 2, M_PI_2, errorFlag, memoryFlag); 292 253 ok(errorFlag== false, "psUnaryOp(): acos was successful"); … … 298 259 ok(errorFlag== false, "psUnaryOp(): acos was successful"); 299 260 ok(memoryFlag== false, "no memory leaks"); 300 testUnaryOpM( acos, C32, 0.0 + 0.0i, 0.0 + 0.0i, 3, 2, M_PI_2, errorFlag, memoryFlag);301 ok(errorFlag== false, "psUnaryOp(): acos was successful");302 ok(memoryFlag== false, "no memory leaks");303 261 testUnaryOpM( dacos, S32, 0, 0, 3, 2, 90, errorFlag, memoryFlag); 304 262 ok(errorFlag== false, "psUnaryOp(): dacos was successful"); … … 310 268 ok(errorFlag== false, "psUnaryOp(): dacos was successful"); 311 269 ok(memoryFlag== false, "no memory leaks"); 312 testUnaryOpM( dacos, C32, 0.0 + 0.0i, 0.0 + 0.0i, 3, 2, 90.0, errorFlag, memoryFlag);313 ok(errorFlag== false, "psUnaryOp(): dacos was successful");314 ok(memoryFlag== false, "no memory leaks");315 270 testUnaryOpM( atan, S32, 1, 0, 3, 2, M_PI_4, errorFlag, memoryFlag); 316 271 ok(errorFlag== false, "psUnaryOp(): atan was successful"); … … 322 277 ok(errorFlag== false, "psUnaryOp(): atan was successful"); 323 278 ok(memoryFlag== false, "no memory leaks"); 324 testUnaryOpM( atan, C32, 1.0 + 0.0i, 0.0 + 0.0i, 3, 2, M_PI_4, errorFlag, memoryFlag);325 ok(errorFlag== false, "psUnaryOp(): atan was successful");326 ok(memoryFlag== false, "no memory leaks");327 279 testUnaryOpM( datan, S32, 1, 0, 3, 2, 45, errorFlag, memoryFlag); 328 280 ok(errorFlag== false, "psUnaryOp(): datan was successful"); … … 334 286 ok(errorFlag== false, "psUnaryOp(): datan was successful"); 335 287 ok(memoryFlag== false, "no memory leaks"); 336 testUnaryOpM( datan, C32, 1.0 + 0.0i, 0.0 + 0.0i, 3, 2, 45.0, errorFlag, memoryFlag);337 ok(errorFlag== false, "psUnaryOp(): datan was successful");338 ok(memoryFlag== false, "no memory leaks");339 288 340 289 testUnaryOpV( abs, S32, -10, 0, 3, 10, errorFlag, memoryFlag); … … 347 296 ok(errorFlag== false, "psUnaryOp(): abs was successful"); 348 297 ok(memoryFlag== false, "no memory leaks"); 349 testUnaryOpV( abs, C32, -10.0 - 10.0i, 0.0 + 0.0i, 3, 10+10i, errorFlag, memoryFlag);350 ok(errorFlag== false, "psUnaryOp(): abs was successful");351 ok(memoryFlag== false, "no memory leaks");352 298 testUnaryOpV( exp, S32, 10, 0, 3, cexp(10), errorFlag, memoryFlag); 353 299 ok(errorFlag== false, "psUnaryOp(): exp was successful"); … … 359 305 ok(errorFlag== false, "psUnaryOp(): exp was successful"); 360 306 ok(memoryFlag== false, "no memory leaks"); 361 testUnaryOpV( exp, C32, 1.0 + 1.0i, 0.0 + 0.0i, 3, cexp(1.0+1.0i), errorFlag, memoryFlag);362 ok(errorFlag== false, "psUnaryOp(): exp was successful");363 ok(memoryFlag== false, "no memory leaks");364 307 testUnaryOpV( ln, S32, 10, 0, 3, clog(10), errorFlag, memoryFlag); 365 308 ok(errorFlag== false, "psUnaryOp(): ln was successful"); … … 371 314 ok(errorFlag== false, "psUnaryOp(): ln was successful"); 372 315 ok(memoryFlag== false, "no memory leaks"); 373 testUnaryOpV( ln, C32, 10.0 + 10.0i, 0.0 + 0.0i, 3, clog(10.0+10.0i), errorFlag, memoryFlag);374 ok(errorFlag== false, "psUnaryOp(): ln was successful");375 ok(memoryFlag== false, "no memory leaks");376 316 testUnaryOpV( ten, S32, 3, 0, 3, 1000, errorFlag, memoryFlag); 377 317 ok(errorFlag== false, "psUnaryOp(): ten was successful"); … … 383 323 ok(errorFlag== false, "psUnaryOp(): ten was successful"); 384 324 ok(memoryFlag== false, "no memory leaks"); 385 testUnaryOpV( ten, C32, 1.0 + 0.0i, 0.0 + 0.0i, 3, 10.0, errorFlag, memoryFlag);386 ok(errorFlag== false, "psUnaryOp(): ten was successful");387 ok(memoryFlag== false, "no memory leaks");388 325 testUnaryOpV( log, S32, 1000, 0, 3, 3, errorFlag, memoryFlag); 389 326 ok(errorFlag== false, "psUnaryOp(): log was successful"); … … 395 332 ok(errorFlag== false, "psUnaryOp(): log was successful"); 396 333 ok(memoryFlag== false, "no memory leaks"); 397 testUnaryOpV( log, C32, 1000.0 + 0.0i, 0.0 + 0.0i, 3, 3, errorFlag, memoryFlag);398 ok(errorFlag== false, "psUnaryOp(): log was successful");399 ok(memoryFlag== false, "no memory leaks");400 334 testUnaryOpV( sin, S32, M_PI_2, 0, 3, 1, errorFlag, memoryFlag); 401 335 ok(errorFlag== false, "psUnaryOp(): sin was successful"); … … 407 341 ok(errorFlag== false, "psUnaryOp(): sin was successful"); 408 342 ok(memoryFlag== false, "no memory leaks"); 409 testUnaryOpV( sin, C32, M_PI_2 + 0.0i, 0.0 + 0.0i, 3, 1.0, errorFlag, memoryFlag);410 ok(errorFlag== false, "psUnaryOp(): sin was successful");411 ok(memoryFlag== false, "no memory leaks");412 343 testUnaryOpV( dsin, S32, 90, 0, 3, 1, errorFlag, memoryFlag); 413 344 ok(errorFlag== false, "psUnaryOp(): dsin was successful"); … … 419 350 ok(errorFlag== false, "psUnaryOp(): dsin was successful"); 420 351 ok(memoryFlag== false, "no memory leaks"); 421 testUnaryOpV( dsin, C32, 90.0 + 00.0i, 0.0 + 0.0i, 3, 1.0, errorFlag, memoryFlag);422 ok(errorFlag== false, "psUnaryOp(): dsin was successful");423 ok(memoryFlag== false, "no memory leaks");424 352 testUnaryOpV( cos, S32, 0, 0, 3, 1, errorFlag, memoryFlag); 425 353 ok(errorFlag== false, "psUnaryOp(): cos was successful"); … … 431 359 ok(errorFlag== false, "psUnaryOp(): cos was successful"); 432 360 ok(memoryFlag== false, "no memory leaks"); 433 testUnaryOpV( cos, C32, 0.0 + 0.0i, 0.0 + 0.0i, 3, 1.0, errorFlag, memoryFlag);434 ok(errorFlag== false, "psUnaryOp(): cos was successful");435 ok(memoryFlag== false, "no memory leaks");436 361 testUnaryOpV( dcos, S32, 0, 0, 3, 1, errorFlag, memoryFlag); 437 362 ok(errorFlag== false, "psUnaryOp(): dcos was successful"); … … 443 368 ok(errorFlag== false, "psUnaryOp(): dcos was successful"); 444 369 ok(memoryFlag== false, "no memory leaks"); 445 testUnaryOpV( dcos, C32, 0.0 + 0.0i, 0.0 + 0.0i, 3, 1.0, errorFlag, memoryFlag);446 ok(errorFlag== false, "psUnaryOp(): dcos was successful");447 ok(memoryFlag== false, "no memory leaks");448 370 testUnaryOpV( tan, S32, M_PI_4, 0, 3, 1, errorFlag, memoryFlag); 449 371 ok(errorFlag== false, "psUnaryOp(): tan was successful"); … … 455 377 ok(errorFlag== false, "psUnaryOp(): tan was successful"); 456 378 ok(memoryFlag== false, "no memory leaks"); 457 testUnaryOpV( tan, C32, M_PI_4 + 0.0i, 0.0 + 0.0i, 3, 1, errorFlag, memoryFlag);458 ok(errorFlag== false, "psUnaryOp(): tan was successful");459 ok(memoryFlag== false, "no memory leaks");460 379 testUnaryOpV( dtan, S32, 45, 0, 3, 1, errorFlag, memoryFlag); 461 380 ok(errorFlag== false, "psUnaryOp(): dtan was successful"); … … 467 386 ok(errorFlag== false, "psUnaryOp(): dtan was successful"); 468 387 ok(memoryFlag== false, "no memory leaks"); 469 testUnaryOpV( dtan, C32, 45.0 + 45.0i, 0.0 + 0.0i, 3, 1.0, errorFlag, memoryFlag);470 ok(errorFlag== false, "psUnaryOp(): dtan was successful");471 ok(memoryFlag== false, "no memory leaks");472 388 testUnaryOpV( asin, S32, 1, 0, 3, M_PI_2, errorFlag, memoryFlag); 473 389 ok(errorFlag== false, "psUnaryOp(): asin was successful"); … … 479 395 ok(errorFlag== false, "psUnaryOp(): asin was successful"); 480 396 ok(memoryFlag== false, "no memory leaks"); 481 testUnaryOpV( asin, C32, 1.0 + 1.0i, 0.0 + 0.0i, 3, M_PI_2, errorFlag, memoryFlag);482 ok(errorFlag== false, "psUnaryOp(): asin was successful");483 ok(memoryFlag== false, "no memory leaks");484 397 testUnaryOpV( dasin, S32, 1.0, 0, 3, 90, errorFlag, memoryFlag); 485 398 ok(errorFlag== false, "psUnaryOp(): dasin was successful"); … … 491 404 ok(errorFlag== false, "psUnaryOp(): dasin was successful"); 492 405 ok(memoryFlag== false, "no memory leaks"); 493 testUnaryOpV( dasin, C32, 1.0 + 1.0i, 0.0 + 0.0i, 3, 90.0, errorFlag, memoryFlag);494 ok(errorFlag== false, "psUnaryOp(): dasin was successful");495 ok(memoryFlag== false, "no memory leaks");496 406 testUnaryOpV( acos, S32, 0, 0, 3, M_PI_2, errorFlag, memoryFlag); 497 407 ok(errorFlag== false, "psUnaryOp(): acos was successful"); … … 503 413 ok(errorFlag== false, "psUnaryOp(): acos was successful"); 504 414 ok(memoryFlag== false, "no memory leaks"); 505 testUnaryOpV( acos, C32, 0.0 + 0.0i, 0.0 + 0.0i, 3, M_PI_2, errorFlag, memoryFlag);506 ok(errorFlag== false, "psUnaryOp(): acos was successful");507 ok(memoryFlag== false, "no memory leaks");508 415 testUnaryOpV( dacos, S32, 0, 0, 3, 90, errorFlag, memoryFlag); 509 416 ok(errorFlag== false, "psUnaryOp(): dacos was successful"); … … 515 422 ok(errorFlag== false, "psUnaryOp(): dacos was successful"); 516 423 ok(memoryFlag== false, "no memory leaks"); 517 testUnaryOpV( dacos, C32, 0.0 + 0.0i, 0.0 + 0.0i, 3, 90.0, errorFlag, memoryFlag);518 ok(errorFlag== false, "psUnaryOp(): dacos was successful");519 ok(memoryFlag== false, "no memory leaks");520 424 testUnaryOpV( atan, S32, 1, 0, 3, M_PI_4, errorFlag, memoryFlag); 521 425 ok(errorFlag== false, "psUnaryOp(): atan was successful"); … … 527 431 ok(errorFlag== false, "psUnaryOp(): atan was successful"); 528 432 ok(memoryFlag== false, "no memory leaks"); 529 testUnaryOpV( atan, C32, 1.0 + 0.0i, 0.0 + 0.0i, 3, M_PI_4, errorFlag, memoryFlag);530 ok(errorFlag== false, "psUnaryOp(): atan was successful");531 ok(memoryFlag== false, "no memory leaks");532 433 testUnaryOpV( datan, S32, 1, 0, 3, 45, errorFlag, memoryFlag); 533 434 ok(errorFlag== false, "psUnaryOp(): datan was successful"); … … 539 440 ok(errorFlag== false, "psUnaryOp(): datan was successful"); 540 441 ok(memoryFlag== false, "no memory leaks"); 541 testUnaryOpV( datan, C32, 1.0 + 0.0i, 0.0 + 0.0i, 3, 45.0, errorFlag, memoryFlag);542 ok(errorFlag== false, "psUnaryOp(): datan was successful");543 ok(memoryFlag== false, "no memory leaks");544 442 545 443 return 0; -
trunk/psLib/test/math/tap_psMatrixVectorArithmetic03.c
r10945 r12431 9 9 * Inconsistent dimensionality 10 10 * Division by zero 11 * Attempt to use min with complex numbers12 * Attempt to use max with complex numbers13 11 * Invalid operation 14 12 * … … 17 15 * @author Ross Harman, MHPCC 18 16 * 19 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $20 * @date $Date: 2007-0 1-06 00:48:54$17 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 18 * @date $Date: 2007-03-14 00:39:51 $ 21 19 * 22 20 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 56 54 CREATE_AND_SET_IMAGE(image3,F32,0,3,3); 57 55 CREATE_AND_SET_IMAGE(image4,F64,0,2,2); 58 CREATE_AND_SET_IMAGE(image5,C32,1+1i,3,3);59 56 CREATE_AND_SET_VECTOR(vector1,F64,0,2); 60 57 CREATE_AND_SET_VECTOR(vector2,F64,0,3); … … 203 200 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 204 201 } 205 206 // Attempt to use min with complex numbers207 // Following should generate error message208 if (0) {209 psMemId id = psMemGetId();210 psImage* image6 = (psImage*)psBinaryOp(image6, image5, "min", image5);211 ok(image6 == NULL, "psUnaryOp returned NULL with min of complex numbers");212 psFree(image6);213 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");214 }215 216 217 // Attempt to use max with complex numbers218 // Following should generate an error message219 if (0) {220 psMemId id = psMemGetId();221 psImage* image6 = (psImage*)psBinaryOp(image6, image5, "max", image5);222 ok(image6 == NULL, "psUnaryOp returned NULL with max of complex numbers");223 psFree(image6);224 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");225 }226 227 202 228 203 // Invalid operation -
trunk/psLib/test/mathtypes/tap_psImage.c
r12196 r12431 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $9 * @date $Date: 2007-03- 03 01:25:22$8 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2007-03-14 00:39:51 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 81 81 psElemType type[] = { PS_TYPE_S8, PS_TYPE_S16, PS_TYPE_S32, PS_TYPE_S64, 82 82 PS_TYPE_U8, PS_TYPE_U16, PS_TYPE_U32, PS_TYPE_U64, 83 PS_TYPE_F32, PS_TYPE_F64 , PS_TYPE_C32, PS_TYPE_C64};83 PS_TYPE_F32, PS_TYPE_F64 }; 84 84 85 85 for (psU32 t=0;t<types;t++) { … … 200 200 } 201 201 ok(!errorFlag, "psImageAlloc() set data correctly (F64)"); 202 }203 break;204 case PS_TYPE_C32: {205 psU32 rows = numRows[i];206 psU32 cols = numCols[i];207 208 for (psS32 r=0;r<rows;r++) {209 for (psS32 c=0;c<cols;c++) {210 image->data.C32[r][c] = r + I * c;211 }212 }213 bool errorFlag = false;214 for (psS32 r=0;r<rows;r++) {215 for (psS32 c=0;c<cols;c++) {216 if(fabsf(crealf(image->data.C32[r][c]) - r) > FLT_EPSILON ||217 fabsf(cimagf(image->data.C32[r][c]) - c) > FLT_EPSILON) {218 diag("Set all pixels in complex image at (%d,%d)",c,r);219 errorFlag = true;220 }221 }222 }223 ok(!errorFlag, "psImageAlloc() set data correctly (C32)");224 202 } 225 203 break; -
trunk/psLib/test/mathtypes/tap_psScalar.c
r10808 r12431 5 5 * @author Eric Van Alst, MHPCC 6 6 * 7 * @version $Revision: 1. 1$7 * @version $Revision: 1.2 $ 8 8 * $Name: not supported by cvs2svn $ 9 * @date $Date: 200 6-12-18 19:10:56$9 * @date $Date: 2007-03-14 00:39:51 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 77 77 tstScalarAllocByType(F32,26); 78 78 tstScalarAllocByType(F64,28); 79 tstScalarAllocByType(C32,30);80 tstScalarAllocByType(C64,32);81 79 } 82 80 … … 107 105 tstScalarCopyByType(F32,180); 108 106 tstScalarCopyByType(F64,190); 109 tstScalarCopyByType(C32,200);110 tstScalarCopyByType(C64,210);111 107 } 112 108 -
trunk/psLib/test/mathtypes/tap_psVector.c
r12389 r12431 279 279 psFree(vec); 280 280 } 281 282 // XXX: Looks like the C32 case was removed from psVectorInit().283 if (0) {284 psVector *vec = psVectorAlloc(1, PS_TYPE_C32);285 psC32 vC32 = 1.23 + 1.19I;286 ok(psVectorInit(vec, vC32), "C32 Case");287 psFree(vec);288 }289 290 // XXX: Looks like the C64 case was removed from psVectorInit().291 if (0) {292 psVector *vec = psVectorAlloc(1, PS_TYPE_C64);293 psC64 vC64 = 2.13 + 2.31I;294 ok(psVectorInit(vec, vC64), "C64 Case");295 psFree(vec);296 }297 298 281 299 282 … … 455 438 TEST_VECTOR_TO_STRING(PS_TYPE_F64,5,.123,1,"[0.123,1.123,2.123,3.123,4.123]"); 456 439 457 // Must test complex types separately from macro458 459 // XXX: Looks like the C32 case was removed from psVectorInit().460 if (0) {461 psVector *vec = psVectorAlloc(1, PS_TYPE_C32);462 vec->n = 1;463 psC32 vC32 = 1.23 + 1.19I;464 psVectorInit(vec, vC32);465 psString result = psVectorToString(vec, 100);466 \467 psString expected = "[1.23+1.19i]";468 ok(strcmp(result,expected) == 0, \469 "psVectorToString expected:result = %s:%s", expected, result );470 \471 psFree(vec);472 }473 474 // XXX: Looks like the C64 case was removed from psVectorInit().475 if (0) {476 psVector *vec = psVectorAlloc(1, PS_TYPE_C64);477 vec->n = 1;478 psC64 vC64 = 2.13 + 2.31I;479 psVectorInit(vec, vC64);480 psString result = psVectorToString(vec, 100);481 \482 psString expected = "[2.13+2.31i]";483 ok(strcmp(result,expected) == 0, \484 "psVectorToString expected:result = %s:%s", expected, result );485 \486 psFree(vec);487 }488 489 490 491 440 492 441 diag("p_psVectorGetElementF64() tests"); … … 526 475 527 476 TEST_VECTOR_GET_ELEMENT_F64(PS_TYPE_F64,2, psF64, -123.123); 528 529 // Need different test for complex types since NAN returned.530 531 #define TEST_VECTOR_GET_C_ELEMENT_F64(ELEM_TYPE, SIZE, VALUE_TYPE, \532 INIT_VALUE ) \533 { \534 psVector *vec = psVectorAlloc(SIZE, ELEM_TYPE); \535 vec->n = SIZE; \536 VALUE_TYPE initValue = INIT_VALUE; \537 psVectorInit(vec, initValue); \538 psF64 result = p_psVectorGetElementF64(vec, 0); \539 ok(isnan(result), \540 "p_psVectorGetElementF64 expected NAN/nan got %f", result); \541 \542 psFree(vec); \543 }544 545 TEST_VECTOR_GET_C_ELEMENT_F64(PS_TYPE_C32,1, psC32, 1.23+1.19I);546 547 TEST_VECTOR_GET_C_ELEMENT_F64(PS_TYPE_C64,100, psC64, -1.23-1.19I);548 549 550 477 551 478 -
trunk/psLib/test/sys/tap_psMemory.c
r11665 r12431 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $9 * @date $Date: 2007-0 2-06 20:31:57$8 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2007-03-14 00:39:51 $ 10 10 * 11 11 * XXXX: Several tests fail with an Abort and are commented out. … … 726 726 727 727 psScalar *scalar; 728 ps C64 c64 = 1.1 + 7I;729 scalar = psScalarAlloc( c64, PS_TYPE_F64);728 psF64 f64 = 1.1; 729 scalar = psScalarAlloc(f64, PS_TYPE_F64); 730 730 okay = psMemCheckType(PS_DATA_SCALAR, scalar); 731 731 if ( ! okay ) -
trunk/psLib/test/types/tap_psMetadataConfigFormat.c
r11667 r12431 67 67 psFree(list); 68 68 psFree(md); 69 }70 71 72 //Return NULL for attempting to format vector with type = complex73 {74 psMemId id = psMemGetId();75 psVector *vec = psVectorAlloc(60, PS_TYPE_C64);76 for (int i = 0; i < 5; i++)77 {78 vec->data.C64[i] = i+1;79 }80 md = psMetadataAlloc();81 psMetadataAddVector(md, PS_LIST_TAIL, "vectorC64", 0, "", vec);82 out = psMetadataConfigFormat(md);83 ok( out == NULL,84 "psMetadataConfigFormat: return NULL for metadata containing a "85 "Complex vector.");86 psFree(vec);87 psFree(md);88 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");89 69 } 90 70 -
trunk/psLib/test/types/tap_psMetadata_printing.c
r10822 r12431 153 153 psImageSet(image, 0, 0, 1); 154 154 psMetadataAddImage(md, PS_LIST_TAIL, "image1", 0, "I am an Image", image); 155 155 156 156 psHash *hash = psHashAlloc(1); 157 157 psHashAdd(hash, "hash", image); 158 158 psMetadataAddHash(md, PS_LIST_TAIL, "hash1", 0, "I am a Hash", hash); 159 159 160 160 psLookupTable *lookup = psLookupTableAlloc("table2.dat", "%s", 0); 161 161 psMetadataAddLookupTable(md, PS_LIST_TAIL, "lookup", 0, "I am a LookupTable", lookup); 162 162 163 163 psArray *array = psArrayAlloc(1); 164 164 psArraySet(array, 0, image); 165 165 psMetadataAddArray(md, PS_LIST_TAIL, "array", 0, "I am an Array", array); 166 166 167 167 psFree(array); 168 168 psFree(lookup); … … 230 230 psFree(md2); 231 231 232 //Return false for unsupported vector type (C32)233 md2 = psMetadataAlloc();234 psVector *vector = psVectorAlloc(2, PS_TYPE_C32);235 psMetadataAddVector(md2, PS_LIST_HEAD, "name here", 0, "I vector", vector);236 {237 ok ( !psMetadataPrint(NULL, md2, 2),238 "psMetadataPrint: return false for metadata with unknown vector-type.");239 }240 psFree(vector);241 psFree(md2);242 243 232 //Valid case where fd is NULL -> stdout 244 233 md2 = psMetadataAlloc();
Note:
See TracChangeset
for help on using the changeset viewer.
