Changeset 10848 for trunk/psLib/src/math/psPolynomialUtils.c
- Timestamp:
- Dec 28, 2006, 6:38:42 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/math/psPolynomialUtils.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/math/psPolynomialUtils.c
r10607 r10848 13 13 #include "psPolynomialUtils.h" 14 14 15 psPolynomial4D *psVectorChiClipFitPolynomial4D(15 bool psVectorChiClipFitPolynomial4D( 16 16 psPolynomial4D *poly, 17 17 psStats *stats, … … 75 75 int Nkeep = 0; 76 76 77 poly = psVectorFitPolynomial4D (poly, mask, maskValue, f, fErr, x, y, z, t); 77 if (!psVectorFitPolynomial4D (poly, mask, maskValue, f, fErr, x, y, z, t)) { 78 psError(PS_ERR_UNKNOWN, true, "Could not fit a polynomial to the data. Returning NULL.\n"); 79 psFree (resid); 80 return false; 81 } 82 78 83 fit = psPolynomial4DEvalVector (poly, x, y, z, t); 84 if (fit == NULL) { 85 psError(PS_ERR_UNKNOWN, false, "Could not call psPolynomial4DEvalVector(). Returning NULL.\n"); 86 psFree(resid) 87 return false; 88 } 89 79 90 resid = (psVector *) psBinaryOp (resid, (void *) f, "-", (void *) fit); 80 91 81 92 if (!psVectorStats (stats, resid, NULL, mask, maskValue)) { 82 93 psError(PS_ERR_UNKNOWN, false, "failed to measure vector stats"); 83 return NULL; 94 psFree (fit); 95 psFree (resid); 96 return false; 84 97 } 85 98 psTrace (__func__, 5, "resid stats: %f +/- %f\n", stats->sampleMedian, stats->sampleStdev); … … 108 121 } 109 122 110 psTrace (__func__, 4, "keeping %d of %ld pts for fit\n", 111 Nkeep, x->n); 112 123 psTrace (__func__, 4, "keeping %d of %ld pts for fit\n", Nkeep, x->n); 113 124 stats->clippedNvalues = Nkeep; 114 125 psFree (fit); … … 117 128 psFree (resid); 118 129 119 if (poly == NULL) { 120 psError(PS_ERR_UNKNOWN, true, "Could not fit a polynomial to the data. Returning NULL.\n"); 121 return(NULL); 122 } 123 return(poly); 130 return true; 124 131 } 125 132
Note:
See TracChangeset
for help on using the changeset viewer.
