Changeset 12340
- Timestamp:
- Mar 8, 2007, 1:24:48 PM (19 years ago)
- File:
-
- 1 edited
-
branches/rel-1_0/psLib/src/math/psStats.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/rel-1_0/psLib/src/math/psStats.c
r11155 r12340 13 13 * use ->min and ->max (PS_STAT_USE_RANGE) 14 14 * 15 * @version $Revision: 1.199 $ $Name: not supported by cvs2svn $16 * @date $Date: 2007-0 1-19 04:32:27$15 * @version $Revision: 1.199.2.1 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2007-03-08 23:24:48 $ 17 17 * 18 18 * Copyright 2006 IfA, University of Hawaii … … 2158 2158 2159 2159 // 2160 // Ensure that the yvalues are monotonic.2160 // Ensure that the x values are monotonic. 2161 2161 // 2162 if (((y->data.F64[0] < y->data.F64[1]) && !(y->data.F64[1] <= y->data.F64[2])) || 2163 ((y->data.F64[0] > y->data.F64[1]) && !(y->data.F64[1] >= y->data.F64[2]))) { 2162 if (!(x->data.F64[0] < x->data.F64[1] && x->data.F64[1] < x->data.F64[2])) { 2164 2163 psError(PS_ERR_UNKNOWN, true, 2165 "This routine must be called with monotonically increasing or decreasing data points.\n");2164 "This routine must be called with monotonically increasing ordinates.\n"); 2166 2165 psFree(x); 2167 2166 psFree(y); … … 2172 2171 // Determine the coefficients of the polynomial. 2173 2172 psPolynomial1D *myPoly = psPolynomial1DAlloc(PS_POLYNOMIAL_ORD, 2); 2174 if (!psVectorFitPolynomial1D(myPoly, NULL, 0, y, NULL, x)) { 2173 if (!psVectorFitPolynomial1D(myPoly, NULL, 0, y, NULL, x)) { // fit y(x) 2175 2174 psError(PS_ERR_UNEXPECTED_NULL, false, 2176 2175 _("Failed to fit a 1-dimensional polynomial to the three specified data points. Returning NAN.")); … … 2183 2182 psTrace("psLib.math", 6, "myPoly->coeff[1] is %f\n", myPoly->coeff[1]); 2184 2183 psTrace("psLib.math", 6, "myPoly->coeff[2] is %f\n", myPoly->coeff[2]); 2185 psTrace("psLib.math", 6, "Fitted yvec is (%f %f %f)\n",2186 (psF32) psPolynomial1DEval(myPoly, (psF64) x->data.F64[0]),2187 (psF32) psPolynomial1DEval(myPoly, (psF64) x->data.F64[1]),2188 (psF32) psPolynomial1DEval(myPoly, (psF64) x->data.F64[2]));2184 psTrace("psLib.math", 6, "Fitted x vec is (%f %f %f)\n", 2185 (psF32) psPolynomial1DEval(myPoly, (psF64) y->data.F64[0]), 2186 (psF32) psPolynomial1DEval(myPoly, (psF64) y->data.F64[1]), 2187 (psF32) psPolynomial1DEval(myPoly, (psF64) y->data.F64[2])); 2189 2188 2190 2189 psTrace("psLib.math", 6, "We fit the polynomial, now find x such that f(x) equals %f\n", yVal);
Note:
See TracChangeset
for help on using the changeset viewer.
