Changeset 1406 for trunk/psLib/test/dataManip
- Timestamp:
- Aug 6, 2004, 12:34:06 PM (22 years ago)
- Location:
- trunk/psLib/test/dataManip
- Files:
-
- 17 edited
-
tst_psHist02.c (modified) (5 diffs)
-
tst_psMatrix01.c (modified) (6 diffs)
-
tst_psMatrix02.c (modified) (1 diff)
-
tst_psMatrix03.c (modified) (3 diffs)
-
tst_psMatrix04.c (modified) (2 diffs)
-
tst_psMatrix05.c (modified) (6 diffs)
-
tst_psMatrix06.c (modified) (5 diffs)
-
tst_psMatrix07.c (modified) (5 diffs)
-
tst_psMatrixVectorArithmetic01.c (modified) (1 diff)
-
tst_psMatrixVectorArithmetic02.c (modified) (10 diffs)
-
tst_psMatrixVectorArithmetic03.c (modified) (1 diff)
-
tst_psMinimize00.c (modified) (1 diff)
-
tst_psMinimize01.c (modified) (1 diff)
-
tst_psMinimize02.c (modified) (2 diffs)
-
tst_psMinimize03.c (modified) (2 diffs)
-
tst_psStats07.c (modified) (7 diffs)
-
tst_psVectorFFT.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/dataManip/tst_psHist02.c
r1365 r1406 2 2 This routine must ensure that the psHistogram structure is correctly 3 3 populated by the procedure psGetArrayHistogram(). 4 4 5 5 *****************************************************************************/ 6 6 #include <stdio.h> … … 26 26 int i = 0; 27 27 int currentId = 0; 28 28 29 29 currentId = psMemGetId(); 30 30 31 31 /*********************************************************************/ 32 32 /* Allocate and initialize data structures */ … … 35 35 myData->n = myData->nalloc; 36 36 for ( i = 0;i < NUM_DATA;i++ ) { 37 myData->data.F32[ i ] = LOWER + ( ( UPPER - LOWER ) / ( float ) NUM_DATA ) * ( float ) i;38 }39 37 myData->data.F32[ i ] = LOWER + ( ( UPPER - LOWER ) / ( float ) NUM_DATA ) * ( float ) i; 38 } 39 40 40 myMask = psVectorAlloc( NUM_DATA, PS_TYPE_U8 ); 41 41 myMask->n = myMask->nalloc; 42 42 for ( i = 0;i < NUM_DATA;i++ ) { 43 if ( i >= ( NUM_DATA / 2 ) ) { 44 myMask->data.U8[ i ] = 1; 45 } else { 46 myMask->data.U8[ i ] = 0; 47 } 43 if ( i >= ( NUM_DATA / 2 ) ) { 44 myMask->data.U8[ i ] = 1; 45 } else { 46 myMask->data.U8[ i ] = 0; 48 47 } 49 48 } 49 50 50 for ( nb = 0;nb < 4;nb++ ) { 51 if ( nb == 0 ) 52 numBins = 1; 53 if ( nb == 1 ) 54 numBins = 2; 55 if ( nb == 2 ) 56 numBins = 10; 57 if ( nb == 3 ) 58 numBins = 20; 59 60 /*********************************************************************/ 61 /* Allocate and Perform Histogram, no mask */ 62 /*********************************************************************/ 63 printPositiveTestHeader( stdout, 64 "psStats functions", 65 "Allocate and Perform Histogram, no mask" ); 66 67 myHist = psHistogramAlloc( LOWER, UPPER, numBins ); 68 myHist = psVectorHistogram( myHist, myData, NULL, 0 ); 69 70 for ( i = 0;i < numBins;i++ ) { 71 printf( "Bin number %d bounds: (%.2f - %.2f) data (%d)\n", i, 72 myHist->bounds->data.F32[ i ], 73 myHist->bounds->data.F32[ i + 1 ], 74 myHist->nums->data.U32[ i ] ); 75 } 76 psMemCheckCorruption( 1 ); 77 psFree( myHist ); 78 psMemCheckCorruption( 1 ); 79 80 printFooter( stdout, 81 "psStats functions", 82 "Allocate and Perform Histogram, no mask", 83 testStatus ); 84 85 /*********************************************************************/ 86 /* Allocate and Perform Histogram with mask */ 87 /*********************************************************************/ 88 printPositiveTestHeader( stdout, 89 "psStats functions", 90 "Allocate and Perform Histogram with mask" ); 91 92 myHist = psHistogramAlloc( LOWER, UPPER, numBins ); 93 myHist = psVectorHistogram( myHist, myData, myMask, 1 ); 94 95 for ( i = 0;i < numBins;i++ ) { 96 printf( "Bin number %d bounds: (%6.3f - %6.3f) data (%d)\n", i, 97 myHist->bounds->data.F32[ i ], 98 myHist->bounds->data.F32[ i + 1 ], 99 myHist->nums->data.U32[ i ] ); 100 } 101 psMemCheckCorruption( 1 ); 102 psFree( myHist ); 103 psMemCheckCorruption( 1 ); 104 105 printFooter( stdout, 106 "psStats functions", 107 "Allocate and Perform Histogram with mask", 108 testStatus ); 51 if ( nb == 0 ) 52 numBins = 1; 53 if ( nb == 1 ) 54 numBins = 2; 55 if ( nb == 2 ) 56 numBins = 10; 57 if ( nb == 3 ) 58 numBins = 20; 59 60 /*********************************************************************/ 61 /* Allocate and Perform Histogram, no mask */ 62 /*********************************************************************/ 63 printPositiveTestHeader( stdout, 64 "psStats functions", 65 "Allocate and Perform Histogram, no mask" ); 66 67 myHist = psHistogramAlloc( LOWER, UPPER, numBins ); 68 myHist = psVectorHistogram( myHist, myData, NULL, 0 ); 69 70 for ( i = 0;i < numBins;i++ ) { 71 printf( "Bin number %d bounds: (%.2f - %.2f) data (%d)\n", i, 72 myHist->bounds->data.F32[ i ], 73 myHist->bounds->data.F32[ i + 1 ], 74 myHist->nums->data.U32[ i ] ); 109 75 } 76 psMemCheckCorruption( 1 ); 77 psFree( myHist ); 78 psMemCheckCorruption( 1 ); 79 80 printFooter( stdout, 81 "psStats functions", 82 "Allocate and Perform Histogram, no mask", 83 testStatus ); 84 85 /*********************************************************************/ 86 /* Allocate and Perform Histogram with mask */ 87 /*********************************************************************/ 88 printPositiveTestHeader( stdout, 89 "psStats functions", 90 "Allocate and Perform Histogram with mask" ); 91 92 myHist = psHistogramAlloc( LOWER, UPPER, numBins ); 93 myHist = psVectorHistogram( myHist, myData, myMask, 1 ); 94 95 for ( i = 0;i < numBins;i++ ) { 96 printf( "Bin number %d bounds: (%6.3f - %6.3f) data (%d)\n", i, 97 myHist->bounds->data.F32[ i ], 98 myHist->bounds->data.F32[ i + 1 ], 99 myHist->nums->data.U32[ i ] ); 100 } 101 psMemCheckCorruption( 1 ); 102 psFree( myHist ); 103 psMemCheckCorruption( 1 ); 104 105 printFooter( stdout, 106 "psStats functions", 107 "Allocate and Perform Histogram with mask", 108 testStatus ); 109 } 110 110 psFree( myMask ); 111 111 112 112 printPositiveTestHeader( stdout, 113 113 "psStats functions", 114 114 "Calling psVectorHistogram() with various NULL inputs." ); 115 115 116 116 // Verify the return value is null and program execution doesn't stop, 117 117 // if input parameter myHist is null. 118 118 119 119 myHist2 = psVectorHistogram( NULL, myData, NULL, 0 ); 120 120 if ( myHist2 != NULL ) { 121 printf( "ERROR: myHist2!=NULL\n" );122 testStatus = false;123 }121 printf( "ERROR: myHist2!=NULL\n" ); 122 testStatus = false; 123 } 124 124 psFree( myData ); 125 126 125 126 127 127 // Verify the retrun value is the same as the input parameter myHist and 128 128 // program execution doesn't stop, if the input parameter myArray is 129 129 // null. 130 130 131 131 myHist = psHistogramAlloc( LOWER, UPPER, numBins ); 132 132 myHist = psVectorHistogram( myHist, NULL, NULL, 0 ); 133 133 if ( myHist == NULL ) { 134 printf( "ERROR: myHist==NULL\n" );135 testStatus = false;136 }134 printf( "ERROR: myHist==NULL\n" ); 135 testStatus = false; 136 } 137 137 psFree( myHist ); 138 139 138 139 140 140 // Verify the return value is the same as the input parameter myHist and 141 141 // program execution doesn't stop, if the input parameter myArray has no … … 159 159 "Calling psVectorHistogram() with various NULL inputs.", 160 160 testStatus ); 161 161 162 162 /*************************************************************************/ 163 163 /* Deallocate data structures */ … … 166 166 "psStats functions", 167 167 "Deallocate the psHistogram structure." ); 168 168 169 169 psMemCheckCorruption( 1 ); 170 170 memLeaks = psMemCheckLeaks( currentId, NULL, NULL ); 171 171 if ( 0 != memLeaks ) { 172 psAbort( __func__, "Memory Leaks! (%d leaks)", memLeaks );173 }172 psAbort( __func__, "Memory Leaks! (%d leaks)", memLeaks ); 173 } 174 174 psMemCheckCorruption( 1 ); 175 175 176 176 printFooter( stdout, 177 177 "psStats functions", 178 178 "Deallocate the psHistogram structure.", 179 179 testStatus ); 180 180 181 181 return ( !testStatus ); 182 182 } -
trunk/psLib/test/dataManip/tst_psMatrix01.c
r1346 r1406 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-0 7-30 02:55:47$13 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-08-06 22:34:06 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 23 23 #define PRINT_MATRIX(IMAGE) \ 24 24 for(int i=IMAGE->numRows-1; i>-1; i--) { \ 25 for(int j=0; j<IMAGE->numCols; j++) { \26 printf("%f ", IMAGE->data.F64[i][j]); \27 } \28 printf("\n"); \29 }30 25 for(int j=0; j<IMAGE->numCols; j++) { \ 26 printf("%f ", IMAGE->data.F64[i][j]); \ 27 } \ 28 printf("\n"); \ 29 } 30 31 31 int main( int argc, 32 32 char* argv[] ) 33 33 { 34 34 psImage * tempImage = NULL; 35 36 35 36 37 37 // Test A - Create input and output images 38 38 printPositiveTestHeader( stdout, "psMatrix", "Create input and output images" ); … … 50 50 PRINT_MATRIX( inImage ); 51 51 printFooter( stdout, "psMatrix", "Create input and output images", true ); 52 53 52 53 54 54 // Test B - Transpose input image into output image 55 55 printPositiveTestHeader( stdout, "psMatrix", "Transpose input image into output image" ); … … 58 58 PRINT_MATRIX( outImage ); 59 59 if ( outImage->type.dimen != PS_DIMEN_IMAGE ) { 60 printf( "Error: Resulting image is not PS_DIMEN_IMAGE\n" ); 61 } else if ( outImage != tempImage ) { 60 printf( "Error: Resulting image is not PS_DIMEN_IMAGE\n" ); 61 } else 62 if ( outImage != tempImage ) { 62 63 printf( "Error: Return pointer not equal to output argument pointer\n" ); 63 64 } 64 65 printFooter( stdout, "psMatrix", "Transpose input image into output image", true ); 65 66 66 67 67 68 // Test C - Transpose input image into auto allocated NULL output image 68 69 printPositiveTestHeader( stdout, "psMatrix", "ranspose input image into auto allocated NULL output image" ); … … 71 72 PRINT_MATRIX( outImageNull ); 72 73 printFooter( stdout, "psMatrix", "ranspose input image into auto allocated NULL output image", true ); 73 74 74 75 75 76 // Test D - Free images and check for leaks 76 77 printPositiveTestHeader( stdout, "psMatrix", "Free images and check for leaks" ); … … 80 81 int nLeaks = psMemCheckLeaks( 0, NULL, stdout ); 81 82 if ( nLeaks != 0 ) { 82 printf( "ERROR: Found %d memory leaks\n", nLeaks );83 }83 printf( "ERROR: Found %d memory leaks\n", nLeaks ); 84 } 84 85 int nBad = psMemCheckCorruption( 0 ); 85 86 if ( nBad ) { 86 printf( "ERROR: Found %d bad memory blocks\n", nBad );87 }87 printf( "ERROR: Found %d bad memory blocks\n", nBad ); 88 } 88 89 printFooter( stdout, "psMatrix" , "Free images and check for leaks", true ); 89 90 90 91 return 0; 91 92 } -
trunk/psLib/test/dataManip/tst_psMatrix02.c
r798 r1406 13 13 * @author Ross Harman, MHPCC 14 14 * 15 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $16 * @date $Date: 2004-0 5-28 02:52:23$15 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2004-08-06 22:34:06 $ 17 17 * 18 18 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii -
trunk/psLib/test/dataManip/tst_psMatrix03.c
r1181 r1406 14 14 * @author Ross Harman, MHPCC 15 15 * 16 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $17 * @date $Date: 2004-0 7-01 23:29:34$16 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 17 * @date $Date: 2004-08-06 22:34:06 $ 18 18 * 19 19 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 83 83 if(luImage->type.dimen != PS_DIMEN_IMAGE) { 84 84 printf("Error: Resulting image is not PS_DIMEN_IMAGE\n"); 85 } else if(luImage != tempImage) { 86 printf("Error: Return pointer not equal to output argument pointer\n"); 87 } 85 } else 86 if(luImage != tempImage) { 87 printf("Error: Return pointer not equal to output argument pointer\n"); 88 } 88 89 printFooter(stdout, "psMatrix", "Calculate LU matrix", true); 89 90 … … 96 97 if(outVector->type.dimen != PS_DIMEN_VECTOR) { 97 98 printf("Error: Resulting image is not PS_DIMEN_VECTOR\n"); 98 } else if(outVector != tempVector) { 99 printf("Error: Return pointer not equal to output argument pointer\n"); 100 } 99 } else 100 if(outVector != tempVector) { 101 printf("Error: Return pointer not equal to output argument pointer\n"); 102 } 101 103 printFooter(stdout, "psMatrix", "Determine solution to matrix equation", true); 102 104 -
trunk/psLib/test/dataManip/tst_psMatrix04.c
r1073 r1406 13 13 * @author Ross Harman, MHPCC 14 14 * 15 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $16 * @date $Date: 2004-0 6-23 23:00:17$15 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2004-08-06 22:34:06 $ 17 17 * 18 18 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 67 67 if(outImage->type.dimen != PS_DIMEN_IMAGE) { 68 68 printf("Error: Resulting image is not PS_DIMEN_IMAGE\n"); 69 } else if(outImage != tempImage) { 70 printf("Error: Return pointer not equal to output argument pointer\n"); 71 } 69 } else 70 if(outImage != tempImage) { 71 printf("Error: Return pointer not equal to output argument pointer\n"); 72 } 72 73 printFooter(stdout, "psMatrix", "Invert matrix and calculate determinant", true); 73 74 -
trunk/psLib/test/dataManip/tst_psMatrix05.c
r1347 r1406 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-0 7-30 03:13:08$12 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-06 22:34:06 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 22 22 #define PRINT_MATRIX(IMAGE) \ 23 23 for(int i=0; i<IMAGE->numRows; i++) { \ 24 for(int j=0; j<IMAGE->numCols; j++) { \25 printf("%f ", IMAGE->data.F64[i][j]); \26 } \27 printf("\n"); \28 }29 30 24 for(int j=0; j<IMAGE->numCols; j++) { \ 25 printf("%f ", IMAGE->data.F64[i][j]); \ 26 } \ 27 printf("\n"); \ 28 } 29 30 31 31 int main( int argc, 32 32 char* argv[] ) … … 35 35 psImage *inImage1 = NULL; 36 36 psImage *inImage2 = NULL; 37 38 37 38 39 39 // Test A - Create input and output images 40 40 printPositiveTestHeader( stdout, "psMatrix", "Create input and output images" ); … … 54 54 PRINT_MATRIX( inImage2 ); 55 55 printFooter( stdout, "psMatrix", "Create input and output images", true ); 56 57 56 57 58 58 // Test B - Multiply images 59 59 printPositiveTestHeader( stdout, "psMatrix", "Multiply images" ); … … 61 61 PRINT_MATRIX( outImage ); 62 62 printFooter( stdout, "psMatrix", "Multiply images", true ); 63 64 63 64 65 65 // Test C - Free input and output images 66 66 printPositiveTestHeader( stdout, "psMatrix", "Free input and output images" ); … … 70 70 int nLeaks = psMemCheckLeaks( 0, NULL, stdout ); 71 71 if ( nLeaks != 0 ) { 72 printf( "ERROR: Found %d memory leaks\n", nLeaks );73 }72 printf( "ERROR: Found %d memory leaks\n", nLeaks ); 73 } 74 74 int nBad = psMemCheckCorruption( 0 ); 75 75 if ( nBad ) { 76 printf( "ERROR: Found %d bad memory blocks\n", nBad );77 }76 printf( "ERROR: Found %d bad memory blocks\n", nBad ); 77 } 78 78 printFooter( stdout, "psMatrix" , "Free input and output images", true ); 79 79 80 80 return 0; 81 81 } -
trunk/psLib/test/dataManip/tst_psMatrix06.c
r1348 r1406 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-0 7-30 03:48:15$12 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-06 22:34:06 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 22 22 #define PRINT_MATRIX(IMAGE) \ 23 23 for(int i=0; i<IMAGE->numRows; i++) { \ 24 for(int j=0; j<IMAGE->numCols; j++) { \25 printf("%f ", IMAGE->data.F64[i][j]); \26 } \27 printf("\n"); \28 }29 30 24 for(int j=0; j<IMAGE->numCols; j++) { \ 25 printf("%f ", IMAGE->data.F64[i][j]); \ 26 } \ 27 printf("\n"); \ 28 } 29 30 31 31 int main( int argc, 32 32 char* argv[] ) … … 34 34 psImage * outImage = NULL; 35 35 psImage *inImage = NULL; 36 37 36 37 38 38 // Test A - Create input and output images 39 39 printPositiveTestHeader( stdout, "psMatrix", "Create input and output images" ); 40 40 outImage = ( psImage* ) psImageAlloc( 4, 4, PS_TYPE_F64 ); 41 41 inImage = ( psImage* ) psImageAlloc( 4, 4, PS_TYPE_F64 ); 42 42 43 43 inImage->data.F64[ 0 ][ 0 ] = 1. / 1.; 44 44 inImage->data.F64[ 0 ][ 1 ] = 1. / 2.; 45 45 inImage->data.F64[ 0 ][ 2 ] = 1. / 3.; 46 46 inImage->data.F64[ 0 ][ 3 ] = 1. / 4.; 47 47 48 48 inImage->data.F64[ 1 ][ 0 ] = 1. / 2.; 49 49 inImage->data.F64[ 1 ][ 1 ] = 1. / 3.; 50 50 inImage->data.F64[ 1 ][ 2 ] = 1. / 4.; 51 51 inImage->data.F64[ 1 ][ 3 ] = 1. / 5.; 52 52 53 53 inImage->data.F64[ 2 ][ 0 ] = 1. / 3.; 54 54 inImage->data.F64[ 2 ][ 1 ] = 1. / 4.; 55 55 inImage->data.F64[ 2 ][ 2 ] = 1. / 5.; 56 56 inImage->data.F64[ 2 ][ 3 ] = 1. / 6.; 57 57 58 58 inImage->data.F64[ 3 ][ 0 ] = 1. / 4.; 59 59 inImage->data.F64[ 3 ][ 1 ] = 1. / 5.; 60 60 inImage->data.F64[ 3 ][ 2 ] = 1. / 6.; 61 61 inImage->data.F64[ 3 ][ 3 ] = 1. / 7.; 62 62 63 63 PRINT_MATRIX( inImage ); 64 64 printFooter( stdout, "psMatrix", "Create input and output images", true ); 65 66 65 66 67 67 // Test B - Calculate Eigenvectors 68 68 printPositiveTestHeader( stdout, "psMatrix", "Calculate Eigenvectors" ); … … 70 70 PRINT_MATRIX( outImage ); 71 71 printFooter( stdout, "psMatrix", "Calculate Eigenvectors", true ); 72 73 72 73 74 74 // Test C - Free input and output images 75 75 printPositiveTestHeader( stdout, "psMatrix", "Free input and output images" ); … … 78 78 int nLeaks = psMemCheckLeaks( 0, NULL, stdout ); 79 79 if ( nLeaks != 0 ) { 80 printf( "ERROR: Found %d memory leaks\n", nLeaks );81 }80 printf( "ERROR: Found %d memory leaks\n", nLeaks ); 81 } 82 82 int nBad = psMemCheckCorruption( 0 ); 83 83 if ( nBad ) { 84 printf( "ERROR: Found %d bad memory blocks\n", nBad );85 }84 printf( "ERROR: Found %d bad memory blocks\n", nBad ); 85 } 86 86 printFooter( stdout, "psMatrix" , "Free input and output images", true ); 87 87 88 88 return 0; 89 89 } -
trunk/psLib/test/dataManip/tst_psMatrix07.c
r1073 r1406 16 16 * @author Ross Harman, MHPCC 17 17 * 18 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $19 * @date $Date: 2004-0 6-23 23:00:17$18 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 19 * @date $Date: 2004-08-06 22:34:06 $ 20 20 * 21 21 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 88 88 if(v1->type.dimen != PS_DIMEN_VECTOR) { 89 89 printf("Error: Resulting image is not PS_DIMEN_VECTOR\n"); 90 } else if(v1 != tempVector) { 91 printf("Error: Return pointer not equal to output argument pointer\n"); 92 } 90 } else 91 if(v1 != tempVector) { 92 printf("Error: Return pointer not equal to output argument pointer\n"); 93 } 93 94 printFooter(stdout, "psMatrix", "Convert matrix to PS_DIMEN_VECTOR vector", true); 94 95 … … 108 109 if(v1->type.dimen != PS_DIMEN_TRANSV) { 109 110 printf("Error: Resulting image is not PS_DIMEN_TRANSV\n"); 110 } else if(v1 != tempVector) { 111 printf("Error: Return pointer not equal to output argument pointer\n"); 112 } 111 } else 112 if(v1 != tempVector) { 113 printf("Error: Return pointer not equal to output argument pointer\n"); 114 } 113 115 printFooter(stdout, "psMatrix", "Convert matrix to PS_DIMEN_TRANSV vector", true); 114 116 … … 128 130 if(m2->type.dimen != PS_DIMEN_IMAGE) { 129 131 printf("Error: Resulting image is not PS_DIMEN_IMAGE\n"); 130 } else if(m2 != tempImage) { 131 printf("Error: Return pointer not equal to output argument pointer\n"); 132 } 132 } else 133 if(m2 != tempImage) { 134 printf("Error: Return pointer not equal to output argument pointer\n"); 135 } 133 136 printFooter(stdout, "psMatrix", "Convert PS_DIMEN_VECTOR vector to matrix", true); 134 137 … … 149 152 if(m3->type.dimen != PS_DIMEN_IMAGE) { 150 153 printf("Error: Resulting image is not PS_DIMEN_IMAGE\n"); 151 } else if(m3 != tempImage) { 152 printf("Error: Return pointer not equal to output argument pointer\n"); 153 } 154 } else 155 if(m3 != tempImage) { 156 printf("Error: Return pointer not equal to output argument pointer\n"); 157 } 154 158 printFooter(stdout, "psMatrix", "Convert PS_DIMEN_TRANSV vector to matrix", true); 155 159 -
trunk/psLib/test/dataManip/tst_psMatrixVectorArithmetic01.c
r1114 r1406 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-0 6-29 01:52:19$12 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-06 22:34:06 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii -
trunk/psLib/test/dataManip/tst_psMatrixVectorArithmetic02.c
r1365 r1406 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-08-0 2 19:43:23$12 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-06 22:34:06 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 25 25 #define PRINT_SCALAR(SCALAR,TYPE) \ 26 26 if(PS_IS_PSELEMTYPE_COMPLEX(SCALAR->type.type)) { \ 27 printf("%.2f%f+.2i ", creal(SCALAR->data.TYPE), cimag(SCALAR->data.TYPE)); \28 } else if(PS_IS_PSELEMTYPE_INT(SCALAR->type.type)) { \29 printf("%d", (int)SCALAR->data.TYPE); \30 } else { \31 printf("%.2f", (double)SCALAR->data.TYPE); \32 } \27 printf("%.2f%f+.2i ", creal(SCALAR->data.TYPE), cimag(SCALAR->data.TYPE)); \ 28 } else if(PS_IS_PSELEMTYPE_INT(SCALAR->type.type)) { \ 29 printf("%d", (int)SCALAR->data.TYPE); \ 30 } else { \ 31 printf("%.2f", (double)SCALAR->data.TYPE); \ 32 } \ 33 33 printf("\n\n"); 34 34 … … 36 36 #define PRINT_VECTOR(VECTOR,TYPE) \ 37 37 for(int i=0; i<VECTOR->n; i++) { \ 38 if(PS_IS_PSELEMTYPE_COMPLEX(VECTOR->type.type)) { \39 printf("%.2f%+.2fi\n", creal(VECTOR->data.TYPE[i]), cimag(VECTOR->data.TYPE[i])); \40 } else if(PS_IS_PSELEMTYPE_INT(VECTOR->type.type)) { \41 printf("%d\n", (int)VECTOR->data.TYPE[i]); \42 } else { \43 printf("%.2f\n", (double)VECTOR->data.TYPE[i]); \44 } \45 } \38 if(PS_IS_PSELEMTYPE_COMPLEX(VECTOR->type.type)) { \ 39 printf("%.2f%+.2fi\n", creal(VECTOR->data.TYPE[i]), cimag(VECTOR->data.TYPE[i])); \ 40 } else if(PS_IS_PSELEMTYPE_INT(VECTOR->type.type)) { \ 41 printf("%d\n", (int)VECTOR->data.TYPE[i]); \ 42 } else { \ 43 printf("%.2f\n", (double)VECTOR->data.TYPE[i]); \ 44 } \ 45 } \ 46 46 printf("\n"); 47 47 … … 49 49 #define PRINT_MATRIX(IMAGE,TYPE) \ 50 50 for(int i=IMAGE->numRows-1; i>-1; i--) { \ 51 for(int j=0; j<IMAGE->numCols; j++) { \52 if(PS_IS_PSELEMTYPE_COMPLEX(IMAGE->type.type)) { \53 printf("%.2f%+.2fi ", creal(IMAGE->data.TYPE[i][j]), cimag(IMAGE->data.TYPE[i][j])); \54 } else if(PS_IS_PSELEMTYPE_INT(IMAGE->type.type)) { \55 printf("%d ", (int)IMAGE->data.TYPE[i][j]); \56 } else { \57 printf("%.2f ", (double)IMAGE->data.TYPE[i][j]); \58 } \59 } \60 printf("\n"); \61 } \51 for(int j=0; j<IMAGE->numCols; j++) { \ 52 if(PS_IS_PSELEMTYPE_COMPLEX(IMAGE->type.type)) { \ 53 printf("%.2f%+.2fi ", creal(IMAGE->data.TYPE[i][j]), cimag(IMAGE->data.TYPE[i][j])); \ 54 } else if(PS_IS_PSELEMTYPE_INT(IMAGE->type.type)) { \ 55 printf("%d ", (int)IMAGE->data.TYPE[i][j]); \ 56 } else { \ 57 printf("%.2f ", (double)IMAGE->data.TYPE[i][j]); \ 58 } \ 59 } \ 60 printf("\n"); \ 61 } \ 62 62 printf("\n"); 63 63 … … 66 66 psVector *NAME = (psVector*)psVectorAlloc(SIZE, PS_TYPE_##TYPE); \ 67 67 for(int i=0; i<SIZE; i++) { \ 68 NAME->data.TYPE[i] = VALUE; \69 } \68 NAME->data.TYPE[i] = VALUE; \ 69 } \ 70 70 NAME->n = SIZE; 71 71 … … 74 74 psImage *NAME = (psImage*)psImageAlloc(NCOLS,NROWS,PS_TYPE_##TYPE); \ 75 75 for(int i=0; i<NAME->numRows; i++) { \ 76 for(int j=0; j<NAME->numCols; j++) { \77 NAME->data.TYPE[i][j] = VALUE; \78 } \79 }80 81 76 for(int j=0; j<NAME->numCols; j++) { \ 77 NAME->data.TYPE[i][j] = VALUE; \ 78 } \ 79 } 80 81 82 82 #define CHECK_MEMORY \ 83 83 psMemCheckLeaks(0, NULL, stdout); \ 84 84 int nBad = psMemCheckCorruption(0); \ 85 85 if(nBad) { \ 86 printf("ERROR: Found %d bad memory blocks\n", nBad); \87 }88 89 86 printf("ERROR: Found %d bad memory blocks\n", nBad); \ 87 } 88 89 90 90 int main( int argc, char* argv[] ) 91 91 { … … 109 109 printFooter(stdout, "psMatrixVectorArithmetic", "Test matrix psUnaryOp", true); \ 110 110 } 111 111 112 112 testBinaryOpM( abs, S32, -10, 0, 3, 2 ); 113 113 testBinaryOpM( abs, F32, -10.0, 0.0, 3, 2 ); … … 178 178 testBinaryOpM( datan, F64, 1.0, 0.0, 3, 2 ); 179 179 testBinaryOpM( datan, C32, 1.0 + 1.0i, 0.0 + 0.0i, 3, 2 ); 180 181 180 181 182 182 // Test vector unary operations 183 183 #define testBinaryOpV(OP,TYPE,VALUE1,VALUE2,SIZE) \ … … 198 198 printFooter(stdout, "psMatrixVectorArithmetic", "Test vector psUnaryOp", true); \ 199 199 } 200 200 201 201 testBinaryOpV( abs, S32, -10, 0, 3 ); 202 202 testBinaryOpV( abs, F32, -10.0, 0.0, 3 ); … … 267 267 testBinaryOpV( datan, F64, 1.0, 0.0, 3 ); 268 268 testBinaryOpV( datan, C32, 1.0 + 1.0i, 0.0 + 0.0i, 3 ); 269 269 270 270 return 0; 271 271 } -
trunk/psLib/test/dataManip/tst_psMatrixVectorArithmetic03.c
r1150 r1406 15 15 * @author Ross Harman, MHPCC 16 16 * 17 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $18 * @date $Date: 2004-0 6-30 20:07:07$17 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 18 * @date $Date: 2004-08-06 22:34:06 $ 19 19 * 20 20 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii -
trunk/psLib/test/dataManip/tst_psMinimize00.c
r1177 r1406 45 45 tmp = 1.0; 46 46 tmp = x; 47 } else if (whichParamDeriv == 1) { 48 tmp = x; 49 tmp = x*x; 50 } else if (whichParamDeriv == 2) { 51 tmp = y; 52 tmp = y*y; 53 } else if (whichParamDeriv == 3) { 54 tmp = x * x * y; 55 } 47 } else 48 if (whichParamDeriv == 1) { 49 tmp = x; 50 tmp = x*x; 51 } else 52 if (whichParamDeriv == 2) { 53 tmp = y; 54 tmp = y*y; 55 } else 56 if (whichParamDeriv == 3) { 57 tmp = x * x * y; 58 } 56 59 57 60 // printf("--------- myFuncDeriv((%.1f %.1f) %.1f %.1f %.1f %.1f (%d)) is %.1f ---------\n", -
trunk/psLib/test/dataManip/tst_psMinimize01.c
r1177 r1406 44 44 if (whichParamDeriv == 0) { 45 45 tmp = exp(-lambda * x); 46 } else if (whichParamDeriv == 1) { 47 tmp = -x * A * exp(-lambda * x); 48 } else if (whichParamDeriv == 2) { 49 tmp = 1.0; 50 } 46 } else 47 if (whichParamDeriv == 1) { 48 tmp = -x * A * exp(-lambda * x); 49 } else 50 if (whichParamDeriv == 2) { 51 tmp = 1.0; 52 } 51 53 52 54 // printf("--------- myFuncDeriv((%.1f) %.1f %.1f %.1f, %d) is %.1f ---------\n", -
trunk/psLib/test/dataManip/tst_psMinimize02.c
r1185 r1406 44 44 if (whichParamDeriv == 0) { 45 45 tmp = 20.0 * (x - P0); 46 } else if (whichParamDeriv == 1) { 47 tmp = 40.0 * (y - P1); 48 } 46 } else 47 if (whichParamDeriv == 1) { 48 tmp = 40.0 * (y - P1); 49 } 49 50 50 51 // printf("--------- myFuncDeriv((%.1f %.1f) %.1f %.1f (%d)) is %.1f ---------\n", … … 83 84 tmp = 1.0; 84 85 tmp = x; 85 } else if (whichParamDeriv == 1) { 86 tmp = x; 87 tmp = x*x; 88 } else if (whichParamDeriv == 2) { 89 tmp = y; 90 tmp = y*y; 91 } else if (whichParamDeriv == 3) { 92 tmp = x * x * y; 93 } 86 } else 87 if (whichParamDeriv == 1) { 88 tmp = x; 89 tmp = x*x; 90 } else 91 if (whichParamDeriv == 2) { 92 tmp = y; 93 tmp = y*y; 94 } else 95 if (whichParamDeriv == 3) { 96 tmp = x * x * y; 97 } 94 98 95 99 printf("--------- myFuncDeriv((%.1f %.1f) %.1f %.1f %.1f %.1f (%d)) is %.1f ---------\n", -
trunk/psLib/test/dataManip/tst_psMinimize03.c
r1185 r1406 44 44 if (whichParamDeriv == 0) { 45 45 tmp = 20.0 * (x - P0); 46 } else if (whichParamDeriv == 1) { 47 tmp = 40.0 * (y - P1); 48 } 46 } else 47 if (whichParamDeriv == 1) { 48 tmp = 40.0 * (y - P1); 49 } 49 50 50 51 // printf("--------- myFuncDeriv((%.1f %.1f) %.1f %.1f (%d)) is %.1f ---------\n", … … 83 84 tmp = 1.0; 84 85 tmp = x; 85 } else if (whichParamDeriv == 1) { 86 tmp = x; 87 tmp = x*x; 88 } else if (whichParamDeriv == 2) { 89 tmp = y; 90 tmp = y*y; 91 } else if (whichParamDeriv == 3) { 92 tmp = x * x * y; 93 } 86 } else 87 if (whichParamDeriv == 1) { 88 tmp = x; 89 tmp = x*x; 90 } else 91 if (whichParamDeriv == 2) { 92 tmp = y; 93 tmp = y*y; 94 } else 95 if (whichParamDeriv == 3) { 96 tmp = x * x * y; 97 } 94 98 95 99 printf("--------- myFuncDeriv((%.1f %.1f) %.1f %.1f %.1f %.1f (%d)) is %.1f ---------\n", -
trunk/psLib/test/dataManip/tst_psStats07.c
r1365 r1406 45 45 float realN50WithMask = ( float ) N / 4; 46 46 float realNfitWithMask = ( float ) N / 4; 47 48 47 48 49 49 /*************************************************************************/ 50 50 /* Allocate and initialize data structures */ … … 55 55 PS_STAT_ROBUST_STDEV | 56 56 PS_STAT_ROBUST_QUARTILE ); 57 57 58 58 maskVector = psVectorAlloc( N, PS_TYPE_U8 ); 59 59 maskVector->n = N; … … 61 61 // Set the mask vector and calculate the expected maximum. 62 62 for ( i = 0;i < N;i++ ) { 63 if ( i < ( N / 2 ) ) { 64 maskVector->data.U8[ i ] = 0; 65 count++; 66 } else { 67 maskVector->data.U8[ i ] = 1; 68 } 63 if ( i < ( N / 2 ) ) { 64 maskVector->data.U8[ i ] = 0; 65 count++; 66 } else { 67 maskVector->data.U8[ i ] = 1; 69 68 } 69 } 70 70 /*************************************************************************/ 71 71 /* Call psVectorStats() with no vector mask. */ … … 74 74 "psStats functions", 75 75 "PS_STAT_ROBUST_STATS: robust mean: no vector mask" ); 76 76 77 77 myStats = psVectorStats( myStats, myVector, NULL, 0 ); 78 78 79 79 printf( "The expected Mean was %.2f; the calculated Mean was %.2f\n", 80 80 realMeanNoMask, myStats->robustMean ); 81 81 82 82 if ( fabs( myStats->robustMean - realMeanNoMask ) < ( ERROR_TOLERANCE * realMeanNoMask ) ) { 83 testStatus = true;84 } else {85 testStatus = false;86 globalTestStatus = false;87 }83 testStatus = true; 84 } else { 85 testStatus = false; 86 globalTestStatus = false; 87 } 88 88 printFooter( stdout, 89 89 "psVector functions", 90 90 "PS_STAT_ROBUST_STATS: robust mean: no vector mask", 91 91 testStatus ); 92 93 92 93 94 94 printPositiveTestHeader( stdout, 95 95 "psStats functions", 96 96 "PS_STAT_ROBUST_STATS: robust Median: no vector mask" ); 97 97 98 98 printf( "The expected Median was %.2f; the calculated Median was %.2f\n", 99 99 realMedianNoMask, myStats->robustMedian ); 100 100 if ( fabs( myStats->robustMedian - realMedianNoMask ) < ( ERROR_TOLERANCE * realMedianNoMask ) ) { 101 testStatus = true;102 } else {103 testStatus = false;104 globalTestStatus = false;105 }101 testStatus = true; 102 } else { 103 testStatus = false; 104 globalTestStatus = false; 105 } 106 106 printFooter( stdout, 107 107 "psVector functions", 108 108 "PS_STAT_ROBUST_STATS: robust Median: no vector mask", 109 109 testStatus ); 110 110 111 111 printPositiveTestHeader( stdout, 112 112 "psStats functions", 113 113 "PS_STAT_ROBUST_STATS: robust Mode: no vector mask" ); 114 115 114 115 116 116 printf( "The expected Mode was %.2f; the calculated Mode was %.2f\n", 117 117 realModeNoMask, myStats->robustMode ); 118 118 if ( fabs( myStats->robustMode - realModeNoMask ) < ( ERROR_TOLERANCE * realModeNoMask ) ) { 119 testStatus = true;120 } else {121 testStatus = false;122 globalTestStatus = false;123 }119 testStatus = true; 120 } else { 121 testStatus = false; 122 globalTestStatus = false; 123 } 124 124 printFooter( stdout, 125 125 "psVector functions", 126 126 "PS_STAT_ROBUST_STATS: robust Mode: no vector mask", 127 127 testStatus ); 128 129 130 128 129 130 131 131 printPositiveTestHeader( stdout, 132 132 "psStats functions", 133 133 "PS_STAT_ROBUST_STATS: robust Stdev: no vector mask" ); 134 134 135 135 printf( "The expected Stdev was %.2f; the calculated Stdev was %.2f\n", 136 136 realStdevNoMask, myStats->robustStdev ); 137 137 if ( fabs( myStats->robustStdev - realStdevNoMask ) < ( ERROR_TOLERANCE * realStdevNoMask ) ) { 138 testStatus = true;139 } else {140 testStatus = false;141 globalTestStatus = false;142 }138 testStatus = true; 139 } else { 140 testStatus = false; 141 globalTestStatus = false; 142 } 143 143 printFooter( stdout, 144 144 "psVector functions", 145 145 "PS_STAT_ROBUST_STATS: robust Stdev: no vector mask", 146 146 testStatus ); 147 148 149 147 148 149 150 150 printPositiveTestHeader( stdout, 151 151 "psStats functions", 152 152 "PS_STAT_ROBUST_STATS: lower quartile: no vector mask" ); 153 153 154 154 printf( "The expected LQ was %.2f; the calculated LQ was %.2f\n", 155 155 realLQNoMask, myStats->robustLQ ); 156 156 157 157 if ( fabs( myStats->robustLQ - realLQNoMask ) < ( ERROR_TOLERANCE * realLQNoMask ) ) { 158 testStatus = true;159 } else {160 testStatus = false;161 globalTestStatus = false;162 }158 testStatus = true; 159 } else { 160 testStatus = false; 161 globalTestStatus = false; 162 } 163 163 printFooter( stdout, 164 164 "psVector functions", 165 165 "PS_STAT_ROBUST_STATS: lower quartile: no vector mask", 166 166 testStatus ); 167 168 169 167 168 169 170 170 printPositiveTestHeader( stdout, 171 171 "psStats functions", 172 172 "PS_STAT_ROBUST_STATS: upper quartile: no vector mask" ); 173 173 174 174 printf( "The expected UQ was %.2f; the calculated UQ was %.2f\n", 175 175 realUQNoMask, myStats->robustUQ ); 176 176 if ( fabs( myStats->robustUQ - realUQNoMask ) < ( ERROR_TOLERANCE * realUQNoMask ) ) { 177 testStatus = true;178 } else {179 testStatus = false;180 globalTestStatus = false;181 }177 testStatus = true; 178 } else { 179 testStatus = false; 180 globalTestStatus = false; 181 } 182 182 printFooter( stdout, 183 183 "psVector functions", 184 184 "PS_STAT_ROBUST_STATS: lower quartile: no vector mask", 185 185 testStatus ); 186 187 188 186 187 188 189 189 printPositiveTestHeader( stdout, 190 190 "psStats functions", 191 191 "PS_STAT_ROBUST_STATS: robust N50: no vector mask" ); 192 192 193 193 // XXX: 194 194 realN50NoMask = myStats->robustN50; 195 195 196 196 printf( "The expected N50 was %.2f; the calculated N50 was %.2f\n", 197 197 realN50NoMask, myStats->robustN50 ); 198 198 if ( fabs( myStats->robustN50 - realN50NoMask ) < ( ERROR_TOLERANCE * realN50NoMask ) ) { 199 testStatus = true;200 } else {201 testStatus = false;202 globalTestStatus = false;203 }199 testStatus = true; 200 } else { 201 testStatus = false; 202 globalTestStatus = false; 203 } 204 204 printFooter( stdout, 205 205 "psVector functions", 206 206 "PS_STAT_ROBUST_STATS: robust N50: no vector mask", 207 207 testStatus ); 208 209 210 208 209 210 211 211 printPositiveTestHeader( stdout, 212 212 "psStats functions", 213 213 "PS_STAT_ROBUST_STATS: robust Nfit: no vector mask" ); 214 214 215 215 // XXX: 216 216 realNfitNoMask = myStats->robustNfit; 217 217 218 218 printf( "The expected Nfit was %.2f; the calculated Nfit was %.2f\n", 219 219 realNfitNoMask, myStats->robustNfit ); 220 220 if ( fabs( myStats->robustNfit - realNfitNoMask ) < ( ERROR_TOLERANCE * realNfitNoMask ) ) { 221 testStatus = true;222 } else {223 testStatus = false;224 globalTestStatus = false;225 }221 testStatus = true; 222 } else { 223 testStatus = false; 224 globalTestStatus = false; 225 } 226 226 printFooter( stdout, 227 227 "psVector functions", 228 228 "PS_STAT_ROBUST_STATS: robust Nfit: no vector mask", 229 229 testStatus ); 230 231 230 231 232 232 return ( 0 ); 233 233 234 234 /*************************************************************************/ 235 235 /* Call psVectorStats() with vector mask. */ … … 238 238 "psStats functions", 239 239 "PS_STAT_ROBUST_STATS: robust mean: with vector mask" ); 240 240 241 241 printf( "Calling psVectorStats() on a vector with elements masked.\n" ); 242 242 myStats = psVectorStats( myStats, myVector, maskVector, 1 ); … … 245 245 realMeanWithMask, myStats->robustMean ); 246 246 if ( fabs( myStats->robustMean - realMeanWithMask ) < ( ERROR_TOLERANCE * realMeanWithMask ) ) { 247 testStatus = true;248 } else {249 testStatus = false;250 globalTestStatus = false;251 }247 testStatus = true; 248 } else { 249 testStatus = false; 250 globalTestStatus = false; 251 } 252 252 printFooter( stdout, 253 253 "psVector functions", 254 254 "PS_STAT_ROBUST_STATS: robust mean: with vector mask", 255 255 testStatus ); 256 257 258 256 257 258 259 259 printPositiveTestHeader( stdout, 260 260 "psStats functions", 261 261 "PS_STAT_ROBUST_STATS: robust Median: with vector mask" ); 262 262 263 263 printf( "The expected Median was %.2f; the calculated Median was %.2f\n", 264 264 realMedianWithMask, myStats->robustMedian ); 265 265 if ( fabs( myStats->robustMedian - realMedianWithMask ) < ( ERROR_TOLERANCE * realMedianWithMask ) ) { 266 testStatus = true;267 } else {268 testStatus = false;269 globalTestStatus = false;270 }266 testStatus = true; 267 } else { 268 testStatus = false; 269 globalTestStatus = false; 270 } 271 271 printFooter( stdout, 272 272 "psVector functions", 273 273 "PS_STAT_ROBUST_STATS: robust Median: with vector mask", 274 274 testStatus ); 275 276 277 275 276 277 278 278 printPositiveTestHeader( stdout, 279 279 "psStats functions", 280 280 "PS_STAT_ROBUST_STATS: robust Mode: with vector mask" ); 281 281 282 282 printf( "The expected Mode was %.2f; the calculated Mode was %.2f\n", 283 283 realModeWithMask, myStats->robustMode ); 284 284 if ( fabs( myStats->robustMode - realModeWithMask ) < ( ERROR_TOLERANCE * realModeWithMask ) ) { 285 testStatus = true;286 } else {287 testStatus = false;288 globalTestStatus = false;289 }285 testStatus = true; 286 } else { 287 testStatus = false; 288 globalTestStatus = false; 289 } 290 290 printFooter( stdout, 291 291 "psVector functions", 292 292 "PS_STAT_ROBUST_STATS: robust Mode: with vector mask", 293 293 testStatus ); 294 295 296 294 295 296 297 297 printPositiveTestHeader( stdout, 298 298 "psStats functions", 299 299 "PS_STAT_ROBUST_STATS: robust Stdev: with vector mask" ); 300 300 301 301 printf( "The expected Stdev was %.2f; the calculated Stdev was %.2f\n", 302 302 realStdevWithMask, myStats->robustStdev ); 303 303 if ( fabs( myStats->robustStdev - realStdevWithMask ) < ( ERROR_TOLERANCE * realStdevWithMask ) ) { 304 testStatus = true;305 } else {306 testStatus = false;307 globalTestStatus = false;308 }304 testStatus = true; 305 } else { 306 testStatus = false; 307 globalTestStatus = false; 308 } 309 309 printFooter( stdout, 310 310 "psVector functions", 311 311 "PS_STAT_ROBUST_STATS: robust Stdev: with vector mask", 312 312 testStatus ); 313 314 315 313 314 315 316 316 printPositiveTestHeader( stdout, 317 317 "psStats functions", 318 318 "PS_STAT_ROBUST_STATS: lower quartile: with vector mask" ); 319 319 320 320 printf( "The expected LQ was %.2f; the calculated LQ was %.2f\n", 321 321 realLQWithMask, myStats->robustLQ ); 322 322 if ( fabs( myStats->robustLQ - realLQWithMask ) < ( ERROR_TOLERANCE * realLQWithMask ) ) { 323 testStatus = true;324 } else {325 testStatus = false;326 globalTestStatus = false;327 }323 testStatus = true; 324 } else { 325 testStatus = false; 326 globalTestStatus = false; 327 } 328 328 printFooter( stdout, 329 329 "psVector functions", 330 330 "PS_STAT_ROBUST_STATS: lower quartile: with vector mask", 331 331 testStatus ); 332 333 334 332 333 334 335 335 printPositiveTestHeader( stdout, 336 336 "psStats functions", 337 337 "PS_STAT_ROBUST_STATS: upper quartile: with vector mask" ); 338 338 339 339 printf( "The expected UQ was %.2f; the calculated UQ was %.2f\n", 340 340 realUQWithMask, myStats->robustUQ ); 341 341 if ( fabs( myStats->robustUQ - realUQWithMask ) < ( ERROR_TOLERANCE * realUQWithMask ) ) { 342 testStatus = true;343 } else {344 testStatus = false;345 globalTestStatus = false;346 }342 testStatus = true; 343 } else { 344 testStatus = false; 345 globalTestStatus = false; 346 } 347 347 printFooter( stdout, 348 348 "psVector functions", 349 349 "PS_STAT_ROBUST_STATS: lower quartile: with vector mask", 350 350 testStatus ); 351 352 353 351 352 353 354 354 printPositiveTestHeader( stdout, 355 355 "psStats functions", 356 356 "PS_STAT_ROBUST_STATS: robust N50: with vector mask" ); 357 357 358 358 printf( "The expected N50 was %.2f; the calculated N50 was %.2f\n", 359 359 realN50WithMask, myStats->robustN50 ); 360 360 if ( fabs( myStats->robustN50 - realN50WithMask ) < ( ERROR_TOLERANCE * realN50WithMask ) ) { 361 testStatus = true;362 } else {363 testStatus = false;364 globalTestStatus = false;365 }361 testStatus = true; 362 } else { 363 testStatus = false; 364 globalTestStatus = false; 365 } 366 366 printFooter( stdout, 367 367 "psVector functions", 368 368 "PS_STAT_ROBUST_STATS: robust N50: with vector mask", 369 369 testStatus ); 370 371 372 370 371 372 373 373 printPositiveTestHeader( stdout, 374 374 "psStats functions", 375 375 "PS_STAT_ROBUST_STATS: robust Nfit: with vector mask" ); 376 376 377 377 printf( "The expected Nfit was %.2f; the calculated Nfit was %.2f\n", 378 378 realNfitWithMask, myStats->robustNfit ); 379 379 if ( fabs( myStats->robustNfit - realNfitWithMask ) < ( ERROR_TOLERANCE * realNfitWithMask ) ) { 380 testStatus = true;381 } else {382 testStatus = false;383 globalTestStatus = false;384 }380 testStatus = true; 381 } else { 382 testStatus = false; 383 globalTestStatus = false; 384 } 385 385 printFooter( stdout, 386 386 "psVector functions", 387 387 "PS_STAT_ROBUST_STATS: robust Nfit: with vector mask", 388 388 testStatus ); 389 390 391 389 390 391 392 392 /*************************************************************************/ 393 393 /* Deallocate data structures */ … … 396 396 "psStats functions", 397 397 "psStats(): deallocating memory" ); 398 398 399 399 psFree( myStats ); 400 400 psFree( myVector ); 401 401 psFree( maskVector ); 402 402 403 403 psMemCheckCorruption( 1 ); 404 404 memLeaks = psMemCheckLeaks( currentId, NULL, NULL ); 405 405 if ( 0 != memLeaks ) { 406 psAbort( __func__, "Memory Leaks! (%d leaks)", memLeaks );407 }408 406 psAbort( __func__, "Memory Leaks! (%d leaks)", memLeaks ); 407 } 408 409 409 printFooter( stdout, 410 410 "psVector functions", 411 411 "psStats(): deallocating memory", 412 412 testStatus ); 413 413 414 414 return ( !globalTestStatus ); 415 415 } -
trunk/psLib/test/dataManip/tst_psVectorFFT.c
r1404 r1406 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-08-06 2 1:50:13$8 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-08-06 22:34:06 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Note:
See TracChangeset
for help on using the changeset viewer.
