Changeset 7137 for trunk/psLib/test/math/tst_psPolyFit4D.c
- Timestamp:
- May 17, 2006, 5:09:15 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/math/tst_psPolyFit4D.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/math/tst_psPolyFit4D.c
r7118 r7137 11 11 #include "pslib.h" 12 12 #include "psTest.h" 13 #define NUM_DATA 3014 #define POLY_ORDER_X 215 #define POLY_ORDER_Y 216 #define POLY_ORDER_Z 217 #define POLY_ORDER_T 218 #define A 1 .013 #define NUM_DATA 200 14 #define POLY_ORDER_X 1 15 #define POLY_ORDER_Y 1 16 #define POLY_ORDER_Z 1 17 #define POLY_ORDER_T 1 18 #define A 100.0 19 19 #define B 2.0 20 20 #define C 3.0 21 21 #define D 4.0 22 22 #define E 5.0 23 #define F 4.023 #define F 6.0 24 24 #define H 3.0 25 25 #define J 3.0 … … 31 31 #define P 1.0 32 32 #define Q 5.0 33 #define ERROR_TOLERANCE 0. 1034 #define YERR 10.035 #define VERBOSE 133 #define ERROR_TOLERANCE 0.05 34 #define YERR 0.1 35 #define VERBOSE 0 36 36 #define NUM_ITERATIONS 5 37 #define CLIP_SIGMA 4.037 #define CLIP_SIGMA 3.0 38 38 #define OUTLIERS true 39 39 #define MASK_VALUE 1 … … 76 76 return(A + (B * x) + (C * y) + (D * z) + (E * t)); 77 77 } else { 78 #if 0 78 79 return(A + (B * x) + (C * y) + (D * z) + (E * t) + 79 80 (F * x * x) + (H * y * y) + (J * z * z) + (K * t * t) + 80 81 (L * x * y) + (M * x * z) + (N * x * t) + (O * y * z) + (P * y * t) + (Q * z * t)); 82 #else 83 84 return A + (B * x) + (C * y) + (D * z) + (E * t) + (F * x * y); 85 #endif 86 81 87 } 82 88 } … … 143 149 myPoly = psPolynomial4DAlloc(PS_POLYNOMIAL_ORD, polyOrderX, polyOrderY, 144 150 polyOrderZ, polyOrderT); 151 152 #if 1 153 154 for (int ix = 0; ix < polyOrderX + 1; ix++) { 155 for (int iy = 0; iy < polyOrderY + 1; iy++) { 156 for (int iz = 0; iz < polyOrderZ + 1; iz++) { 157 for (int it = 0; it < polyOrderT + 1; it++) { 158 myPoly->mask[ix][iy][iz][it] = 0xff; // Mask it out 159 } 160 } 161 } 162 } 163 164 // Put these back in 165 myPoly->mask[0][0][0][0] = 0; // A 166 myPoly->mask[1][0][0][0] = 0; // B * x 167 myPoly->mask[0][1][0][0] = 0; // C * y 168 myPoly->mask[0][0][1][0] = 0; // D * z 169 myPoly->mask[0][0][0][1] = 0; // E * t 170 myPoly->mask[1][1][0][0] = 0; // F * xy 171 #endif 172 145 173 } 146 174 … … 232 260 // Set a few outliers in the data. 233 261 if (OUTLIERS && (flags & TS00_CLIP_FIT)) { 234 f->data.F32[numData/4] *= 2.0;235 f->data.F32[numData/2] *= 2.0;236 f->data.F32[3*numData/4] *= 2.0;262 f->data.F32[numData/4] *= 2.0; 263 f->data.F32[numData/2] *= 2.0; 264 f->data.F32[3*numData/4] *= 2.0; 237 265 } 238 266 } … … 243 271 // Set a few outliers in the data. 244 272 if (OUTLIERS && (flags & TS00_CLIP_FIT)) { 245 f->data.S32[numData/4] *= 2.0;246 f->data.S32[numData/2] *= 2.0;247 f->data.S32[3*numData/4] *= 2.0;273 f->data.S32[numData/4] *= 2.0; 274 f->data.S32[numData/2] *= 2.0; 275 f->data.S32[3*numData/4] *= 2.0; 248 276 } 249 277 } … … 254 282 // Set a few outliers in the data. 255 283 if (OUTLIERS && (flags & TS00_CLIP_FIT)) { 256 f->data.F64[numData/4] *= 2.0;257 f->data.F64[numData/2] *= 2.0;258 f->data.F64[3*numData/4] *= 2.0;284 f->data.F64[numData/4] *= 2.0; 285 f->data.F64[numData/2] *= 2.0; 286 f->data.F64[3*numData/4] *= 2.0; 259 287 } 260 288 } … … 354 382 355 383 if (fabs(actualData-expectData) > fabs(ERROR_TOLERANCE * expectData)) { 356 printf("TEST ERROR: Fitted data %d: (% .1f), expected was (%.1f)\n",384 printf("TEST ERROR: Fitted data %d: (%f), expected was (%f)\n", 357 385 i, actualData, expectData); 358 386 testStatus = false;
Note:
See TracChangeset
for help on using the changeset viewer.
