Changeset 2780
- Timestamp:
- Dec 21, 2004, 1:25:14 PM (22 years ago)
- Location:
- trunk/psLib
- Files:
-
- 2 added
- 15 edited
-
src/dataManip/psRandom.h (modified) (1 diff)
-
src/dataManip/psStats.c (modified) (7 diffs)
-
src/math/psRandom.h (modified) (1 diff)
-
src/math/psStats.c (modified) (7 diffs)
-
test/dataManip/Makefile (modified) (2 diffs)
-
test/dataManip/tst_psHist02.c (modified) (5 diffs)
-
test/dataManip/tst_psHist03.c (modified) (1 diff)
-
test/dataManip/tst_psRandom.c (added)
-
test/dataManip/tst_psStats00.c (modified) (5 diffs)
-
test/dataManip/tst_psStats01.c (modified) (2 diffs)
-
test/dataManip/tst_psStats02.c (modified) (2 diffs)
-
test/dataManip/tst_psStats03.c (modified) (2 diffs)
-
test/dataManip/tst_psStats06.c (modified) (2 diffs)
-
test/dataManip/tst_psStats07.c (modified) (2 diffs)
-
test/dataManip/tst_psStats08.c (modified) (4 diffs)
-
test/dataManip/tst_psStats09.c (modified) (2 diffs)
-
test/dataManip/verified/tst_psRandom.stdout (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/dataManip/psRandom.h
r2432 r2780 10 10 * @author GLG, MHPCC 11 11 * 12 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-1 1-24 20:55:01$12 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-12-21 23:25:14 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 16 16 */ 17 17 18 #if !defined(PS_ FUNCTIONS_H)19 #define PS_ FUNCTIONS_H18 #if !defined(PS_RANDOM_H) 19 #define PS_RANDOM_H 20 20 21 21 #include <stdio.h> -
trunk/psLib/src/dataManip/psStats.c
r2778 r2780 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.10 5$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-12-21 2 0:42:07$11 * @version $Revision: 1.106 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-12-21 23:25:14 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 151 151 psStats* stats) 152 152 { 153 153 154 psS32 i = 0; // Loop index variable 154 155 float mean = 0.0; // The mean … … 920 921 sumDiffs += diff; 921 922 countInt++; 922 errorDivisor+= (1.0 / PS_SQR(errors->data.F32[i])); 923 if (errors != NULL) { 924 errorDivisor+= (1.0 / PS_SQR(errors->data.F32[i])); 925 } 923 926 } 924 927 } … … 931 934 sumDiffs += diff; 932 935 countInt++; 933 errorDivisor+= (1.0 / PS_SQR(errors->data.F32[i])); 936 if (errors != NULL) { 937 errorDivisor+= (1.0 / PS_SQR(errors->data.F32[i])); 938 } 934 939 } 935 940 } … … 944 949 sumDiffs += diff; 945 950 countInt++; 946 errorDivisor+= (1.0 / PS_SQR(errors->data.F32[i])); 951 if (errors != NULL) { 952 errorDivisor+= (1.0 / PS_SQR(errors->data.F32[i])); 953 } 947 954 } 948 955 } … … 955 962 } 956 963 countInt = myVector->n; 957 errorDivisor+= (1.0 / PS_SQR(errors->data.F32[i])); 964 if (errors != NULL) { 965 errorDivisor+= (1.0 / PS_SQR(errors->data.F32[i])); 966 } 958 967 } 959 968 } … … 1962 1971 psVector* p_psConvertToF32(psVector* in) 1963 1972 { 1973 if (in == NULL) { 1974 return(NULL); 1975 } 1964 1976 psS32 i = 0; 1965 1977 psVector* tmp = NULL; -
trunk/psLib/src/math/psRandom.h
r2432 r2780 10 10 * @author GLG, MHPCC 11 11 * 12 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-1 1-24 20:55:01$12 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-12-21 23:25:14 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 16 16 */ 17 17 18 #if !defined(PS_ FUNCTIONS_H)19 #define PS_ FUNCTIONS_H18 #if !defined(PS_RANDOM_H) 19 #define PS_RANDOM_H 20 20 21 21 #include <stdio.h> -
trunk/psLib/src/math/psStats.c
r2778 r2780 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.10 5$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-12-21 2 0:42:07$11 * @version $Revision: 1.106 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-12-21 23:25:14 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 151 151 psStats* stats) 152 152 { 153 153 154 psS32 i = 0; // Loop index variable 154 155 float mean = 0.0; // The mean … … 920 921 sumDiffs += diff; 921 922 countInt++; 922 errorDivisor+= (1.0 / PS_SQR(errors->data.F32[i])); 923 if (errors != NULL) { 924 errorDivisor+= (1.0 / PS_SQR(errors->data.F32[i])); 925 } 923 926 } 924 927 } … … 931 934 sumDiffs += diff; 932 935 countInt++; 933 errorDivisor+= (1.0 / PS_SQR(errors->data.F32[i])); 936 if (errors != NULL) { 937 errorDivisor+= (1.0 / PS_SQR(errors->data.F32[i])); 938 } 934 939 } 935 940 } … … 944 949 sumDiffs += diff; 945 950 countInt++; 946 errorDivisor+= (1.0 / PS_SQR(errors->data.F32[i])); 951 if (errors != NULL) { 952 errorDivisor+= (1.0 / PS_SQR(errors->data.F32[i])); 953 } 947 954 } 948 955 } … … 955 962 } 956 963 countInt = myVector->n; 957 errorDivisor+= (1.0 / PS_SQR(errors->data.F32[i])); 964 if (errors != NULL) { 965 errorDivisor+= (1.0 / PS_SQR(errors->data.F32[i])); 966 } 958 967 } 959 968 } … … 1962 1971 psVector* p_psConvertToF32(psVector* in) 1963 1972 { 1973 if (in == NULL) { 1974 return(NULL); 1975 } 1964 1976 psS32 i = 0; 1965 1977 psVector* tmp = NULL; -
trunk/psLib/test/dataManip/Makefile
r2759 r2780 3 3 ## Makefile: test/sysUtils 4 4 ## 5 ## $Revision: 1.5 3$ $Name: not supported by cvs2svn $6 ## $Date: 2004-12-2 0 19:33:53$5 ## $Revision: 1.54 $ $Name: not supported by cvs2svn $ 6 ## $Date: 2004-12-21 23:24:49 $ 7 7 ## 8 8 ## Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 57 57 tst_psStats08 \ 58 58 tst_psStats09 \ 59 tst_psRandom \ 59 60 tst_psVectorFFT 60 61 # tst_psFunc06 \ -
trunk/psLib/test/dataManip/tst_psHist02.c
r2721 r2780 66 66 67 67 myHist = psHistogramAlloc( LOWER, UPPER, numBins ); 68 myHist = psVectorHistogram( myHist, myData, NULL, 0 );68 myHist = psVectorHistogram( myHist, myData, NULL, NULL, 0 ); 69 69 70 70 for ( i = 0;i < numBins;i++ ) { … … 91 91 92 92 myHist = psHistogramAlloc( LOWER, UPPER, numBins ); 93 myHist = psVectorHistogram( myHist, myData, myMask, 1 );93 myHist = psVectorHistogram( myHist, myData, NULL, myMask, 1 ); 94 94 95 95 for ( i = 0;i < numBins;i++ ) { … … 121 121 122 122 psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message."); 123 myHist2 = psVectorHistogram( NULL, myData, NULL, 0 );123 myHist2 = psVectorHistogram( NULL, myData, NULL, NULL, 0 ); 124 124 if ( myHist2 != NULL ) { 125 125 printf( "ERROR: myHist2!=NULL\n" ); … … 136 136 myHist = psHistogramAlloc( LOWER, UPPER, numBins ); 137 137 psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message."); 138 myHist = psVectorHistogram( myHist, NULL, NULL, 0 );138 myHist = psVectorHistogram( myHist, NULL, NULL, NULL, 0 ); 139 139 if ( myHist == NULL ) { 140 140 printf( "ERROR: myHist==NULL\n" ); … … 155 155 myData->n = myData->nalloc; 156 156 myHist = psHistogramAlloc(LOWER, UPPER, numBins); 157 myHist = psVectorHistogram(myHist, NULL, NULL, 0);157 myHist = psVectorHistogram(myHist, NULL, NULL, NULL, 0); 158 158 if (myHist == NULL) { 159 159 printf("ERROR: myHist==NULL\n"); -
trunk/psLib/test/dataManip/tst_psHist03.c
r2392 r2780 89 89 } 90 90 91 myHist = psVectorHistogram( myHist, myData, NULL, 0 );91 myHist = psVectorHistogram( myHist, myData, NULL, NULL, 0 ); 92 92 for (i=0;i<numBins;i++) { 93 93 printf("Bin number %d bounds: (%6.3f - %6.3f): data: (%d)\n", i, -
trunk/psLib/test/dataManip/tst_psStats00.c
r2723 r2780 63 63 "PS_STAT_SAMPLE_MEAN: no vector mask"); 64 64 65 myStats = psVectorStats(myStats, myVector, NULL, 0);65 myStats = psVectorStats(myStats, myVector, NULL, NULL, 0); 66 66 mean = myStats->sampleMean; 67 67 … … 86 86 "PS_STAT_SAMPLE_MEAN: with vector mask=1"); 87 87 88 myStats = psVectorStats(myStats, myVector, maskVector, 1);88 myStats = psVectorStats(myStats, myVector, NULL, maskVector, 1); 89 89 mean = myStats->sampleMean; 90 90 printf("Called psVectorStats() on a vector with last N/2 elements masked.\n"); … … 117 117 } 118 118 119 myStats = psVectorStats(myStats, myVector, maskVector, 2);119 myStats = psVectorStats(myStats, myVector, NULL, maskVector, 2); 120 120 mean = myStats->sampleMean; 121 121 printf("Called psVectorStats() on a vector with last N/2 elements masked.\n"); … … 148 148 } 149 149 150 myStats = psVectorStats(myStats, myVector, maskVector, 3);150 myStats = psVectorStats(myStats, myVector, NULL, maskVector, 3); 151 151 mean = myStats->sampleMean; 152 152 printf("Called psVectorStats() on a vector with last N/2 elements masked.\n"); … … 173 173 174 174 psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message."); 175 if( psVectorStats(myStats, NULL, NULL, 0) != myStats ) {175 if( psVectorStats(myStats, NULL, NULL, NULL, 0) != myStats ) { 176 176 psError(PS_ERR_UNKNOWN,true,"psVectorStats did not return stats when input NULL"); 177 177 return 10; 178 178 } 179 179 psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message."); 180 psStats *myStats2 = psVectorStats(NULL, myVector, NULL, 0);180 psStats *myStats2 = psVectorStats(NULL, myVector, NULL, NULL, 0); 181 181 if ( myStats2 != NULL ) { 182 182 psError(PS_ERR_UNKNOWN,true,"psVectorStats did not return NULL"); -
trunk/psLib/test/dataManip/tst_psStats01.c
r2392 r2780 61 61 "PS_STAT_MAX: no vector mask"); 62 62 63 myStats = psVectorStats(myStats, myVector, NULL, 0);63 myStats = psVectorStats(myStats, myVector, NULL, NULL, 0); 64 64 max = myStats->max; 65 65 … … 84 84 "PS_STAT_MAX: with vector mask"); 85 85 86 myStats = psVectorStats(myStats, myVector, maskVector, 1);86 myStats = psVectorStats(myStats, myVector, NULL, maskVector, 1); 87 87 max = myStats->max; 88 88 printf("Called psVectorStats() on a vector with last N/2 elements masked.\n"); -
trunk/psLib/test/dataManip/tst_psStats02.c
r2392 r2780 59 59 "PS_STAT_MIN: no vector mask"); 60 60 61 myStats = psVectorStats(myStats, myVector, NULL, 0);61 myStats = psVectorStats(myStats, myVector, NULL, NULL, 0); 62 62 min = myStats->min; 63 63 … … 83 83 "PS_STAT_MIN: with vector mask"); 84 84 85 myStats = psVectorStats(myStats, myVector, maskVector, 1);85 myStats = psVectorStats(myStats, myVector, NULL, maskVector, 1); 86 86 min = myStats->min; 87 87 printf("Called psVectorStats() on a vector with last N/2 elements masked.\n"); -
trunk/psLib/test/dataManip/tst_psStats03.c
r2392 r2780 53 53 "PS_STAT_SAMPLE_MEDIAN: no vector mask"); 54 54 55 myStats = psVectorStats(myStats, myVector, NULL, 0);55 myStats = psVectorStats(myStats, myVector, NULL, NULL, 0); 56 56 median = myStats->sampleMedian; 57 57 … … 78 78 "PS_STAT_SAMPLE_MEDIAN: with vector mask"); 79 79 80 myStats = psVectorStats(myStats, myVector, maskVector, 1);80 myStats = psVectorStats(myStats, myVector, NULL, maskVector, 1); 81 81 median = myStats->sampleMedian; 82 82 printf("Called psVectorStats() on a vector with last N/2 elements masked.\n"); -
trunk/psLib/test/dataManip/tst_psStats06.c
r2392 r2780 62 62 "PS_STAT_SAMPLE_STDEV: no vector mask"); 63 63 64 myStats = psVectorStats(myStats, myVector, NULL, 0);64 myStats = psVectorStats(myStats, myVector, NULL, NULL, 0); 65 65 stdev = myStats->sampleStdev; 66 66 … … 86 86 "PS_STAT_SAMPLE_STDEV: with vector mask"); 87 87 88 myStats = psVectorStats(myStats, myVector, maskVector, 1);88 myStats = psVectorStats(myStats, myVector, NULL, maskVector, 1); 89 89 stdev = myStats->sampleStdev; 90 90 printf("Called psVectorStats() on a vector with last N/2 elements masked.\n"); -
trunk/psLib/test/dataManip/tst_psStats07.c
r2738 r2780 72 72 "PS_STAT_ROBUST_STATS: robust mean: no vector mask" ); 73 73 74 myStats = psVectorStats( myStats, myVector, NULL, 0 );74 myStats = psVectorStats( myStats, myVector, NULL, NULL, 0 ); 75 75 76 76 printf( "The expected Mean was %.2f; the calculated Mean was %.2f\n", … … 312 312 313 313 printf( "Calling psVectorStats() on a vector with elements masked.\n" ); 314 myStats = psVectorStats( myStats, myVector, maskVector, 1 );314 myStats = psVectorStats( myStats, myVector, NULL, maskVector, 1 ); 315 315 printf( "Called psVectorStats() on a vector with elements masked.\n" ); 316 316 printf( "The expected Mean was %.2f; the calculated Mean was %.2f\n", -
trunk/psLib/test/dataManip/tst_psStats08.c
r2392 r2780 63 63 "PS_STAT_SAMPLE_LQ: no vector mask"); 64 64 65 myStats = psVectorStats(myStats, myVector, NULL, 0);65 myStats = psVectorStats(myStats, myVector, NULL, NULL, 0); 66 66 67 67 printf("Called psVectorStats() on a vector with no elements masked.\n"); … … 85 85 "PS_STAT_SAMPLE_UQ: no vector mask"); 86 86 87 myStats = psVectorStats(myStats, myVector, NULL, 0);87 myStats = psVectorStats(myStats, myVector, NULL, NULL, 0); 88 88 89 89 printf("Called psVectorStats() on a vector with no elements masked.\n"); … … 108 108 "PS_STAT_SAMPLE_LQ: with vector mask"); 109 109 110 myStats = psVectorStats(myStats, myVector, maskVector, 1);110 myStats = psVectorStats(myStats, myVector, NULL, maskVector, 1); 111 111 112 112 printf("Called psVectorStats() on a vector with elements masked.\n"); … … 130 130 "PS_STAT_SAMPLE_UQ: with vector mask"); 131 131 132 myStats = psVectorStats(myStats, myVector, maskVector, 1);132 myStats = psVectorStats(myStats, myVector, NULL, maskVector, 1); 133 133 134 134 printf("Called psVectorStats() on a vector with elements masked.\n"); -
trunk/psLib/test/dataManip/tst_psStats09.c
r2392 r2780 68 68 "PS_STAT_CLIPPED_MEAN: no vector mask"); 69 69 70 myStats = psVectorStats(myStats, myGaussData, NULL, 0);70 myStats = psVectorStats(myStats, myGaussData, NULL, NULL, 0); 71 71 72 72 printf("Called psVectorStats() on a vector with no elements masked.\n"); … … 99 99 "PS_STAT_CLIPPED_MEAN: vector mask"); 100 100 101 myStats = psVectorStats(myStats, myGaussData, maskVector, 1);101 myStats = psVectorStats(myStats, myGaussData, NULL, maskVector, 1); 102 102 103 103 printf("Called psVectorStats() on a vector with elements masked.\n");
Note:
See TracChangeset
for help on using the changeset viewer.
