Changeset 21183 for trunk/psLib/src/math/psPolynomialMD.c
- Timestamp:
- Jan 26, 2009, 8:40:07 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/math/psPolynomialMD.c (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/math/psPolynomialMD.c
r19085 r21183 132 132 const psVector *values, // Measured values 133 133 const psVector *mask, // Mask for values 134 ps MaskType maskVal134 psVectorMaskType maskVal 135 135 ) 136 136 { … … 143 143 int numGood = numValues; // Number of good values 144 144 for (int i = 0; i < numValues; i++) { 145 if (mask && (mask->data. U8[i] & maskVal)) {145 if (mask && (mask->data.PS_TYPE_VECTOR_MASK_DATA[i] & maskVal)) { 146 146 numGood--; 147 147 continue; … … 253 253 254 254 bool psPolynomialMDFit(psPolynomialMD *poly, const psVector *values, const psVector *errors, 255 const psVector *mask, ps MaskType maskVal, const psArray *coordsArray)255 const psVector *mask, psVectorMaskType maskVal, const psArray *coordsArray) 256 256 { 257 257 PS_ASSERT_POLYNOMIALMD_NON_NULL(poly, false); … … 268 268 if (mask) { 269 269 PS_ASSERT_VECTOR_NON_NULL(mask, false); 270 PS_ASSERT_VECTOR_TYPE(mask, PS_TYPE_ MASK, false);270 PS_ASSERT_VECTOR_TYPE(mask, PS_TYPE_VECTOR_MASK, false); 271 271 PS_ASSERT_VECTORS_SIZE_EQUAL(values, mask, false); 272 272 } … … 294 294 PS_ASSERT_VECTOR_TYPE(coords, PS_TYPE_F32, false); 295 295 296 if (mask && (mask->data.PS_TYPE_ MASK_DATA[i] & maskVal)) {296 if (mask && (mask->data.PS_TYPE_VECTOR_MASK_DATA[i] & maskVal)) { 297 297 continue; 298 298 } … … 321 321 } 322 322 323 // XXX this function should take a (ps MaskType markVal) argument323 // XXX this function should take a (psVectorMaskType markVal) argument 324 324 bool psPolynomialMDClipFit(psPolynomialMD *poly, const psVector *values, const psVector *errors, 325 const psVector *mask, ps MaskType maskVal, const psArray *coordsArray,325 const psVector *mask, psVectorMaskType maskVal, const psArray *coordsArray, 326 326 int numIter, float rej) 327 327 { … … 340 340 if (mask) { 341 341 PS_ASSERT_VECTOR_NON_NULL(mask, false); 342 PS_ASSERT_VECTOR_TYPE(mask, PS_TYPE_ MASK, false);342 PS_ASSERT_VECTOR_TYPE(mask, PS_TYPE_VECTOR_MASK, false); 343 343 PS_ASSERT_VECTORS_SIZE_EQUAL(values, mask, false); 344 344 } … … 355 355 356 356 // copy the input mask to a local temporary mask 357 poly->ownMask = psVectorRecycle(poly->ownMask, numValues, PS_TYPE_ U8); // Our own mask for input values357 poly->ownMask = psVectorRecycle(poly->ownMask, numValues, PS_TYPE_VECTOR_MASK); // Our own mask for input values 358 358 psVectorInit(poly->ownMask, 0); 359 359 for (int i = 0; mask && (i < numValues); i++) { 360 if (mask->data.PS_TYPE_ MASK_DATA[i] & maskVal) {361 poly->ownMask->data. U8[i] = 0xff;360 if (mask->data.PS_TYPE_VECTOR_MASK_DATA[i] & maskVal) { 361 poly->ownMask->data.PS_TYPE_VECTOR_MASK_DATA[i] = 0xff; 362 362 numGood--; 363 363 } … … 392 392 i, values->data.F32[i], values->data.F32[i] - poly->deviations->data.F32[i], poly->deviations->data.F32[i], limit); 393 393 394 if (poly->ownMask->data. U8[i]) continue;394 if (poly->ownMask->data.PS_TYPE_VECTOR_MASK_DATA[i]) continue; 395 395 396 396 if (fabs(poly->deviations->data.F32[i]) > limit) { … … 398 398 i, values->data.F32[i], values->data.F32[i] + poly->deviations->data.F32[i], 399 399 poly->deviations->data.F32[i], limit); 400 poly->ownMask->data. U8[i] = 0xff;400 poly->ownMask->data.PS_TYPE_VECTOR_MASK_DATA[i] = 0xff; 401 401 numClipped++; 402 402 numGood--; … … 435 435 psVectorInit(vector, 0.0); 436 436 for (int i = 0; i < numValues; i++) { 437 if (mask->data. U8[i]) {437 if (mask->data.PS_TYPE_VECTOR_MASK_DATA[i]) { 438 438 continue; 439 439 } … … 462 462 463 463 bool psPolynomialMDClipFit(psPolynomialMD *poly, const psVector *values, const psVector *errors, 464 const psVector *mask, ps MaskType maskVal, const psArray *coordsArray,464 const psVector *mask, psVectorMaskType maskVal, const psArray *coordsArray, 465 465 int numIter, float rej) 466 466 { … … 478 478 if (mask) { 479 479 PS_ASSERT_VECTOR_NON_NULL(mask, false); 480 PS_ASSERT_VECTOR_TYPE(mask, PS_TYPE_ MASK, false);480 PS_ASSERT_VECTOR_TYPE(mask, PS_TYPE_VECTOR_MASK, false); 481 481 PS_ASSERT_VECTORS_SIZE_EQUAL(values, mask, false); 482 482 } … … 500 500 PS_ASSERT_VECTOR_TYPE(coords, PS_TYPE_F32, false); 501 501 502 if (mask && (mask->data.PS_TYPE_ MASK_DATA[i] & maskVal)) {502 if (mask && (mask->data.PS_TYPE_VECTOR_MASK_DATA[i] & maskVal)) { 503 503 continue; 504 504 } … … 516 516 psImage *matrix = psImageAlloc(numTerms, numTerms, PS_TYPE_F64); // Least-squares matrix 517 517 psVector *vector = psVectorAlloc(numTerms, PS_TYPE_F64); // Least-squares vector 518 psVector *ownMask = psVectorAlloc(numValues, PS_TYPE_ U8); // Our own mask for input values518 psVector *ownMask = psVectorAlloc(numValues, PS_TYPE_VECTOR_MASK); // Our own mask for input values 519 519 psVectorInit(ownMask, 0); 520 520 if (mask) { 521 521 for (int i = 0; i < numValues; i++) { 522 if (mask->data.PS_TYPE_ MASK_DATA[i] & maskVal) {523 ownMask->data. U8[i] = 0xff;522 if (mask->data.PS_TYPE_VECTOR_MASK_DATA[i] & maskVal) { 523 ownMask->data.PS_TYPE_VECTOR_MASK_DATA[i] = 0xff; 524 524 numGood--; 525 525 } … … 551 551 float limit = rej * poly->stdevFit; // Rejection limit 552 552 for (int i = 0; i < numValues; i++) { 553 if (ownMask->data. U8[i]) {553 if (ownMask->data.PS_TYPE_VECTOR_MASK_DATA[i]) { 554 554 continue; 555 555 } … … 558 558 i, values->data.F32[i], psPolynomialMDEval(poly, coordsArray->data[i]), 559 559 deviations->data.F32[i], limit); 560 ownMask->data. U8[i] = 0xff;560 ownMask->data.PS_TYPE_VECTOR_MASK_DATA[i] = 0xff; 561 561 numClipped++; 562 562 numGood--;
Note:
See TracChangeset
for help on using the changeset viewer.
