Changeset 5155 for trunk/psLib/test/math
- Timestamp:
- Sep 27, 2005, 1:19:47 PM (21 years ago)
- Location:
- trunk/psLib/test/math
- Files:
-
- 3 added
- 5 deleted
- 2 edited
-
Makefile.am (modified) (2 diffs)
-
tst_psFunc02.c (deleted)
-
tst_psFunc03.c (deleted)
-
tst_psFunc04.c (deleted)
-
tst_psFunc05.c (deleted)
-
tst_psFunc07.c (deleted)
-
tst_psSpline1D.c (added)
-
tst_psStats07.c (modified) (2 diffs)
-
verified/tst_psSpline1D.stderr (added)
-
verified/tst_psSpline1D.stdout (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/math/Makefile.am
r5001 r5155 7 7 tst_psFunc00 \ 8 8 tst_psFunc01 \ 9 tst_psFunc02 \10 tst_psFunc03 \11 tst_psFunc04 \12 tst_psFunc05 \13 tst_psFunc07 \14 9 tst_psFunc08 \ 15 10 tst_psFunc09 \ … … 48 43 tst_psStats08 \ 49 44 tst_psStats09 \ 45 tst_psSpline1D \ 50 46 tst_psRandom 51 47 52 48 tst_psFunc00_SOURCES = tst_psFunc00.c 53 49 tst_psFunc01_SOURCES = tst_psFunc01.c 54 tst_psFunc02_SOURCES = tst_psFunc02.c55 tst_psFunc03_SOURCES = tst_psFunc03.c56 tst_psFunc04_SOURCES = tst_psFunc04.c57 tst_psFunc05_SOURCES = tst_psFunc05.c58 tst_psFunc07_SOURCES = tst_psFunc07.c59 50 tst_psFunc08_SOURCES = tst_psFunc08.c 60 51 tst_psFunc09_SOURCES = tst_psFunc09.c -
trunk/psLib/test/math/tst_psStats07.c
r5117 r5155 44 44 /* Allocate and initialize data structures */ 45 45 /*************************************************************************/ 46 maskVector = psVectorAlloc( N, PS_TYPE_U8 ); 47 maskVector->n = N; 48 myVector = p_psGaussianDev( MEAN, STDEV, N ); 49 // Set the mask vector and calculate the expected maximum. 50 for ( i = 0;i < N;i++ ) { 51 if ( i < ( N / 2 ) ) { 52 maskVector->data.U8[ i ] = 0; 53 count++; 54 } else { 55 maskVector->data.U8[ i ] = 1; 56 } 57 } 58 psStats *mySampleStats = psStatsAlloc( PS_STAT_SAMPLE_MEAN | 59 PS_STAT_SAMPLE_MEDIAN | 60 PS_STAT_SAMPLE_STDEV | 61 PS_STAT_SAMPLE_QUARTILE ); 62 mySampleStats = psVectorStats( mySampleStats, myVector, NULL, NULL, 0 ); 63 printf("The Sample Mean is %.2f\n", mySampleStats->sampleMean); 64 printf("The Sample Median is %.2f\n", mySampleStats->sampleMedian); 65 printf("The Sample stdev is %.2f\n", mySampleStats->sampleStdev); 66 printf("The Sample quartiles are (%.2f %.2f)\n", mySampleStats->sampleLQ, mySampleStats->sampleUQ); 67 psFree(mySampleStats); 68 69 psStats *mySampleStatsWithMask = psStatsAlloc( PS_STAT_SAMPLE_MEAN | 70 PS_STAT_SAMPLE_MEDIAN | 71 PS_STAT_SAMPLE_STDEV | 72 PS_STAT_SAMPLE_QUARTILE ); 73 mySampleStatsWithMask = psVectorStats( mySampleStatsWithMask, myVector, NULL, maskVector, 1 ); 74 printf("The Sample Mean is %.2f\n", mySampleStatsWithMask->sampleMean); 75 printf("The Sample Median is %.2f\n", mySampleStatsWithMask->sampleMedian); 76 printf("The Sample stdev is %.2f\n", mySampleStatsWithMask->sampleStdev); 77 printf("The Sample quartiles are (%.2f %.2f)\n", mySampleStatsWithMask->sampleLQ, mySampleStatsWithMask->sampleUQ); 78 psFree(mySampleStatsWithMask); 79 46 80 myStats = psStatsAlloc( PS_STAT_ROBUST_MEAN | 47 81 PS_STAT_ROBUST_MEDIAN | … … 49 83 PS_STAT_ROBUST_STDEV | 50 84 PS_STAT_ROBUST_QUARTILE ); 51 52 maskVector = psVectorAlloc( N, PS_TYPE_U8 );53 maskVector->n = N;54 myVector = p_psGaussianDev( MEAN, STDEV, N );55 85 // Create a full outliers: 56 86 myVector->data.F32[N/4] = -1000.0 * MEAN; 57 87 myVector->data.F32[N/2] = 1000.0 * MEAN; 58 // Set the mask vector and calculate the expected maximum.59 for ( i = 0;i < N;i++ ) {60 if ( i < ( N / 2 ) ) {61 maskVector->data.U8[ i ] = 0;62 count++;63 } else {64 maskVector->data.U8[ i ] = 1;65 }66 }67 88 /*************************************************************************/ 68 89 /* Call psVectorStats() with no vector mask. */
Note:
See TracChangeset
for help on using the changeset viewer.
