Changeset 5655
- Timestamp:
- Dec 1, 2005, 1:36:23 PM (21 years ago)
- Location:
- trunk/psLib/src/math
- Files:
-
- 2 edited
-
psMinimize.c (modified) (2 diffs)
-
psStats.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/math/psMinimize.c
r5624 r5655 10 10 * @author EAM, IfA 11 11 * 12 * @version $Revision: 1.14 6$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-1 1-30 02:00:09$12 * @version $Revision: 1.147 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-12-01 23:36:23 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 1756 1756 } 1757 1757 1758 // does the solution in place 1759 psGaussJordan (A, B); 1760 1761 // the first nTerm entries in B correspond directly to the desired 1762 // polynomial coefficients. this is only true for the 1D case 1763 for (int k = 0; k < nTerm; k++) { 1764 myPoly->coeff[k] = B->data.F64[k]; 1765 } 1758 // GaussJordan version 1759 if (0) { 1760 // does the solution in place 1761 psGaussJordan (A, B); 1762 1763 // the first nTerm entries in B correspond directly to the desired 1764 // polynomial coefficients. this is only true for the 1D case 1765 for (int k = 0; k < nTerm; k++) { 1766 myPoly->coeff[k] = B->data.F64[k]; 1767 } 1768 } else { 1769 // LUD version of the fit 1770 psImage *ALUD = NULL; 1771 psVector* outPerm = NULL; 1772 psVector* coeffs = NULL; 1773 1774 ALUD = psImageAlloc(nTerm, nTerm, PS_TYPE_F64); 1775 ALUD = psMatrixLUD(ALUD, &outPerm, A); 1776 coeffs = psMatrixLUSolve(coeffs, ALUD, B, outPerm); 1777 for (int k = 0; k < nTerm; k++) { 1778 myPoly->coeff[k] = coeffs->data.F64[k]; 1779 } 1780 psFree(ALUD); 1781 psFree(coeffs); 1782 psFree(outPerm); 1783 } 1784 1766 1785 1767 1786 psFree(A); -
trunk/psLib/src/math/psStats.c
r5624 r5655 17 17 * 18 18 * 19 * @version $Revision: 1.15 5$ $Name: not supported by cvs2svn $20 * @date $Date: 2005-1 1-30 02:00:09$19 * @version $Revision: 1.156 $ $Name: not supported by cvs2svn $ 20 * @date $Date: 2005-12-01 23:35:33 $ 21 21 * 22 22 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 1379 1379 { 1380 1380 psTrace(__func__, 4, "---- %s() begin ----\n", __func__); 1381 psTrace(__func__, 4, "range (%f, %f) get (%f)\n", rangeLow, rangeHigh, getThisValue); 1381 1382 PS_ASSERT_POLY_NON_NULL(myPoly, NAN); 1382 1383 PS_ASSERT_FLOAT_LARGER_THAN(rangeHigh, rangeLow, NAN); … … 1386 1387 psF32 fLo = psPolynomial1DEval(myPoly, rangeLow); 1387 1388 psF32 fHi = psPolynomial1DEval(myPoly, rangeHigh); 1389 psTrace(__func__, 4, "function at endpoints are (%f, %f) get (%f)\n", fLo, fHi, getThisValue); 1388 1390 if (!((fLo <= getThisValue) && (fHi >= getThisValue))) { 1389 1391 psError(PS_ERR_UNKNOWN, true, "The requested y value (%f) does not fall within the specified range (%f to %f)\n", getThisValue, fLo, fHi); … … 1473 1475 y->data.F64[1] = yVec->data.F32[binNum]; 1474 1476 y->data.F64[2] = yVec->data.F32[binNum + 1]; 1475 psTrace(__func__, 6, "x vec (orig) is (%f %f %f %f)\n", xVec->data.F32[binNum - 1], xVec->data.F32[binNum], xVec->data.F32[binNum+1], xVec->data.F32[binNum+2]); 1477 psTrace(__func__, 6, "x vec (orig) is (%f %f %f %f)\n", xVec->data.F32[binNum - 1], 1478 xVec->data.F32[binNum], 1479 xVec->data.F32[binNum+1], 1480 xVec->data.F32[binNum+2]); 1476 1481 psTrace(__func__, 6, "x vec is (%f %f %f)\n", x->data.F64[0], x->data.F64[1], x->data.F64[2]); 1477 1482 psTrace(__func__, 6, "y vec is (%f %f %f)\n", y->data.F64[0], y->data.F64[1], y->data.F64[2]); … … 1538 1543 psTrace(__func__, 6, "myPoly->coeff[1] is %f\n", myPoly->coeff[1]); 1539 1544 psTrace(__func__, 6, "myPoly->coeff[2] is %f\n", myPoly->coeff[2]); 1540 psTrace(__func__, 6, "Fitted y vec is (% .2f %.2f %.2f)\n", (psF32) psPolynomial1DEval(myPoly, (psF64) x->data.F64[0]),1545 psTrace(__func__, 6, "Fitted y vec is (%f %f %f)\n", (psF32) psPolynomial1DEval(myPoly, (psF64) x->data.F64[0]), 1541 1546 (psF32) psPolynomial1DEval(myPoly, (psF64) x->data.F64[1]), 1542 1547 (psF32) psPolynomial1DEval(myPoly, (psF64) x->data.F64[2]));
Note:
See TracChangeset
for help on using the changeset viewer.
