Changeset 10848 for trunk/psLib/test/math/tap_psStats00.c
- Timestamp:
- Dec 28, 2006, 6:38:42 PM (20 years ago)
- Location:
- trunk/psLib/test/math
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
tap_psStats00.c (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/math
- Property svn:ignore
-
old new 4 4 Makefile 5 5 Makefile.in 6 tst_psFunc017 tst_psHist008 tst_psHist019 tst_psHist0210 tst_psHist0311 tst_psMatrix0112 tst_psMatrix0213 tst_psMatrix0314 tst_psMatrix0415 tst_psMatrix0516 tst_psMatrix0617 tst_psMatrix0718 tst_psMatrixVectorArithmetic0119 tst_psMatrixVectorArithmetic0220 tst_psMatrixVectorArithmetic0321 tst_psMatrixVectorArithmetic0422 tst_psRandom23 tst_psStats0024 tst_psStats0125 tst_psStats0226 tst_psStats0327 tst_psStats0528 tst_psStats0629 tst_psStats0730 tst_psStats0831 tst_psStats0932 6 seed_msglog1.txt 33 7 seed_msglog2.txt 34 tst_psSpline1D35 tst_psMathUtils36 tst_psMinimizeLMM37 tst_psMinimizePowell38 tst_psPolyFit1D39 tst_psPolyFit2D40 tst_psPolyFit3D41 tst_psPolyFit4D42 tst_psPolynomial43 tst_psPolynomialEval1D44 tst_psPolynomialEval2D45 tst_psPolynomialEval3D46 tst_psPolynomialEval4D47 8 *.bb 48 9 *.bbg 49 10 *.da 50 11 gmon.out 12 tap_psHist00 13 tap_psHist01 14 tap_psHist02 15 tap_psHist03 16 tap_psMD5 17 tap_psMatrix01 18 tap_psMatrix02 19 tap_psMatrix03 20 tap_psMatrix04 21 tap_psMatrix05 22 tap_psMatrix06 23 tap_psMatrix07 24 tap_psPolyFit1D 25 tap_psPolyFit2D 26 tap_psPolyFit3D 27 tap_psPolyFit4D 28 tap_psPolynomial 29 tap_psPolynomialEval1D 30 tap_psPolynomialEval2D 31 tap_psPolynomialEval3D 32 tap_psPolynomialEval4D 33 tap_psPolynomialUtils_Derivatives 51 34 tap_psSparse 35 tap_psStats00 36 tap_psStats01 37 tap_psStats02 38 tap_psStats03 39 tap_psStats05 40 tap_psStats06 41 tap_psStats07 42 tap_psStats08 43 tap_psStats09 52 44 tap_psStatsTiming 53 tap_psMD554 45 tap_psStats_Sample_01 55 tap_psPolynomialUtils_Derivatives
-
- Property svn:ignore
-
trunk/psLib/test/math/tap_psStats00.c
r10831 r10848 1 @file tst_psStats00.c 2 * 3 * @brief Contains tests for psVectorStats with sample mean calculations 4 * 5 * We extensively test the code with data type PS_TYPE_F32. If these pass, we 6 * do 7 a much simpler test with data type PS_TYPE_U8, PS_TYPE_U16, PS_TYPE_F64. 8 * 9 * @author GLG, MHPCC 10 * 11 * @version $Revision: 12 1.8 $ $Name: 13 $ 14 * @date $Date: 15 2006/07/28 00: 16 44: 17 05 $ 18 * 19 * Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii 20 */ 21 #include <stdio.h> 22 #include <string.h> 23 #include <pslib.h> 24 #include "tap.h" 25 #include "pstap.h" 26 27 #define N 15 28 29 static psF32 samplesF32[N] = 30 { 31 1.1, 2.2, -3.3, 4.4, 5.5, -6.6, 7.7, 8.8, -9.9, 10.0, 32 11.01, -12.02, 13.03, 14.04, -15.05 33 }; 1 /** @file tst_psStats00.c 2 * 3 * @brief Contains tests for psVectorStats with sample mean calculations 4 * 5 6 * We extensively test the code with data type PS_TYPE_F32. If these pass, we do a much 7 * simpler test with data type PS_TYPE_U8, PS_TYPE_U16, PS_TYPE_F64. 8 * 9 * @author GLG, MHPCC 10 * 11 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2006-12-29 04:38:42 $ 13 * 14 * Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii 15 */ 16 17 #include <stdio.h> 18 #include <string.h> 19 #include <pslib.h> 20 #include "tap.h" 21 #include "pstap.h" 22 23 #define N 15 24 25 static psF32 samplesF32[N] = 26 { 27 1.1, 2.2, -3.3, 4.4, 5.5, -6.6, 7.7, 8.8, -9.9, 10.0, 28 11.01, -12.02, 13.03, 14.04, -15.05 29 }; 34 30 static psS8 samplesS8[N] = 35 31 { … … 92 88 { 93 89 psMemId id = psMemGetId(); 94 myStats = psVectorStats(myStats, myVector, NULL, NULL, 0); 90 bool result = psVectorStats(myStats, myVector, NULL, NULL, 0); 91 ok(result, "psVectorStats suceeded"); 95 92 ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN"); 96 93 ok_float_tol(myStats->sampleMean, expectedMeanNoMaskF32, 1e-4, … … 102 99 { 103 100 psMemId id = psMemGetId(); 104 myStats = psVectorStats(myStats, myVector, myErrors, NULL, 0); 101 bool result = psVectorStats(myStats, myVector, myErrors, NULL, 0); 102 ok(result, "psVectorStats suceeded"); 105 103 ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN"); 106 104 ok_float_tol(myStats->sampleMean, expectedWeightMeanNoMaskF32, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedWeightMeanNoMaskF32); … … 114 112 myStats->min = -10.0; 115 113 myStats->max = 8.0; 116 myStats = psVectorStats(myStats, myVector, NULL, NULL, 0); 114 bool result = psVectorStats(myStats, myVector, NULL, NULL, 0); 115 ok(result, "psVectorStats suceeded"); 117 116 ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN"); 118 117 ok_float_tol(myStats->sampleMean, expectedMeanRangeNoMaskF32, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedMeanRangeNoMaskF32); … … 125 124 psMemId id = psMemGetId(); 126 125 myStats->options = PS_STAT_SAMPLE_MEAN | PS_STAT_USE_RANGE; 127 myStats = psVectorStats(myStats, myVector, myErrors, NULL, 0); 126 bool result = psVectorStats(myStats, myVector, myErrors, NULL, 0); 127 ok(result, "psVectorStats suceeded"); 128 128 ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN"); 129 129 ok_float_tol(myStats->sampleMean, expectedWeightMeanNoMaskRangeF32, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedWeightMeanNoMaskRangeF32); … … 135 135 psMemId id = psMemGetId(); 136 136 myStats->options = PS_STAT_SAMPLE_MEAN; 137 myStats = psVectorStats(myStats, myVector, NULL, maskVector, 1); 137 bool result = psVectorStats(myStats, myVector, NULL, maskVector, 1); 138 ok(result, "psVectorStats suceeded"); 138 139 ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN"); 139 140 ok_float_tol(myStats->sampleMean, expectedMeanWithMaskF32, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedMeanWithMaskF32); … … 144 145 { 145 146 psMemId id = psMemGetId(); 146 myStats = psVectorStats(myStats, myVector, myErrors, maskVector, 1); 147 bool result = psVectorStats(myStats, myVector, myErrors, maskVector, 1); 148 ok(result, "psVectorStats suceeded"); 147 149 ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN"); 148 150 ok_float_tol(myStats->sampleMean, expectedWeightMeanWithMaskF32, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedWeightMeanWithMaskF32); … … 154 156 psMemId id = psMemGetId(); 155 157 myStats->options = PS_STAT_SAMPLE_MEAN | PS_STAT_USE_RANGE; 156 myStats = psVectorStats(myStats, myVector, NULL, maskVector, 1); 158 bool result = psVectorStats(myStats, myVector, NULL, maskVector, 1); 159 ok(result, "psVectorStats suceeded"); 157 160 ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN"); 158 161 ok_float_tol(myStats->sampleMean, expectedMeanRangeWithMaskF32, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedMeanRangeWithMaskF32); … … 163 166 { 164 167 psMemId id = psMemGetId(); 165 myStats = psVectorStats(myStats, myVector, myErrors, maskVector, 1); 168 bool result = psVectorStats(myStats, myVector, myErrors, maskVector, 1); 169 ok(result, "psVectorStats suceeded"); 166 170 ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN"); 167 171 ok_float_tol(myStats->sampleMean, expectedWeightMeanWithMaskRangeF32, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedWeightMeanWithMaskRangeF32); … … 178 182 } 179 183 } 180 myStats = psVectorStats(myStats, myVector, NULL, maskVector, 2); 184 bool result = psVectorStats(myStats, myVector, NULL, maskVector, 2); 185 ok(result, "psVectorStats suceeded"); 181 186 ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN"); 182 187 ok_float_tol(myStats->sampleMean, expectedMeanWithMaskF32, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedMeanWithMaskF32); … … 193 198 } 194 199 } 195 myStats = psVectorStats(myStats, myVector, NULL, maskVector, 4); 200 bool result = psVectorStats(myStats, myVector, NULL, maskVector, 4); 201 ok(result, "psVectorStats suceeded"); 196 202 ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN"); 197 203 ok_float_tol(myStats->sampleMean, expectedMeanNoMaskF32, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedMeanNoMaskF32); … … 206 212 maskVector->data.U8[i] = 1; 207 213 } 208 myStats = psVectorStats(myStats, myVector, NULL, maskVector, 1); 214 bool result = psVectorStats(myStats, myVector, NULL, maskVector, 1); 215 ok(result, "psVectorStats suceeded"); 209 216 ok(isnan(myStats->sampleMean), "psVectorStats() returned NAN"); 210 217 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 214 221 { 215 222 psMemId id = psMemGetId(); 216 ok(psVectorStats(myStats, NULL, NULL, NULL, 0) == NULL, "psVectorStats() returned NULL with NULL inputs"); 217 ok(psVectorStats(NULL, myVector, NULL, NULL, 0) == NULL, "psVectorStats() returned NULL with NULL inputs"); 218 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 219 } 220 221 222 223 224 225 226 227 228 229 223 ok(!psVectorStats(myStats, NULL, NULL, NULL, 0), "psVectorStats() returned false with NULL inputs"); 224 ok(!psVectorStats(NULL, myVector, NULL, NULL, 0), "psVectorStats() returned false with NULL inputs"); 225 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 226 } 230 227 231 228 psFree(myStats); … … 247 244 } 248 245 249 myStats = psVectorStats(myStats, myVector, NULL, NULL, 0); 246 bool result = psVectorStats(myStats, myVector, NULL, NULL, 0); 247 ok(result, "psVectorStats suceeded"); 250 248 ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN"); 251 249 ok_float_tol(myStats->sampleMean, expectedMeanNoMaskS8, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedMeanNoMaskS8); … … 267 265 } 268 266 269 myStats = psVectorStats(myStats, myVector, NULL, NULL, 0); 267 bool result = psVectorStats(myStats, myVector, NULL, NULL, 0); 268 ok(result, "psVectorStats suceeded"); 270 269 ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN"); 271 270 ok_float_tol(myStats->sampleMean, expectedMeanNoMaskU16, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedMeanNoMaskU16); … … 286 285 } 287 286 288 myStats = psVectorStats(myStats, myVector, NULL, NULL, 0); 287 bool result = psVectorStats(myStats, myVector, NULL, NULL, 0); 288 ok(result, "psVectorStats suceeded"); 289 289 ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN"); 290 290 ok_float_tol(myStats->sampleMean, expectedMeanNoMaskF64, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedMeanNoMaskF64);
Note:
See TracChangeset
for help on using the changeset viewer.
