Changeset 12242
- Timestamp:
- Mar 5, 2007, 1:23:38 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/math/tap_psStats00.c (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/math/tap_psStats00.c
r11656 r12242 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $12 * @date $Date: 2007-0 2-06 00:50:03$11 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2007-03-05 23:23:38 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii … … 54 54 static psF64 expectedMeanRangeNoMaskF32 = 0.137500; 55 55 static psF64 expectedMeanRangeWithMaskF32 = -0.366667; 56 static psF64 expectedWeightMeanNoMaskF32 = 1.807210;57 static psF64 expectedWeightMeanWithMaskF32 = 1.890217;58 static psF64 expectedWeightMeanNoMaskRangeF32 = 0.640952;59 static psF64 expectedWeightMeanWithMaskRangeF32 = 0.046574;56 static psF64 expectedWeightMeanNoMaskF32 = 2.020035; 57 static psF64 expectedWeightMeanWithMaskF32 = 2.036018; 58 static psF64 expectedWeightMeanNoMaskRangeF32 = -0.650684; 59 static psF64 expectedWeightMeanWithMaskRangeF32 = -1.046423; 60 60 61 61 #include <unistd.h> … … 69 69 psStats *myStats = psStatsAlloc(PS_STAT_SAMPLE_MEAN); 70 70 psVector *myVector = psVectorAlloc(N, PS_TYPE_F32); 71 myVector->n = N;72 71 psVector *myErrors = psVectorAlloc(N, PS_TYPE_F32); 73 myErrors->n = N;74 72 psVector *maskVector = psVectorAlloc(N, PS_TYPE_U8); 75 maskVector->n = N;76 73 // Set the appropriate values for the vector data. 77 74 for (long i = 0; i < N; i++) { … … 85 82 } 86 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 87 116 // Call psVectorStats() with no vector mask. 88 117 { 89 118 psMemId id = psMemGetId(); 90 119 bool result = psVectorStats(myStats, myVector, NULL, NULL, 0); 91 ok(result, "psVectorStats suceeded ");120 ok(result, "psVectorStats suceeded (F32: no mask vector, no error vector)"); 92 121 ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN"); 93 122 ok_float_tol(myStats->sampleMean, expectedMeanNoMaskF32, 1e-4, … … 100 129 psMemId id = psMemGetId(); 101 130 bool result = psVectorStats(myStats, myVector, myErrors, NULL, 0); 102 ok(result, "psVectorStats suceeded ");131 ok(result, "psVectorStats suceeded (F32: no mask vector, with error vector)"); 103 132 ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN"); 104 133 ok_float_tol(myStats->sampleMean, expectedWeightMeanNoMaskF32, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedWeightMeanNoMaskF32); … … 113 142 myStats->max = 8.0; 114 143 bool result = psVectorStats(myStats, myVector, NULL, NULL, 0); 115 ok(result, "psVectorStats suceeded ");144 ok(result, "psVectorStats suceeded (F32, no mask, no errors, with data range)"); 116 145 ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN"); 117 146 ok_float_tol(myStats->sampleMean, expectedMeanRangeNoMaskF32, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedMeanRangeNoMaskF32); … … 125 154 myStats->options = PS_STAT_SAMPLE_MEAN | PS_STAT_USE_RANGE; 126 155 bool result = psVectorStats(myStats, myVector, myErrors, NULL, 0); 127 ok(result, "psVectorStats suceeded ");156 ok(result, "psVectorStats suceeded (F32, no mask, with errors and data range)"); 128 157 ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN"); 129 158 ok_float_tol(myStats->sampleMean, expectedWeightMeanNoMaskRangeF32, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedWeightMeanNoMaskRangeF32); … … 136 165 myStats->options = PS_STAT_SAMPLE_MEAN; 137 166 bool result = psVectorStats(myStats, myVector, NULL, maskVector, 1); 138 ok(result, "psVectorStats suceeded ");167 ok(result, "psVectorStats suceeded (F32, with mask, no errors)"); 139 168 ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN"); 140 169 ok_float_tol(myStats->sampleMean, expectedMeanWithMaskF32, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedMeanWithMaskF32); … … 146 175 psMemId id = psMemGetId(); 147 176 bool result = psVectorStats(myStats, myVector, myErrors, maskVector, 1); 148 ok(result, "psVectorStats suceeded ");177 ok(result, "psVectorStats suceeded (F32, with mask and errors)"); 149 178 ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN"); 150 179 ok_float_tol(myStats->sampleMean, expectedWeightMeanWithMaskF32, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedWeightMeanWithMaskF32); … … 157 186 myStats->options = PS_STAT_SAMPLE_MEAN | PS_STAT_USE_RANGE; 158 187 bool result = psVectorStats(myStats, myVector, NULL, maskVector, 1); 159 ok(result, "psVectorStats suceeded ");188 ok(result, "psVectorStats suceeded (F32, with mask and data range)"); 160 189 ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN"); 161 190 ok_float_tol(myStats->sampleMean, expectedMeanRangeWithMaskF32, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedMeanRangeWithMaskF32); … … 167 196 psMemId id = psMemGetId(); 168 197 bool result = psVectorStats(myStats, myVector, myErrors, maskVector, 1); 169 ok(result, "psVectorStats suceeded ");198 ok(result, "psVectorStats suceeded (F32, withmask, errors, and data range)"); 170 199 ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN"); 171 200 ok_float_tol(myStats->sampleMean, expectedWeightMeanWithMaskRangeF32, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedWeightMeanWithMaskRangeF32); … … 183 212 } 184 213 bool result = psVectorStats(myStats, myVector, NULL, maskVector, 2); 185 ok(result, "psVectorStats suceeded ");214 ok(result, "psVectorStats suceeded (F32, with mask = 2, no errors)"); 186 215 ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN"); 187 216 ok_float_tol(myStats->sampleMean, expectedMeanWithMaskF32, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedMeanWithMaskF32); … … 199 228 } 200 229 bool result = psVectorStats(myStats, myVector, NULL, maskVector, 4); 201 ok(result, "psVectorStats suceeded ");230 ok(result, "psVectorStats suceeded (F32, with mask = 3, no errors)"); 202 231 ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN"); 203 232 ok_float_tol(myStats->sampleMean, expectedMeanNoMaskF32, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedMeanNoMaskF32); … … 205 234 } 206 235 207 // Mask all values and verify return is NAN236 // Mask all values and verify return is FALSE 208 237 { 209 238 psMemId id = psMemGetId(); … … 213 242 } 214 243 bool result = psVectorStats(myStats, myVector, NULL, maskVector, 1); 215 ok(result , "psVectorStats suceeded");244 ok(result == false, "psVectorStats suceeded (All values masked)"); 216 245 ok(isnan(myStats->sampleMean), "psVectorStats() returned NAN"); 217 246 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 245 274 246 275 bool result = psVectorStats(myStats, myVector, NULL, NULL, 0); 247 ok(result, "psVectorStats suceeded ");276 ok(result, "psVectorStats suceeded (S8, no mask, no errors)"); 248 277 ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN"); 249 278 ok_float_tol(myStats->sampleMean, expectedMeanNoMaskS8, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedMeanNoMaskS8); … … 266 295 267 296 bool result = psVectorStats(myStats, myVector, NULL, NULL, 0); 268 ok(result, "psVectorStats suceeded ");297 ok(result, "psVectorStats suceeded (U16, no mask, no errors)"); 269 298 ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN"); 270 299 ok_float_tol(myStats->sampleMean, expectedMeanNoMaskU16, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedMeanNoMaskU16); … … 286 315 287 316 bool result = psVectorStats(myStats, myVector, NULL, NULL, 0); 288 ok(result, "psVectorStats suceeded ");317 ok(result, "psVectorStats suceeded (F64, no mask, no errors)"); 289 318 ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN"); 290 319 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.
