Changeset 8245
- Timestamp:
- Aug 8, 2006, 4:26:44 PM (20 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 16 edited
-
astro/psCoord.c (modified) (13 diffs)
-
fits/psFitsTable.c (modified) (6 diffs)
-
math/psMathUtils.c (modified) (9 diffs)
-
math/psMatrix.c (modified) (2 diffs)
-
math/psMinimizeLMM.c (modified) (14 diffs)
-
math/psMinimizePolyFit.c (modified) (42 diffs)
-
math/psMinimizePowell.c (modified) (32 diffs)
-
math/psPolynomial.c (modified) (5 diffs)
-
math/psSpline.c (modified) (13 diffs)
-
math/psStats.c (modified) (78 diffs)
-
sys/psLogMsg.c (modified) (3 diffs)
-
sys/psTrace.c (modified) (3 diffs)
-
types/psArguments.c (modified) (2 diffs)
-
types/psHash.c (modified) (3 diffs)
-
types/psMetadata.c (modified) (2 diffs)
-
types/psMetadataItemCompare.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astro/psCoord.c
r8232 r8245 10 10 * @author GLG, MHPCC 11 11 * 12 * @version $Revision: 1.12 2$ $Name: not supported by cvs2svn $13 * @date $Date: 2006-08-0 8 23:32:22$12 * @version $Revision: 1.123 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2006-08-09 02:26:44 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 589 589 psPolynomial2D *trans2) 590 590 { 591 psTrace( __func__, 4, "---- %s() begin ----\n", __func__);592 psTrace( __func__, 5, "multiplyDPoly2D(%d %d: %d %d)\n", trans1->nX, trans1->nY, trans2->nX, trans2->nY);591 psTrace("psLib.astro", 4, "---- %s() begin ----\n", __func__); 592 psTrace("psLib.astro", 5, "multiplyDPoly2D(%d %d: %d %d)\n", trans1->nX, trans1->nY, trans2->nX, trans2->nY); 593 593 psS32 orderX = trans1->nX + trans2->nX; 594 594 psS32 orderY = trans1->nY + trans2->nY; 595 psTrace( __func__, 5, "out poly (nX, nY) is (%d, %d)\n", orderX, orderY);595 psTrace("psLib.astro", 5, "out poly (nX, nY) is (%d, %d)\n", orderX, orderY); 596 596 597 597 psPolynomial2D *out = psPolynomial2DAlloc(PS_POLYNOMIAL_ORD, orderX, orderY); 598 psTrace( __func__, 5, "Creating poly (%d, %d)\n", orderX, orderY);598 psTrace("psLib.astro", 5, "Creating poly (%d, %d)\n", orderX, orderY); 599 599 600 600 for (psS32 t1x = 0 ; t1x < (1 + trans1->nX) ; t1x++) { … … 609 609 } 610 610 } 611 psTrace( __func__, 4, "---- %s() end ----\n", __func__);611 psTrace("psLib.astro", 4, "---- %s() end ----\n", __func__); 612 612 return(out); 613 613 } … … 623 623 int nSamples) 624 624 { 625 psTrace( __func__, 3, "---- %s() begin ----\n", __func__);626 psTrace( __func__, 3, "tracelevel(%s) is %d\n", __func__, psTraceGetLevel(__func__));625 psTrace("psLib.astro", 3, "---- %s() begin ----\n", __func__); 626 psTrace("psLib.astro", 3, "tracelevel(%s) is %d\n", __func__, psTraceGetLevel(__func__)); 627 627 628 628 PS_ASSERT_PTR_NON_NULL(trans1, NULL); 629 629 PS_ASSERT_PTR_NON_NULL(trans2, NULL); 630 psTrace( __func__, 5, "trans1->x is (%d, %d) order.\n", trans1->x->nX, trans1->x->nY);631 psTrace( __func__, 5, "trans1->y is (%d, %d) order.\n", trans1->y->nX, trans1->y->nY);632 psTrace( __func__, 5, "trans2->x is (%d, %d) order.\n", trans2->x->nX, trans2->x->nY);633 psTrace( __func__, 5, "trans2->y is (%d, %d) order.\n", trans2->y->nX, trans2->y->nY);630 psTrace("psLib.astro", 5, "trans1->x is (%d, %d) order.\n", trans1->x->nX, trans1->x->nY); 631 psTrace("psLib.astro", 5, "trans1->y is (%d, %d) order.\n", trans1->y->nX, trans1->y->nY); 632 psTrace("psLib.astro", 5, "trans2->x is (%d, %d) order.\n", trans2->x->nX, trans2->x->nY); 633 psTrace("psLib.astro", 5, "trans2->y is (%d, %d) order.\n", trans2->y->nX, trans2->y->nY); 634 634 if (psTraceGetLevel(__func__) >= 6) { 635 635 PS_POLY_PRINT_2D(trans1->x); … … 648 648 psS32 orderX = PS_MAX(orderXnX, orderYnX); 649 649 psS32 orderY = PS_MAX(orderXnY, orderYnY); 650 psTrace( __func__, 5, "The new (orderX, orderY) is (%d, %d)\n", orderX, orderY);650 psTrace("psLib.astro", 5, "The new (orderX, orderY) is (%d, %d)\n", orderX, orderY); 651 651 652 652 // … … 679 679 } 680 680 } 681 psTrace( __func__, 5, "New polynomial ranks are (%d %d %d %d)\n", myPT->x->nX, myPT->x->nY, myPT->y->nX, myPT->y->nY);681 psTrace("psLib.astro", 5, "New polynomial ranks are (%d %d %d %d)\n", myPT->x->nX, myPT->x->nY, myPT->y->nX, myPT->y->nY); 682 682 683 683 // … … 707 707 } 708 708 709 psTrace( __func__, 5, "Determine the new x-polynomial\n");709 psTrace("psLib.astro", 5, "Determine the new x-polynomial\n"); 710 710 for (psS32 t2x = 0 ; t2x < (trans2->x->nX + 1) ; t2x++) { 711 711 for (psS32 t2y = 0 ; t2y < (trans2->x->nY + 1) ; t2y++) { 712 psTrace( __func__, 6, "X: -------------------- (t2x, t2y) (%d, %d) --------------------\n", t2x, t2y);712 psTrace("psLib.astro", 6, "X: -------------------- (t2x, t2y) (%d, %d) --------------------\n", t2x, t2y); 713 713 if (trans2->x->mask[t2x][t2y] == 0) { 714 psTrace( __func__, 6, "In this iteration, we raise trans1->x to the %d power and trans1->y to the %d-power.\n", t2x, t2y);714 psTrace("psLib.astro", 6, "In this iteration, we raise trans1->x to the %d power and trans1->y to the %d-power.\n", t2x, t2y); 715 715 psPolynomial2D *newPoly = multiplyDPoly2D(trans1XPolys[t2x], trans1YPolys[t2y]); 716 716 … … 734 734 } 735 735 if (psTraceGetLevel(__func__) >= 6) { 736 psTrace( __func__, 6, "The final x-polynomial\n");736 psTrace("psLib.astro", 6, "The final x-polynomial\n"); 737 737 PS_POLY_PRINT_2D(myPT->x); 738 738 } … … 741 741 // Determine the new y-polynomial 742 742 // 743 psTrace( __func__, 5, "Determine the new y-polynomial\n");743 psTrace("psLib.astro", 5, "Determine the new y-polynomial\n"); 744 744 for (psS32 t2x = 0 ; t2x < (trans2->y->nX + 1) ; t2x++) { 745 745 for (psS32 t2y = 0 ; t2y < (trans2->y->nY + 1) ; t2y++) { 746 psTrace( __func__, 5, "Y: -------------------- (t2x, t2y) (%d, %d) --------------------\n", t2x, t2y);746 psTrace("psLib.astro", 5, "Y: -------------------- (t2x, t2y) (%d, %d) --------------------\n", t2x, t2y); 747 747 if (trans2->y->mask[t2x][t2y] == 0) { 748 psTrace( __func__, 5, "In this iteration, we raise trans1->x to the %d power and trans1->y to the %d-power.\n", t2x, t2y);748 psTrace("psLib.astro", 5, "In this iteration, we raise trans1->x to the %d power and trans1->y to the %d-power.\n", t2x, t2y); 749 749 psPolynomial2D *newPoly = multiplyDPoly2D(trans1XPolys[t2x], trans1YPolys[t2y]); 750 750 … … 767 767 } 768 768 if (psTraceGetLevel(__func__) >= 6) { 769 psTrace( __func__, 6, "The final y-polynomial\n");769 psTrace("psLib.astro", 6, "The final y-polynomial\n"); 770 770 PS_POLY_PRINT_2D(myPT->y); 771 771 } … … 778 778 psFree(trans1YPolys); 779 779 780 psTrace( __func__, 3, "---- %s() end ----\n", __func__);780 psTrace("psLib.astro", 3, "---- %s() end ----\n", __func__); 781 781 return(myPT); 782 782 } … … 969 969 970 970 out->x+= xPoly->coeff[loop_x][loop_y] * xSum * ySum * ((psF32) loop_x); 971 psTrace( __func__, 6, "out->x+= (%.2f * %.2f * %.2f * %.2f)\n", xPoly->coeff[loop_x][loop_y], xSum, ySum, ((psF32) loop_x));971 psTrace("psLib.astro", 6, "out->x+= (%.2f * %.2f * %.2f * %.2f)\n", xPoly->coeff[loop_x][loop_y], xSum, ySum, ((psF32) loop_x)); 972 972 ySum*= coord->y; 973 973 } … … 991 991 992 992 out->y+= yPoly->coeff[loop_x][loop_y] * xSum * ySum * ((psF32) loop_y); 993 psTrace( __func__, 6, "out->y+= (%.2f * %.2f * %.2f * %.2f)\n", yPoly->coeff[loop_x][loop_y], xSum, ySum, ((psF32) loop_y));993 psTrace("psLib.astro", 6, "out->y+= (%.2f * %.2f * %.2f * %.2f)\n", yPoly->coeff[loop_x][loop_y], xSum, ySum, ((psF32) loop_y)); 994 994 ySum*= coord->y; 995 995 } -
trunk/psLib/src/fits/psFitsTable.c
r8232 r8245 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1. 19$ $Name: not supported by cvs2svn $10 * @date $Date: 2006-08-0 8 23:32:23$9 * @version $Revision: 1.20 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2006-08-09 02:26:44 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 74 74 } 75 75 76 psTrace(" .psFits.psFitsReadTableRow",5,"Table size is %ix%i\n",numCols, numRows);76 psTrace("psLib.fits",5,"Table size is %ix%i\n",numCols, numRows); 77 77 // the row parameter in the proper range? 78 78 if (row < 0 || row >= numRows) { … … 110 110 fits_read_col(fits->fd, FITSTYPE, col,row+1, \ 111 111 1, 1, NULL, &value, &anynul, &status); \ 112 psTrace(" .psFits.psFitsReadTableRow",5,"Column #%i, '%s', is type %i, repeat %i, Value = %g\n", \112 psTrace("psLib.fits",5,"Column #%i, '%s', is type %i, repeat %i, Value = %g\n", \ 113 113 col, name, typecode, repeat, (double)value); \ 114 114 psMetadataAdd(data,PS_LIST_TAIL, name, \ … … 144 144 fits_read_col(fits->fd, TSTRING, col,row+1, 145 145 1, 1, NULL, &value, &anynul, &status); 146 psTrace(" .psFits.psFitsReadTableRow",5,"Column #%i, '%s', is type %i, repeat %i, value = %s\n",146 psTrace("psLib.fits",5,"Column #%i, '%s', is type %i, repeat %i, value = %s\n", 147 147 col, name, typecode, repeat, value); 148 148 if (anynul == 0) { … … 158 158 typecode, col); 159 159 160 psTrace("ps Fits.psFitsReadTableRow", 2,160 psTrace("psLib.fits", 2, 161 161 "Column %d or row %d was of a non primitive type, %d", 162 162 col, row, typecode); … … 387 387 388 388 for (int row = 0; row < numRows; row++) { 389 psTrace(" .psFits.psFitsReadTable",5,"Reading row %i of %i\n",row, numRows);389 psTrace("psLib.fits",5,"Reading row %i of %i\n",row, numRows); 390 390 table->data[row] = psFitsReadTableRow(fits,row); 391 391 table->n++; -
trunk/psLib/src/math/psMathUtils.c
r8232 r8245 3 3 * This file contains standard math routines. 4 4 * 5 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $6 * @date $Date: 2006-08-0 8 23:32:23$5 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2006-08-09 02:26:44 $ 7 7 * 8 8 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 58 58 long max; \ 59 59 long mid; \ 60 psTrace( __func__, 4, "---- %s() begin ----\n", __func__); \61 /* psTrace( __func__, 6, "Determining the bin for: %f\n", x); */\60 psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__); \ 61 /* psTrace("psLib.math", 6, "Determining the bin for: %f\n", x); */\ 62 62 if (value < bounds[0]) { \ 63 63 psLogMsg(__func__, PS_LOG_WARN, \ … … 79 79 \ 80 80 if (value == bounds[mid]) { \ 81 psTrace( __func__, 4, "---- %s(%d) end (1) ----\n", __func__, mid); \81 psTrace("psLib.math", 4, "---- %s(%d) end (1) ----\n", __func__, mid); \ 82 82 return(mid); \ 83 83 } else if (value < bounds[mid]) { \ … … 88 88 mid = ((max+1)+min)/2; \ 89 89 } \ 90 psTrace( __func__, 4, "---- %s(%d) end (2) ----\n", __func__, min); \90 psTrace("psLib.math", 4, "---- %s(%d) end (2) ----\n", __func__, min); \ 91 91 return(min); \ 92 92 } … … 135 135 #define VECTOR_INTERPOLATE_CASE(TYPE) \ 136 136 case PS_TYPE_##TYPE: { \ 137 psTrace( __func__, 4, "---- %s() begin %u-order.) (%d data points) ----\n", __func__, order, order+1); \137 psTrace("psLib.math", 4, "---- %s() begin %u-order.) (%d data points) ----\n", __func__, order, order+1); \ 138 138 if (x->data.TYPE < domain->data.TYPE[0]) { \ 139 139 psLogMsg(__func__, PS_LOG_WARN, "WARNING: x is outside the domain of input data.\n"); \ … … 173 173 out->data.TYPE = p->data.TYPE[origin]; \ 174 174 psFree(p); \ 175 psTrace( __func__, 4, "---- %s(....) end ----\n", __func__); \175 psTrace("psLib.math", 4, "---- %s(....) end ----\n", __func__); \ 176 176 return(out); \ 177 177 } … … 192 192 const psScalar *x) 193 193 { 194 psTrace( __func__, 4, "---- %s() begin ----\n", __func__);194 psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__); 195 195 PS_ASSERT_VECTOR_NON_NULL(domain, NULL); 196 196 PS_ASSERT_VECTOR_NON_NULL(range, NULL); … … 275 275 { 276 276 PS_ASSERT_VECTOR_NON_NULL(myData, false); 277 psTrace( __func__, 4, "---- %s() begin ----\n", __func__);277 psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__); 278 278 279 279 switch (myData->type.type) { … … 295 295 } 296 296 } 297 psTrace( __func__, 4, "---- %s() end ----\n", __func__);297 psTrace("psLib.math", 4, "---- %s() end ----\n", __func__); 298 298 return true; 299 299 } -
trunk/psLib/src/math/psMatrix.c
r8232 r8245 21 21 * @author Robert DeSonia, MHPCC 22 22 * 23 * @version $Revision: 1.4 1$ $Name: not supported by cvs2svn $24 * @date $Date: 2006-08-0 8 23:32:23$23 * @version $Revision: 1.42 $ $Name: not supported by cvs2svn $ 24 * @date $Date: 2006-08-09 02:26:44 $ 25 25 * 26 26 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 343 343 if (ipiv[k] > 1) { 344 344 // psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Singular Matrix (1).\n"); 345 psTrace( __func__, 4, "Singular Matrix (1).\n");345 psTrace("psLib.math", 4, "Singular Matrix (1).\n"); 346 346 goto fescape; 347 347 } -
trunk/psLib/src/math/psMinimizeLMM.c
r7914 r8245 10 10 * @author EAM, IfA 11 11 * 12 * @version $Revision: 1.1 8$ $Name: not supported by cvs2svn $13 * @date $Date: 2006-0 7-15 02:57:12$12 * @version $Revision: 1.19 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2006-08-09 02:26:44 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 71 71 72 72 // LU decomposition version 73 psTrace( __func__, 5, "using LUD version\n");73 psTrace("psLib.math", 5, "using LUD version\n"); 74 74 75 75 // set new guess values (creates matrix A) … … 103 103 # else 104 104 // gauss-jordan version 105 psTrace( __func__, 5, "using Gauss-J version");105 psTrace("psLib.math", 5, "using Gauss-J version"); 106 106 107 107 // set new guess values (creates matrix A) … … 158 158 psMinimizeLMChi2Func func) 159 159 { 160 psTrace( __func__, 3, "---- %s() begin ----\n", __func__);160 psTrace("psLib.math", 3, "---- %s() begin ----\n", __func__); 161 161 // allocate internal arrays (current vs Guess) 162 162 psImage *alpha = psImageAlloc (params->n, params->n, PS_TYPE_F64); … … 184 184 rc = false; 185 185 } 186 psTrace( __func__, 5, "p_psMinLM_SetABX() was succesful\n", __func__);186 psTrace("psLib.math", 5, "p_psMinLM_SetABX() was succesful\n", __func__); 187 187 188 188 psBool rcBool = p_psMinLM_GuessABP(Alpha, delta, Params, alpha, beta, params, paramMask, NULL, NULL, NULL, 0.0); … … 191 191 rc = false; 192 192 } 193 psTrace( __func__, 5, "p_psMinLM_GuessABP() was succesful\n", __func__);193 psTrace("psLib.math", 5, "p_psMinLM_GuessABP() was succesful\n", __func__); 194 194 195 195 psFree(alpha); … … 200 200 psFree(dy); 201 201 } 202 psTrace( __func__, 3, "---- %s() end ----\n", __func__);202 psTrace("psLib.math", 3, "---- %s() end ----\n", __func__); 203 203 return(rc); 204 204 } … … 335 335 psMinimizeLMChi2Func func) 336 336 { 337 psTrace( __func__, 3, "---- %s() begin ----\n", __func__);337 psTrace("psLib.math", 3, "---- %s() begin ----\n", __func__); 338 338 PS_ASSERT_PTR_NON_NULL(min, false); 339 339 // XXX: If covar not NULL, do asserts... … … 415 415 } 416 416 if (psTraceGetLevel (__func__) >= 6) { 417 psTrace( __func__, 6, "The current Param vector: \n");417 psTrace("psLib.math", 6, "The current Param vector: \n"); 418 418 for (psS32 i = 0 ; i < Params->n ; i++) { 419 psTrace( __func__, 6, "Params[%d] is %f\n", Params->data.F32[i]);419 psTrace("psLib.math", 6, "Params[%d] is %f\n", Params->data.F32[i]); 420 420 } 421 421 } … … 423 423 // iterate until the tolerance is reached, or give up 424 424 while ((min->iter < min->maxIter) && ((min->lastDelta > min->tol) || !isfinite(min->lastDelta))) { 425 psTrace( __func__, 5, "Iteration number %d. (max iterations is %d).\n", min->iter, min->maxIter);426 psTrace( __func__, 5, "Last delta is %f. Min->tol is %f.\n", min->lastDelta, min->tol);425 psTrace("psLib.math", 5, "Iteration number %d. (max iterations is %d).\n", min->iter, min->maxIter); 426 psTrace("psLib.math", 5, "Last delta is %f. Min->tol is %f.\n", min->lastDelta, min->tol); 427 427 428 428 // set a new guess for Alpha, Beta, Params … … 445 445 if (psTraceGetLevel(__func__) >= 6) { 446 446 if (psTraceGetLevel (__func__) >= 6) { 447 psTrace( __func__, 6, "The current Param vector: \n");447 psTrace("psLib.math", 6, "The current Param vector: \n"); 448 448 for (psS32 i = 0 ; i < Params->n ; i++) { 449 psTrace( __func__, 6, "Params[%d] is %f\n", Params->data.F32[i]);449 psTrace("psLib.math", 6, "Params[%d] is %f\n", Params->data.F32[i]); 450 450 } 451 451 } … … 466 466 psF64 rho = (min->value - Chisq) / dLinear; 467 467 468 psTrace( __func__, 5, "last chisq: %f, new chisq %f, delta: %f, rho: %f\n", min->value,468 psTrace("psLib.math", 5, "last chisq: %f, new chisq %f, delta: %f, rho: %f\n", min->value, 469 469 Chisq, min->lastDelta, rho); 470 470 … … 489 489 min->iter++; 490 490 } 491 psTrace( __func__, 5, "chisq: %f, last delta: %f, Niter: %d\n", min->value, min->lastDelta, min->iter);491 psTrace("psLib.math", 5, "chisq: %f, last delta: %f, Niter: %d\n", min->value, min->lastDelta, min->iter); 492 492 493 493 // construct & return the covariance matrix (if requested) … … 509 509 } 510 510 if (min->iter == min->maxIter) { 511 psTrace( __func__, 3, "---- %s(false) end ----\n", __func__);511 psTrace("psLib.math", 3, "---- %s(false) end ----\n", __func__); 512 512 return(false); 513 513 } 514 psTrace( __func__, 3, "---- %s(true) end ----\n", __func__);514 psTrace("psLib.math", 3, "---- %s(true) end ----\n", __func__); 515 515 return(true); 516 516 } -
trunk/psLib/src/math/psMinimizePolyFit.c
r7766 r8245 10 10 * @author EAM, IfA 11 11 * 12 * @version $Revision: 1.1 6$ $Name: not supported by cvs2svn $13 * @date $Date: 2006-0 6-30 02:20:06$12 * @version $Revision: 1.17 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2006-08-09 02:26:44 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 470 470 const psVector *x) 471 471 { 472 psTrace( __func__, 4, "---- %s() begin ----\n", __func__);472 psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__); 473 473 PS_ASSERT_POLY_NON_NULL(myPoly, NULL); 474 474 PS_ASSERT_VECTOR_NON_NULL(f, NULL); … … 488 488 489 489 if (psTraceGetLevel(__func__) >= 6) { 490 psTrace( __func__, 6, "VectorFitPolynomial1D()\n");490 psTrace("psLib.math", 6, "VectorFitPolynomial1D()\n"); 491 491 for (psS32 i = 0; i < f->n; i++) { 492 psTrace( __func__, 6, "(x, f, fErr) is (");492 psTrace("psLib.math", 6, "(x, f, fErr) is ("); 493 493 if (x != NULL) { 494 psTrace( __func__, 6, "%f, %f, ", x->data.F64[i], f->data.F64[i]);494 psTrace("psLib.math", 6, "%f, %f, ", x->data.F64[i], f->data.F64[i]); 495 495 } else { 496 psTrace( __func__, 6, "%f, %f, ", (psF64) i, f->data.F64[i]);496 psTrace("psLib.math", 6, "%f, %f, ", (psF64) i, f->data.F64[i]); 497 497 } 498 498 if (fErr != NULL) { 499 psTrace( __func__, 6, "%f)\n", fErr->data.F64[i]);499 psTrace("psLib.math", 6, "%f)\n", fErr->data.F64[i]); 500 500 } else { 501 psTrace( __func__, 6, "NULL)\n");501 psTrace("psLib.math", 6, "NULL)\n"); 502 502 } 503 503 } … … 516 516 psFree(A); 517 517 psFree(B); 518 psTrace( __func__, 4, "---- %s() End ----\n", __func__);518 psTrace("psLib.math", 4, "---- %s() End ----\n", __func__); 519 519 return(NULL); 520 520 } … … 645 645 psFree(B); 646 646 647 psTrace( __func__, 4, "---- %s() End ----\n", __func__);647 psTrace("psLib.math", 4, "---- %s() End ----\n", __func__); 648 648 return (myPoly); 649 649 } … … 754 754 const psVector *xIn) 755 755 { 756 psTrace( __func__, 3, "---- %s() begin ----\n", __func__);756 psTrace("psLib.math", 3, "---- %s() begin ----\n", __func__); 757 757 PS_ASSERT_POLY_NON_NULL(poly, NULL); 758 758 PS_ASSERT_PTR_NON_NULL(stats, NULL); … … 811 811 // for now, for the SAMPLE_MEDIAN and SAMPLE_STDEV to be used 812 812 stats->options |= (PS_STAT_SAMPLE_MEDIAN | PS_STAT_SAMPLE_STDEV); 813 psTrace( __func__, 4, "stats->clipIter is %d\n", stats->clipIter);814 psTrace( __func__, 4, "(minClipSigma, maxClipSigma) is (%.2f, %.2f)\n", minClipSigma, maxClipSigma);813 psTrace("psLib.math", 4, "stats->clipIter is %d\n", stats->clipIter); 814 psTrace("psLib.math", 4, "(minClipSigma, maxClipSigma) is (%.2f, %.2f)\n", minClipSigma, maxClipSigma); 815 815 816 816 // 817 817 for (psS32 N = 0; N < stats->clipIter; N++) { 818 psTrace( __func__, 6, "Loop iteration %d. Calling psVectorFitPolynomial1D()\n");818 psTrace("psLib.math", 6, "Loop iteration %d. Calling psVectorFitPolynomial1D()\n"); 819 819 psS32 Nkeep = 0; 820 820 if (psTraceGetLevel(__func__) >= 6) { 821 821 if (mask != NULL) { 822 822 for (psS32 i = 0 ; i < mask->n ; i++) { 823 psTrace( __func__, 6, "mask[%d] is %d\n", i, mask->data.U8[i]);823 psTrace("psLib.math", 6, "mask[%d] is %d\n", i, mask->data.U8[i]); 824 824 } 825 825 } … … 851 851 for (psS32 i = 0 ; i < mask->n ; i++) { 852 852 if (!((mask != NULL) && (mask->data.U8[i] & maskValue))) { 853 psTrace( __func__, 6, "(f, fit)[%d] is (%f, %f). resid is (%f)\n",853 psTrace("psLib.math", 6, "(f, fit)[%d] is (%f, %f). resid is (%f)\n", 854 854 i, f->data.F32[i], fit->data.F32[i], resid->data.F64[i]); 855 855 } … … 859 859 860 860 stats = psVectorStats(stats, resid, NULL, mask, maskValue); 861 psTrace( __func__, 6, "Median is %f\n", stats->sampleMedian);862 psTrace( __func__, 6, "Stdev is %f\n", stats->sampleStdev);861 psTrace("psLib.math", 6, "Median is %f\n", stats->sampleMedian); 862 psTrace("psLib.math", 6, "Stdev is %f\n", stats->sampleStdev); 863 863 psF32 minClipValue = -minClipSigma*stats->sampleStdev; 864 864 psF32 maxClipValue = +maxClipSigma*stats->sampleStdev; … … 875 875 (resid->data.F64[i] - stats->sampleMedian < minClipValue)) { 876 876 if (f->type.type == PS_TYPE_F64) { 877 psTrace( __func__, 6, "Masking element %d (%f). resid->data.F64[%d] is %f\n",877 psTrace("psLib.math", 6, "Masking element %d (%f). resid->data.F64[%d] is %f\n", 878 878 i, fit->data.F64[i], i, resid->data.F64[i]); 879 879 } else { 880 psTrace( __func__, 6, "Masking element %d (%f). resid->data.F64[%d] is %f\n",880 psTrace("psLib.math", 6, "Masking element %d (%f). resid->data.F64[%d] is %f\n", 881 881 i, fit->data.F32[i], i, resid->data.F64[i]); 882 882 } … … 894 894 // since the polynomial fit won't change. 895 895 // 896 psTrace( __func__, 6, "keeping %d of %d pts for fit\n", Nkeep, x->n);896 psTrace("psLib.math", 6, "keeping %d of %d pts for fit\n", Nkeep, x->n); 897 897 psFree(fit); 898 898 } … … 905 905 psFree(resid); 906 906 907 psTrace( __func__, 3, "---- %s() end ----\n", __func__);907 psTrace("psLib.math", 3, "---- %s() end ----\n", __func__); 908 908 return (poly); 909 909 } … … 931 931 const psVector *y) 932 932 { 933 psTrace( __func__, 4, "---- %s() begin ----\n", __func__);933 psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__); 934 934 PS_ASSERT_POLY_NON_NULL(myPoly, NULL); 935 935 PS_ASSERT_INT_NONNEGATIVE(myPoly->nX, NULL); … … 967 967 psFree(A); 968 968 psFree(B); 969 psTrace( __func__, 4, "---- %s() End ----\n", __func__);969 psTrace("psLib.math", 4, "---- %s() End ----\n", __func__); 970 970 return(NULL); 971 971 } … … 1045 1045 psFree(B); 1046 1046 1047 psTrace( __func__, 4, "---- %s() end ----\n", __func__);1047 psTrace("psLib.math", 4, "---- %s() end ----\n", __func__); 1048 1048 return (myPoly); 1049 1049 } … … 1201 1201 const psVector *y) 1202 1202 { 1203 psTrace( __func__, 3, "---- %s() begin ----\n", __func__);1203 psTrace("psLib.math", 3, "---- %s() begin ----\n", __func__); 1204 1204 PS_ASSERT_POLY_NON_NULL(poly, NULL); 1205 1205 PS_ASSERT_POLY_TYPE(poly, PS_POLYNOMIAL_ORD, NULL); … … 1246 1246 // for now, for the SAMPLE_MEDIAN and SAMPLE_STDEV to be used 1247 1247 stats->options |= (PS_STAT_SAMPLE_MEDIAN | PS_STAT_SAMPLE_STDEV); 1248 psTrace( __func__, 4, "stats->clipIter is %d\n", stats->clipIter);1249 psTrace( __func__, 4, "(minClipSigma, maxClipSigma) is (%.2f, %.2f)\n", minClipSigma, maxClipSigma);1248 psTrace("psLib.math", 4, "stats->clipIter is %d\n", stats->clipIter); 1249 psTrace("psLib.math", 4, "(minClipSigma, maxClipSigma) is (%.2f, %.2f)\n", minClipSigma, maxClipSigma); 1250 1250 1251 1251 for (psS32 N = 0; N < stats->clipIter; N++) { 1252 psTrace( __func__, 6, "Loop iteration %d. Calling psVectorFitPolynomial1D()\n");1252 psTrace("psLib.math", 6, "Loop iteration %d. Calling psVectorFitPolynomial1D()\n"); 1253 1253 psS32 Nkeep = 0; 1254 1254 if (psTraceGetLevel(__func__) >= 6) { 1255 1255 if (mask != NULL) { 1256 1256 for (psS32 i = 0 ; i < mask->n ; i++) { 1257 psTrace( __func__, 6, "mask[%d] is %d\n", i, mask->data.U8[i]);1257 psTrace("psLib.math", 6, "mask[%d] is %d\n", i, mask->data.U8[i]); 1258 1258 } 1259 1259 } … … 1286 1286 for (psS32 i = 0 ; i < mask->n ; i++) { 1287 1287 if (!((mask != NULL) && (mask->data.U8[i] & maskValue))) { 1288 psTrace( __func__, 6, "(f, fit)[%d] is (%f, %f). resid is (%f)\n",1288 psTrace("psLib.math", 6, "(f, fit)[%d] is (%f, %f). resid is (%f)\n", 1289 1289 i, f->data.F32[i], fit->data.F32[i], resid->data.F64[i]); 1290 1290 } … … 1300 1300 return(NULL); 1301 1301 } 1302 psTrace( __func__, 6, "Median is %f\n", stats->sampleMedian);1303 psTrace( __func__, 6, "Stdev is %f\n", stats->sampleStdev);1302 psTrace("psLib.math", 6, "Median is %f\n", stats->sampleMedian); 1303 psTrace("psLib.math", 6, "Stdev is %f\n", stats->sampleStdev); 1304 1304 psF32 minClipValue = -minClipSigma*stats->sampleStdev; 1305 1305 psF32 maxClipValue = +maxClipSigma*stats->sampleStdev; … … 1316 1316 (resid->data.F64[i] - stats->sampleMedian < minClipValue)) { 1317 1317 if (fit->type.type == PS_TYPE_F64) { 1318 psTrace( __func__, 6, "Masking element %d (%f). resid->data.F64[%d] is %f\n",1318 psTrace("psLib.math", 6, "Masking element %d (%f). resid->data.F64[%d] is %f\n", 1319 1319 i, fit->data.F64[i], i, resid->data.F64[i]); 1320 1320 } else { 1321 psTrace( __func__, 6, "Masking element %d (%f). resid->data.F64[%d] is %f\n",1321 psTrace("psLib.math", 6, "Masking element %d (%f). resid->data.F64[%d] is %f\n", 1322 1322 i, fit->data.F32[i], i, resid->data.F64[i]); 1323 1323 } … … 1331 1331 } 1332 1332 1333 psTrace( __func__, 6, "keeping %d of %d pts for fit\n", Nkeep, x->n);1333 psTrace("psLib.math", 6, "keeping %d of %d pts for fit\n", Nkeep, x->n); 1334 1334 psFree(fit); 1335 1335 } … … 1342 1342 } 1343 1343 1344 psTrace( __func__, 3, "---- %s() end ----\n", __func__);1344 psTrace("psLib.math", 3, "---- %s() end ----\n", __func__); 1345 1345 return(poly); 1346 1346 } … … 1369 1369 const psVector *z) 1370 1370 { 1371 psTrace( __func__, 4, "---- %s() begin ----\n", __func__);1371 psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__); 1372 1372 PS_ASSERT_POLY_NON_NULL(myPoly, NULL); 1373 1373 PS_ASSERT_INT_NONNEGATIVE(myPoly->nX, NULL); … … 1411 1411 psFree(A); 1412 1412 psFree(B); 1413 psTrace( __func__, 4, "---- %s() End ----\n", __func__);1413 psTrace("psLib.math", 4, "---- %s() End ----\n", __func__); 1414 1414 return(NULL); 1415 1415 } … … 1543 1543 psFree(B); 1544 1544 1545 psTrace( __func__, 4, "---- %s() end ----\n", __func__);1545 psTrace("psLib.math", 4, "---- %s() end ----\n", __func__); 1546 1546 return (myPoly); 1547 1547 } … … 1716 1716 const psVector *z) 1717 1717 { 1718 psTrace( __func__, 3, "---- %s() begin ----\n", __func__);1718 psTrace("psLib.math", 3, "---- %s() begin ----\n", __func__); 1719 1719 PS_ASSERT_POLY_NON_NULL(poly, NULL); 1720 1720 PS_ASSERT_POLY_TYPE(poly, PS_POLYNOMIAL_ORD, NULL); … … 1766 1766 // for now, for the SAMPLE_MEDIAN and SAMPLE_STDEV to be used 1767 1767 stats->options |= (PS_STAT_SAMPLE_MEDIAN | PS_STAT_SAMPLE_STDEV); 1768 psTrace( __func__, 4, "stats->clipIter is %d\n", stats->clipIter);1769 psTrace( __func__, 4, "(minClipSigma, maxClipSigma) is (%.2f, %.2f)\n", minClipSigma, maxClipSigma);1768 psTrace("psLib.math", 4, "stats->clipIter is %d\n", stats->clipIter); 1769 psTrace("psLib.math", 4, "(minClipSigma, maxClipSigma) is (%.2f, %.2f)\n", minClipSigma, maxClipSigma); 1770 1770 1771 1771 for (psS32 N = 0; N < stats->clipIter; N++) { 1772 psTrace( __func__, 6, "Loop iteration %d. Calling psVectorFitPolynomial1D()\n");1772 psTrace("psLib.math", 6, "Loop iteration %d. Calling psVectorFitPolynomial1D()\n"); 1773 1773 psS32 Nkeep = 0; 1774 1774 if (psTraceGetLevel(__func__) >= 6) { 1775 1775 if (mask != NULL) { 1776 1776 for (psS32 i = 0 ; i < mask->n ; i++) { 1777 psTrace( __func__, 6, "mask[%d] is %d\n", i, mask->data.U8[i]);1777 psTrace("psLib.math", 6, "mask[%d] is %d\n", i, mask->data.U8[i]); 1778 1778 } 1779 1779 } … … 1805 1805 for (psS32 i = 0 ; i < mask->n ; i++) { 1806 1806 if (!((mask != NULL) && (mask->data.U8[i] & maskValue))) { 1807 psTrace( __func__, 6, "(f, fit)[%d] is (%f, %f). resid is (%f)\n",1807 psTrace("psLib.math", 6, "(f, fit)[%d] is (%f, %f). resid is (%f)\n", 1808 1808 i, f->data.F32[i], fit->data.F32[i], resid->data.F64[i]); 1809 1809 } … … 1820 1820 } 1821 1821 1822 psTrace( __func__, 6, "Median is %f\n", stats->sampleMedian);1823 psTrace( __func__, 6, "Stdev is %f\n", stats->sampleStdev);1822 psTrace("psLib.math", 6, "Median is %f\n", stats->sampleMedian); 1823 psTrace("psLib.math", 6, "Stdev is %f\n", stats->sampleStdev); 1824 1824 psF32 minClipValue = -minClipSigma*stats->sampleStdev; 1825 1825 psF32 maxClipValue = +maxClipSigma*stats->sampleStdev; … … 1836 1836 (resid->data.F64[i] - stats->sampleMedian < minClipValue)) { 1837 1837 if (f->type.type == PS_TYPE_F64) { 1838 psTrace( __func__, 6, "Masking element %d (%f). resid->data.F64[%d] is %f\n",1838 psTrace("psLib.math", 6, "Masking element %d (%f). resid->data.F64[%d] is %f\n", 1839 1839 i, fit->data.F64[i], i, resid->data.F64[i]); 1840 1840 } else { 1841 psTrace( __func__, 6, "Masking element %d (%f). resid->data.F64[%d] is %f\n",1841 psTrace("psLib.math", 6, "Masking element %d (%f). resid->data.F64[%d] is %f\n", 1842 1842 i, fit->data.F32[i], i, resid->data.F64[i]); 1843 1843 } … … 1851 1851 } 1852 1852 1853 psTrace( __func__, 6, "keeping %d of %d pts for fit\n", Nkeep, x->n);1853 psTrace("psLib.math", 6, "keeping %d of %d pts for fit\n", Nkeep, x->n); 1854 1854 psFree(fit); 1855 1855 } … … 1862 1862 } 1863 1863 1864 psTrace( __func__, 3, "---- %s() end ----\n", __func__);1864 psTrace("psLib.math", 3, "---- %s() end ----\n", __func__); 1865 1865 return(poly); 1866 1866 } … … 1888 1888 const psVector *t) 1889 1889 { 1890 psTrace( __func__, 4, "---- %s() begin ----\n", __func__);1890 psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__); 1891 1891 PS_ASSERT_POLY_NON_NULL(myPoly, NULL); 1892 1892 PS_ASSERT_INT_NONNEGATIVE(myPoly->nX, NULL); … … 1934 1934 psFree(A); 1935 1935 psFree(B); 1936 psTrace( __func__, 4, "---- %s() End ----\n", __func__);1936 psTrace("psLib.math", 4, "---- %s() End ----\n", __func__); 1937 1937 return(NULL); 1938 1938 } … … 2079 2079 psFree(B); 2080 2080 2081 psTrace( __func__, 4, "---- %s() end ----\n", __func__);2081 psTrace("psLib.math", 4, "---- %s() end ----\n", __func__); 2082 2082 return (myPoly); 2083 2083 } … … 2277 2277 const psVector *t) 2278 2278 { 2279 psTrace( __func__, 3, "---- %s() begin ----\n", __func__);2279 psTrace("psLib.math", 3, "---- %s() begin ----\n", __func__); 2280 2280 PS_ASSERT_POLY_NON_NULL(poly, NULL); 2281 2281 PS_ASSERT_POLY_TYPE(poly, PS_POLYNOMIAL_ORD, NULL); … … 2331 2331 // for now, for the SAMPLE_MEDIAN and SAMPLE_STDEV to be used 2332 2332 stats->options |= (PS_STAT_SAMPLE_MEDIAN | PS_STAT_SAMPLE_STDEV); 2333 psTrace( __func__, 4, "stats->clipIter is %d\n", stats->clipIter);2334 psTrace( __func__, 4, "(minClipSigma, maxClipSigma) is (%.2f, %.2f)\n", minClipSigma, maxClipSigma);2333 psTrace("psLib.math", 4, "stats->clipIter is %d\n", stats->clipIter); 2334 psTrace("psLib.math", 4, "(minClipSigma, maxClipSigma) is (%.2f, %.2f)\n", minClipSigma, maxClipSigma); 2335 2335 2336 2336 for (psS32 N = 0; N < stats->clipIter; N++) { 2337 psTrace( __func__, 6, "Loop iteration %d. Calling psVectorFitPolynomial4D()\n");2337 psTrace("psLib.math", 6, "Loop iteration %d. Calling psVectorFitPolynomial4D()\n"); 2338 2338 psS32 Nkeep = 0; 2339 2339 if (psTraceGetLevel(__func__) >= 6) { 2340 2340 if (mask != NULL) { 2341 2341 for (psS32 i = 0 ; i < mask->n ; i++) { 2342 psTrace( __func__, 6, "mask[%d] is %d\n", i, mask->data.U8[i]);2342 psTrace("psLib.math", 6, "mask[%d] is %d\n", i, mask->data.U8[i]); 2343 2343 } 2344 2344 } … … 2371 2371 for (psS32 i = 0 ; i < mask->n ; i++) { 2372 2372 if (!((mask != NULL) && (mask->data.U8[i] & maskValue))) { 2373 psTrace( __func__, 6, "(f, fit)[%d] is (%f, %f). resid is (%f)\n",2373 psTrace("psLib.math", 6, "(f, fit)[%d] is (%f, %f). resid is (%f)\n", 2374 2374 i, f->data.F32[i], fit->data.F32[i], resid->data.F64[i]); 2375 2375 } … … 2385 2385 return(NULL); 2386 2386 } 2387 psTrace( __func__, 6, "Median is %f\n", stats->sampleMedian);2388 psTrace( __func__, 6, "Stdev is %f\n", stats->sampleStdev);2387 psTrace("psLib.math", 6, "Median is %f\n", stats->sampleMedian); 2388 psTrace("psLib.math", 6, "Stdev is %f\n", stats->sampleStdev); 2389 2389 psF32 minClipValue = -minClipSigma*stats->sampleStdev; 2390 2390 psF32 maxClipValue = +maxClipSigma*stats->sampleStdev; … … 2401 2401 (resid->data.F64[i] - stats->sampleMedian < minClipValue)) { 2402 2402 if (f->type.type == PS_TYPE_F64) { 2403 psTrace( __func__, 6, "Masking element %d (%f). resid->data.F64[%d] is %f\n",2403 psTrace("psLib.math", 6, "Masking element %d (%f). resid->data.F64[%d] is %f\n", 2404 2404 i, fit->data.F64[i], i, resid->data.F64[i]); 2405 2405 } else { 2406 psTrace( __func__, 6, "Masking element %d (%f). resid->data.F64[%d] is %f\n",2406 psTrace("psLib.math", 6, "Masking element %d (%f). resid->data.F64[%d] is %f\n", 2407 2407 i, fit->data.F32[i], i, resid->data.F64[i]); 2408 2408 } … … 2417 2417 } 2418 2418 2419 psTrace( __func__, 6, "keeping %d of %d pts for fit\n", Nkeep, x->n);2419 psTrace("psLib.math", 6, "keeping %d of %d pts for fit\n", Nkeep, x->n); 2420 2420 psFree (fit); 2421 2421 } … … 2428 2428 } 2429 2429 2430 psTrace( __func__, 3, "---- %s() end ----\n", __func__);2430 psTrace("psLib.math", 3, "---- %s() end ----\n", __func__); 2431 2431 return(poly); 2432 2432 } -
trunk/psLib/src/math/psMinimizePowell.c
r7766 r8245 11 11 * NOTE: XXX: The SDR is silent about data types. F32 is implemented here. 12 12 * 13 * @version $Revision: 1. 9$ $Name: not supported by cvs2svn $14 * @date $Date: 2006-0 6-30 02:20:06$13 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2006-08-09 02:26:44 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 117 117 psBool boolLineIsNull = true; 118 118 119 psTrace( __func__, 4, "---- p_psDetermineBracket() begin ----\n");119 psTrace("psLib.math", 4, "---- p_psDetermineBracket() begin ----\n"); 120 120 121 121 // If the line vector is zero, then return NULL. 122 122 PS_VECTOR_WITH_MASK_F32_CHECK_ZERO_VECTOR(params, paramMask, boolLineIsNull); 123 123 if (boolLineIsNull == true) { 124 psTrace( __func__, 2, "p_psDetermineBracket() called with zero line vector.\n");125 psTrace( __func__, 4, "---- p_psDetermineBracket() end (NULL) ----\n");124 psTrace("psLib.math", 2, "p_psDetermineBracket() called with zero line vector.\n"); 125 psTrace("psLib.math", 4, "---- p_psDetermineBracket() end (NULL) ----\n"); 126 126 psFree(bracket); 127 127 return(NULL); … … 155 155 } 156 156 157 psTrace( __func__, 6, "(a, b, c) is (%f %f %f) (fa, fb, fc) is (%f %f %f)\n", a, b, c, fa, fb, fc);157 psTrace("psLib.math", 6, "(a, b, c) is (%f %f %f) (fa, fb, fc) is (%f %f %f)\n", a, b, c, fa, fb, fc); 158 158 159 159 while (iter > 0) { 160 psTrace( __func__, 6, "psDetermineBracket(): iteration %d\n", iter);160 psTrace("psLib.math", 6, "psDetermineBracket(): iteration %d\n", iter); 161 161 if ((fb < fa) && (fb < fc)) { 162 162 bracket->data.F32[0] = a; … … 164 164 bracket->data.F32[2] = c; 165 165 psFree(tmp); 166 psTrace( __func__, 6, "---- p_psDetermineBracket() end ----\n");166 psTrace("psLib.math", 6, "---- p_psDetermineBracket() end ----\n"); 167 167 return(bracket); 168 168 } … … 177 177 fc = func(tmp, coords); 178 178 179 psTrace( __func__, 6, "Iter(%d): (a, b, c) is (%f %f %f) (fa, fb, fc) is (%f %f %f)\n", iter, a, b, c, fa, fb, fc);179 psTrace("psLib.math", 6, "Iter(%d): (a, b, c) is (%f %f %f) (fa, fb, fc) is (%f %f %f)\n", iter, a, b, c, fa, fb, fc); 180 180 181 181 if (fa < fb) { … … 195 195 bracket->data.F32[2] = c; 196 196 psFree(tmp); 197 psTrace( __func__, 4, "---- p_psDetermineBracket() end ----\n");197 psTrace("psLib.math", 4, "---- p_psDetermineBracket() end ----\n"); 198 198 return(bracket); 199 199 } … … 204 204 bracket->data.F32[2] = c; 205 205 psFree(tmp); 206 psTrace( __func__, 4, "---- p_psDetermineBracket() end ----\n");206 psTrace("psLib.math", 4, "---- p_psDetermineBracket() end ----\n"); 207 207 return(bracket); 208 208 } … … 213 213 psFree(tmp); 214 214 psFree(bracket); 215 psTrace( __func__, 4, "---- p_psDetermineBracket() end (NULL) ----\n");215 psTrace("psLib.math", 4, "---- p_psDetermineBracket() end (NULL) ----\n"); 216 216 return(NULL); 217 217 } … … 228 228 bracket->data.F32[2] = a; \ 229 229 } \ 230 psTrace( __func__, 4, "Final bracket (a, b, c) is (%f %f %f) (fa, fb, fc) is (%f %f %f)\n", a, b, c, fa, fb, fc); \231 psTrace( __func__, 4, "---- p_psDetermineBracket() end ----\n"); \230 psTrace("psLib.math", 4, "Final bracket (a, b, c) is (%f %f %f) (fa, fb, fc) is (%f %f %f)\n", a, b, c, fa, fb, fc); \ 231 psTrace("psLib.math", 4, "---- p_psDetermineBracket() end ----\n"); \ 232 232 psFree(tmp); \ 233 233 return(bracket); \ … … 253 253 psS32 countMin = 0; 254 254 255 psTrace( __func__, 4, "---- p_psDetermineBracket() begin ----\n");255 psTrace("psLib.math", 4, "---- p_psDetermineBracket() begin ----\n"); 256 256 257 257 // If the line vector is zero, then return NULL. 258 258 PS_VECTOR_WITH_MASK_F32_CHECK_ZERO_VECTOR(params, paramMask, boolLineIsNull); 259 259 if (boolLineIsNull == true) { 260 psTrace( __func__, 2, "p_psDetermineBracket() called with zero line vector.\n");261 psTrace( __func__, 4, "---- p_psDetermineBracket() end (NULL) ----\n");260 psTrace("psLib.math", 2, "p_psDetermineBracket() called with zero line vector.\n"); 261 psTrace("psLib.math", 4, "---- p_psDetermineBracket() end (NULL) ----\n"); 262 262 psFree(tmp); 263 263 return(NULL); … … 289 289 iter = 0; 290 290 while (iter < PS_DETERMINE_BRACKET_MAX_ITERATIONS) { 291 psTrace( __func__, 6, "psDetermineBracket(): iterationA %d\n", iter);291 psTrace("psLib.math", 6, "psDetermineBracket(): iterationA %d\n", iter); 292 292 c+= (1.0 + PS_DETERMINE_BRACKET_STEP_SIZE) * (c - a); 293 293 … … 295 295 fc = func(tmp, coords); 296 296 297 psTrace( __func__, 6, "Iteration(%d) (bracket): (a, b, c) is (%f %f %f) (fa, fb, fc) is (%f %f %f)\n", iter, a, b, c, fa, fb, fc);297 psTrace("psLib.math", 6, "Iteration(%d) (bracket): (a, b, c) is (%f %f %f) (fa, fb, fc) is (%f %f %f)\n", iter, a, b, c, fa, fb, fc); 298 298 299 299 if ((fb < fa) && (fb < fc)) { … … 320 320 321 321 psFree(bracket); 322 psTrace( __func__, 4, "---- p_psDetermineBracket() end (NULL) (BAD) ----\n");322 psTrace("psLib.math", 4, "---- p_psDetermineBracket() end (NULL) (BAD) ----\n"); 323 323 return(NULL); 324 324 } … … 371 371 psS32 numIterations = 0; 372 372 373 psTrace( __func__, 4, "---- LineMin() begin ----\n");373 psTrace("psLib.math", 4, "---- LineMin() begin ----\n"); 374 374 PS_VECTOR_F32_CHECK_ZERO_VECTOR(line, boolLineIsNull); 375 375 376 376 if (boolLineIsNull == true) { 377 377 min->value = func(params, coords); 378 psTrace( __func__, 2, "LineMin() called with zero line vector. Return 0.0. Function value is %f\n", min->value);378 psTrace("psLib.math", 2, "LineMin() called with zero line vector. Return 0.0. Function value is %f\n", min->value); 379 379 return(0.0); 380 380 } … … 382 382 if (6 <= psTraceGetLevel(__func__)) { 383 383 for (i=0;i<params->n;i++) { 384 psTrace( __func__, 6, "(params, paramMask, line)[%d] is (%f %d %f)\n", i,384 psTrace("psLib.math", 6, "(params, paramMask, line)[%d] is (%f %d %f)\n", i, 385 385 params->data.F32[i], paramMask->data.U8[i], line->data.F32[i]); 386 386 } … … 402 402 while (numIterations < PS_LINEMIN_MAX_ITERATIONS) { 403 403 numIterations++; 404 psTrace( __func__, 6, "LineMin(): iteration %d\n", numIterations);404 psTrace("psLib.math", 6, "LineMin(): iteration %d\n", numIterations); 405 405 406 406 a = bracket->data.F32[0]; … … 413 413 fb = func(tmpb, coords); 414 414 fc = func(tmpc, coords); 415 psTrace( __func__, 6, "LineMin: f(%f %f %f) is (%f %f %f)\n", a, b, c, fa, fb, fc);415 psTrace("psLib.math", 6, "LineMin: f(%f %f %f) is (%f %f %f)\n", a, b, c, fa, fb, fc); 416 416 417 417 // We determine which is the biggest segment in [a,b,c] then split … … 449 449 } 450 450 } 451 psTrace( __func__, 6, "LineMin: new bracket is (%f %f %f)\n", bracket->data.F32[0], bracket->data.F32[1], bracket->data.F32[2]);451 psTrace("psLib.math", 6, "LineMin: new bracket is (%f %f %f)\n", bracket->data.F32[0], bracket->data.F32[1], bracket->data.F32[2]); 452 452 453 453 mul = bracket->data.F32[1]; … … 456 456 min->value = func(params, coords); 457 457 psFree(bracket); 458 psTrace( __func__, 4, "---- LineMin() end.a (%f) (%f) ----\n", mul, min->value);458 psTrace("psLib.math", 4, "---- LineMin() end.a (%f) (%f) ----\n", mul, min->value); 459 459 psFree(tmpa); 460 460 psFree(tmpb); … … 468 468 PS_VECTOR_ADD_MULTIPLE(params, paramMask, line, params, mul); 469 469 min->value = func(params, coords); 470 psTrace( __func__, 4, "---- LineMin() end.b (%f) %f ----\n", mul, min->value);470 psTrace("psLib.math", 4, "---- LineMin() end.b (%f) %f ----\n", mul, min->value); 471 471 472 472 psFree(bracket); … … 517 517 psS32 iterationNumber = 0; 518 518 519 psTrace( __func__, 4, "---- psMinimizePowell() begin ----\n");520 psTrace( __func__, 6, "min->maxIter is %d\n", min->maxIter);521 psTrace( __func__, 6, "min->tol is %f\n", min->tol);519 psTrace("psLib.math", 4, "---- psMinimizePowell() begin ----\n"); 520 psTrace("psLib.math", 6, "min->maxIter is %d\n", min->maxIter); 521 psTrace("psLib.math", 6, "min->tol is %f\n", min->tol); 522 522 523 523 if (paramMask == NULL) { … … 562 562 while (iterationNumber < min->maxIter) { 563 563 iterationNumber++; 564 psTrace( __func__, 6, "psMinimizePowell() iteration %d\n", iterationNumber);564 psTrace("psLib.math", 6, "psMinimizePowell() iteration %d\n", iterationNumber); 565 565 566 566 // 3: For each dimension in params, move Q only in the vector v[i] to … … 569 569 baseFuncVal = func(Q, coords); 570 570 currFuncVal = baseFuncVal; 571 psTrace( __func__, 6, "Current function value is %f\n", currFuncVal);571 psTrace("psLib.math", 6, "Current function value is %f\n", currFuncVal); 572 572 573 573 biggestDiff = 0; … … 588 588 return(false); 589 589 } 590 psTrace( __func__, 6, "LineMin along dimension %d has multiple %f\n", i, mul);590 psTrace("psLib.math", 6, "LineMin along dimension %d has multiple %f\n", i, mul); 591 591 592 592 if (fabs(dummyMin.value - currFuncVal) > biggestDiff) { … … 598 598 // XXX: how can it be that we are not saving mul anywhere? 599 599 } 600 psTrace( __func__, 6, "New function value is %f\n", currFuncVal);600 psTrace("psLib.math", 6, "New function value is %f\n", currFuncVal); 601 601 // XXX: There must be a bug here. How can currFuncVal be the current function value? 602 602 // It is simply the minimum along one of the parameter dimensions. … … 608 608 u->n++; 609 609 610 psTrace( __func__, 6, "u[i]=Q[i]-P[i] (%f = %f - %f)\n", u->data.F32[i],610 psTrace("psLib.math", 6, "u[i]=Q[i]-P[i] (%f = %f - %f)\n", u->data.F32[i], 611 611 Q->data.F32[i], 612 612 params->data.F32[i]); … … 620 620 // 5: Move Q only in the direction u, and minimize the function. 621 621 for (i=0;i<numDims;i++) { 622 psTrace( __func__, 6, "u[i] is %f\n", u->data.F32[i]);622 psTrace("psLib.math", 6, "u[i] is %f\n", u->data.F32[i]); 623 623 } 624 624 … … 643 643 min->value = currFuncVal; 644 644 min->lastDelta = 0.0; 645 psTrace( __func__, 4, "---- psMinimizePowell() end (1)(true) ----\n");645 psTrace("psLib.math", 4, "---- psMinimizePowell() end (1)(true) ----\n"); 646 646 return(true); 647 647 } … … 685 685 min->iter = iterationNumber; 686 686 min->lastDelta = currFuncVal - baseFuncVal; 687 psTrace( __func__, 4, "---- psMinimizePowell() end (2) (true) ----\n");687 psTrace("psLib.math", 4, "---- psMinimizePowell() end (2) (true) ----\n"); 688 688 return(true); 689 689 } … … 695 695 psFree(Q); 696 696 min->iter = iterationNumber; 697 psTrace( __func__, 4, "---- psMinimizePowell() end (0) (false) ----\n");697 psTrace("psLib.math", 4, "---- psMinimizePowell() end (0) (false) ----\n"); 698 698 return(false); 699 699 } … … 712 712 const psArray *coords) 713 713 { 714 psTrace( __func__, 4, "---- myPowellChi2Func() begin ----\n");714 psTrace("psLib.math", 4, "---- myPowellChi2Func() begin ----\n"); 715 715 PS_ASSERT_VECTOR_NON_NULL(params, NAN); 716 716 PS_ASSERT_VECTOR_NON_EMPTY(params, NAN); … … 750 750 } 751 751 psFree(tmp); 752 psTrace( __func__, 4, "---- myPowellChi2Func() end (chi2 is %f) ----\n", chi2);752 psTrace("psLib.math", 4, "---- myPowellChi2Func() end (chi2 is %f) ----\n", chi2); 753 753 return(chi2); 754 754 } -
trunk/psLib/src/math/psPolynomial.c
r8232 r8245 7 7 * polynomials. It also contains a Gaussian functions. 8 8 * 9 * @version $Revision: 1.14 8$ $Name: not supported by cvs2svn $10 * @date $Date: 2006-08-0 8 23:32:23$9 * @version $Revision: 1.149 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2006-08-09 02:26:44 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 217 217 psF64 xSum = 1.0; 218 218 219 psTrace( __func__, 4, "---- %s() begin ----\n", __func__);220 psTrace( __func__, 4, "Polynomial order is %u\n", poly->nX);219 psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__); 220 psTrace("psLib.math", 4, "Polynomial order is %u\n", poly->nX); 221 221 for (loop_x = 0; loop_x < poly->nX+1; loop_x++) { 222 psTrace( __func__, 4, "Polynomial coeff[%u] is %lf\n", loop_x, poly->coeff[loop_x]);222 psTrace("psLib.math", 4, "Polynomial coeff[%u] is %lf\n", loop_x, poly->coeff[loop_x]); 223 223 } 224 224 225 225 for (loop_x = 0; loop_x < poly->nX+1; loop_x++) { 226 226 if (poly->mask[loop_x] == 0) { 227 psTrace( __func__, 8,227 psTrace("psLib.math", 8, 228 228 "polysum+= sum*coeff [%lf+= (%lf * %lf)\n", polySum, xSum, poly->coeff[loop_x]); 229 229 polySum += xSum * poly->coeff[loop_x]; … … 232 232 } 233 233 234 psTrace( __func__, 4, "---- %s() end ----\n", __func__);234 psTrace("psLib.math", 4, "---- %s() end ----\n", __func__); 235 235 return(polySum); 236 236 } … … 571 571 psF32 tmp = 1.0; 572 572 573 psTrace( __func__, 4, "---- %s() begin ----\n", __func__);573 psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__); 574 574 575 575 if (normal == true) { … … 577 577 } 578 578 579 psTrace( __func__, 4, "---- %s() end ----\n", __func__);579 psTrace("psLib.math", 4, "---- %s() end ----\n", __func__); 580 580 return(tmp * exp(-((x - mean) * (x - mean)) / (2.0 * sigma * sigma))); 581 581 } -
trunk/psLib/src/math/psSpline.c
r8232 r8245 6 6 * This file contains the routines that allocate, free, and evaluate splines. 7 7 * 8 * @version $Revision: 1.15 1$ $Name: not supported by cvs2svn $9 * @date $Date: 2006-08-0 8 23:32:23$8 * @version $Revision: 1.152 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2006-08-09 02:26:44 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 119 119 const psVector* y) ///< Coordinates 120 120 { 121 psTrace( __func__, 4, "---- %s() begin ----\n", __func__);121 psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__); 122 122 if (psTraceGetLevel(__func__) >= 6) { 123 123 p_psVectorPrint(1, (psVector *) x, "x"); … … 143 143 u[i] = ((6.0 * u[i] / (X[i+1] - X[i-1])) - (sig * u[i-1])) / p; 144 144 145 psTrace( __func__, 6, "X[%d] is %f\n", i, X[i]);146 psTrace( __func__, 6, "Y[%d] is %f\n", i, Y[i]);147 psTrace( __func__, 6, "u[%d] is %f\n", i, u[i]);145 psTrace("psLib.math", 6, "X[%d] is %f\n", i, X[i]); 146 psTrace("psLib.math", 6, "Y[%d] is %f\n", i, Y[i]); 147 psTrace("psLib.math", 6, "u[%d] is %f\n", i, u[i]); 148 148 } 149 149 … … 154 154 for (psS32 k=(n-2);k>=0;k--) { 155 155 derivs2[k] = derivs2[k] * derivs2[k+1] + u[k]; 156 psTrace( __func__, 6, "derivs2[%d] is %f\n", k, derivs2[k]);156 psTrace("psLib.math", 6, "derivs2[%d] is %f\n", k, derivs2[k]); 157 157 } 158 158 psFree(u); 159 psTrace( __func__, 4, "---- %s() end ----\n", __func__);159 psTrace("psLib.math", 4, "---- %s() end ----\n", __func__); 160 160 return(derivs2); 161 161 } … … 210 210 const psVector* y) ///< Coordinates. 211 211 { 212 psTrace( __func__, 3, "---- %s() begin ----\n", __func__);212 psTrace("psLib.math", 3, "---- %s() begin ----\n", __func__); 213 213 PS_ASSERT_VECTOR_NON_NULL(y, NULL); 214 214 PS_ASSERT_VECTOR_TYPE_F32_OR_F64(y, NULL); 215 215 PS_ASSERT_INT_LARGER_THAN_OR_EQUAL(y->n, 2, NULL); 216 216 psS32 numSplines = (y->n)-1; 217 psTrace( __func__, 5, "numSplines is %d\n", numSplines);217 psTrace("psLib.math", 5, "numSplines is %d\n", numSplines); 218 218 219 219 // … … 281 281 i, i+1, xPtr->data.F32[i], xPtr->data.F32[i+1]); 282 282 } 283 psTrace( __func__, 6, "x data (%f - %f) (%f)\n", xPtr->data.F32[i], xPtr->data.F32[i+1], H);283 psTrace("psLib.math", 6, "x data (%f - %f) (%f)\n", xPtr->data.F32[i], xPtr->data.F32[i+1], H); 284 284 // 285 285 // ******** Calculate 0-order term ******** … … 334 334 spline->spline[i]->coeff[3]+= spline->p_psDeriv2[i+1] / (6.0 * H); 335 335 336 psTrace( __func__, 6, "(spline->spline[%u])->coeff[0] is %f\n", i, spline->spline[i]->coeff[0]);337 psTrace( __func__, 6, "(spline->spline[%u])->coeff[1] is %f\n", i, spline->spline[i]->coeff[1]);338 psTrace( __func__, 6, "(spline->spline[%u])->coeff[2] is %f\n", i, spline->spline[i]->coeff[2]);339 psTrace( __func__, 6, "(spline->spline[%u])->coeff[3] is %f\n", i, spline->spline[i]->coeff[3]);336 psTrace("psLib.math", 6, "(spline->spline[%u])->coeff[0] is %f\n", i, spline->spline[i]->coeff[0]); 337 psTrace("psLib.math", 6, "(spline->spline[%u])->coeff[1] is %f\n", i, spline->spline[i]->coeff[1]); 338 psTrace("psLib.math", 6, "(spline->spline[%u])->coeff[2] is %f\n", i, spline->spline[i]->coeff[2]); 339 psTrace("psLib.math", 6, "(spline->spline[%u])->coeff[3] is %f\n", i, spline->spline[i]->coeff[3]); 340 340 } 341 341 … … 343 343 psFree(yPtr); 344 344 } 345 psTrace( __func__, 3, "---- %s() end ----\n", __func__);345 psTrace("psLib.math", 3, "---- %s() end ----\n", __func__); 346 346 return(spline); 347 347 } … … 365 365 float x) 366 366 { 367 psTrace( __func__, 3, "---- %s() begin ----\n", __func__);367 psTrace("psLib.math", 3, "---- %s() begin ----\n", __func__); 368 368 PS_ASSERT_PTR_NON_NULL(spline, NAN); 369 369 PS_ASSERT_INT_NONNEGATIVE(spline->n, NAN); … … 379 379 380 380 psS32 binNum = (x < spline->knots->data.F32[0]) ? 0 : n-1; 381 psTrace( __func__, 3, "---- %s() end ----\n", __func__);381 psTrace("psLib.math", 3, "---- %s() end ----\n", __func__); 382 382 return(psPolynomial1DEval(spline->spline[binNum], x)); 383 383 } … … 392 392 } 393 393 394 psTrace( __func__, 3, "---- %s() end ----\n", __func__);394 psTrace("psLib.math", 3, "---- %s() end ----\n", __func__); 395 395 return(psPolynomial1DEval(spline->spline[binNum], x)); 396 396 } … … 403 403 const psVector *x) 404 404 { 405 psTrace( __func__, 3, "---- %s() begin ----\n", __func__);405 psTrace("psLib.math", 3, "---- %s() begin ----\n", __func__); 406 406 PS_ASSERT_PTR_NON_NULL(spline, NULL); 407 407 PS_ASSERT_VECTOR_TYPE(spline->knots, PS_TYPE_F32, NULL); … … 426 426 } 427 427 428 psTrace( __func__, 3, "---- %s() end ----\n", __func__);428 psTrace("psLib.math", 3, "---- %s() end ----\n", __func__); 429 429 return(tmpVector); 430 430 } -
trunk/psLib/src/math/psStats.c
r8232 r8245 16 16 * use ->min and ->max (PS_STAT_USE_RANGE) 17 17 * 18 * @version $Revision: 1.18 3$ $Name: not supported by cvs2svn $19 * @date $Date: 2006-08-0 8 23:32:23$18 * @version $Revision: 1.184 $ $Name: not supported by cvs2svn $ 19 * @date $Date: 2006-08-09 02:26:44 $ 20 20 * 21 21 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 110 110 psStats* stats) 111 111 { 112 psTrace( __func__, 4, "---- %s() begin ----\n", __func__);112 psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__); 113 113 114 114 psF32 mean = 0.0; // The mean … … 221 221 stats->sampleMean = mean; 222 222 if (isnan(mean)) { 223 psTrace( __func__, 4, "---- %s(false) end ----\n", __func__);223 psTrace("psLib.math", 4, "---- %s(false) end ----\n", __func__); 224 224 return false; 225 225 } 226 226 227 psTrace( __func__, 4, "---- %s(true) end ----\n", __func__);227 psTrace("psLib.math", 4, "---- %s(true) end ----\n", __func__); 228 228 return true; 229 229 } … … 240 240 ) 241 241 { 242 psTrace( __func__, 4, "---- %s() begin ----\n", __func__);242 psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__); 243 243 psF32 max = -PS_MAX_F32; // The calculated maximum 244 244 psF32 min = PS_MAX_F32; // The calculated minimum … … 316 316 stats->min = min; 317 317 } 318 psTrace( __func__, 4, "---- %s(%d) end ----\n", __func__, numValid);318 psTrace("psLib.math", 4, "---- %s(%d) end ----\n", __func__, numValid); 319 319 return numValid; 320 320 } … … 332 332 psStats* stats) 333 333 { 334 psTrace( __func__, 4, "---- %s() begin ----\n", __func__);334 psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__); 335 335 PS_ASSERT_VECTOR_NON_NULL(myVector, false); 336 336 PS_ASSERT_PTR_NON_NULL(stats, false); … … 342 342 (stats->min <= myVector->data.F32[i]) && 343 343 (myVector->data.F32[i] <= stats->max)) { 344 psTrace( __func__, 4, "---- %s(true) end ----\n", __func__);344 psTrace("psLib.math", 4, "---- %s(true) end ----\n", __func__); 345 345 return true; 346 346 } … … 350 350 if ((stats->min <= myVector->data.F32[i]) && 351 351 (myVector->data.F32[i] <= stats->max)) { 352 psTrace( __func__, 4, "---- %s(true) end ----\n", __func__);352 psTrace("psLib.math", 4, "---- %s(true) end ----\n", __func__); 353 353 return true; 354 354 } … … 359 359 for (long i = 0; i < myVector->n; i++) { 360 360 if (!(maskVal & maskVector->data.U8[i])) { 361 psTrace( __func__, 4, "---- %s(true) end ----\n", __func__);361 psTrace("psLib.math", 4, "---- %s(true) end ----\n", __func__); 362 362 return true; 363 363 } … … 365 365 } else { 366 366 if (myVector->n > 0) { 367 psTrace( __func__, 4, "---- %s(true) end ----\n", __func__);367 psTrace("psLib.math", 4, "---- %s(true) end ----\n", __func__); 368 368 return true; 369 369 } 370 370 } 371 371 } 372 psTrace( __func__, 4, "---- %s(false) end ----\n", __func__);372 psTrace("psLib.math", 4, "---- %s(false) end ----\n", __func__); 373 373 return(false); 374 374 } … … 385 385 psStats* stats) 386 386 { 387 psTrace( __func__, 4, "---- %s() begin ----\n", __func__);387 psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__); 388 388 389 389 // Allocate temporary vectors for the data. … … 441 441 false, 442 442 _("Failed to sort input data.")); 443 psTrace( __func__, 4, "---- %s(false) end ----\n", __func__);443 psTrace("psLib.math", 4, "---- %s(false) end ----\n", __func__); 444 444 psFree(vector); 445 445 return false; … … 463 463 464 464 // Return "true" on success. 465 psTrace( __func__, 4, "---- %s(true) end ----\n", __func__);465 psTrace("psLib.math", 4, "---- %s(true) end ----\n", __func__); 466 466 return true; 467 467 } … … 475 475 psF32 sigma) 476 476 { 477 psTrace( __func__, 4, "---- %s() begin ----\n", __func__);478 psTrace( __func__, 5, "(histogram->nums->n, sigma) is (%d, %.2f\n", (int) histogram->nums->n, sigma);477 psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__); 478 psTrace("psLib.math", 5, "(histogram->nums->n, sigma) is (%d, %.2f\n", (int) histogram->nums->n, sigma); 479 479 PS_ASSERT_PTR_NON_NULL(histogram, NULL); 480 480 PS_ASSERT_PTR_NON_NULL(histogram->bounds, NULL); … … 564 564 PS_VECTOR_PRINT_F32(smooth); 565 565 } 566 psTrace( __func__, 4, "---- %s() end ----\n", __func__);566 psTrace("psLib.math", 4, "---- %s() end ----\n", __func__); 567 567 return(smooth); 568 568 } … … 586 586 psStats* stats) 587 587 { 588 psTrace( __func__, 4, "---- %s() begin ----\n", __func__);588 psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__); 589 589 590 590 // This procedure requires the mean. If it has not been already … … 597 597 stats->sampleStdev = NAN; 598 598 psLogMsg(__func__, PS_LOG_WARN, "WARNING: vectorSampleStdev(): vectorSampleMean() reported a NAN mean.\n"); 599 psTrace( __func__, 4, "---- %s() end ----\n", __func__);599 psTrace("psLib.math", 4, "---- %s() end ----\n", __func__); 600 600 return false; 601 601 } … … 680 680 (float)(count - 1)); 681 681 } 682 psTrace( __func__, 4, "---- %s() end ----\n", __func__);682 psTrace("psLib.math", 4, "---- %s() end ----\n", __func__); 683 683 684 684 return true; … … 704 704 ) 705 705 { 706 psTrace( __func__, 4, "---- %s() begin ----\n", __func__);707 psTrace( __func__, 4, "Trace level is %d\n", psTraceGetLevel(__func__));706 psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__); 707 psTrace("psLib.math", 4, "Trace level is %d\n", psTraceGetLevel(__func__)); 708 708 709 709 // Ensure that stats->clipIter is within the proper range. … … 739 739 stats->clippedMean = NAN; 740 740 stats->clippedStdev = NAN; 741 psTrace( __func__, 4, "---- %s(false) end ----\n", __func__);741 psTrace("psLib.math", 4, "---- %s(false) end ----\n", __func__); 742 742 psFree(tmpMask); 743 743 psFree(statsTmp); 744 744 return false; 745 745 } 746 psTrace( __func__, 6, "The initial sample median is %f\n", statsTmp->sampleMedian);746 psTrace("psLib.math", 6, "The initial sample median is %f\n", statsTmp->sampleMedian); 747 747 748 748 // 2. Compute the sample standard deviation. … … 752 752 stats->clippedMean = NAN; 753 753 stats->clippedStdev = NAN; 754 psTrace( __func__, 4, "---- %s(false) end ----\n", __func__);754 psTrace("psLib.math", 4, "---- %s(false) end ----\n", __func__); 755 755 psFree(tmpMask); 756 756 psFree(statsTmp); 757 757 return false; 758 758 } 759 psTrace( __func__, 6, "The initial sample stdev is %f\n", statsTmp->sampleStdev);759 psTrace("psLib.math", 6, "The initial sample stdev is %f\n", statsTmp->sampleStdev); 760 760 761 761 // 3. Use the sample median as the first estimator of the mean X. … … 770 770 for (int iter = 0; iter < stats->clipIter && clipped; iter++) { 771 771 clipped = false; 772 psTrace( __func__, 6, "------------ Iteration %d ------------\n", iter);772 psTrace("psLib.math", 6, "------------ Iteration %d ------------\n", iter); 773 773 // a) Exclude all values x_i for which |x_i - x| > K * stdev 774 774 if (errors) { … … 777 777 fabsf(myVector->data.F32[j] - clippedMean) > stats->clipSigma * errors->data.F32[j]) { 778 778 tmpMask->data.U8[j] = 0xff; 779 psTrace( __func__, 10, "Clipped %d: %f +/- %f\n", j,779 psTrace("psLib.math", 10, "Clipped %d: %f +/- %f\n", j, 780 780 myVector->data.F32[j], errors->data.F32[j]); 781 781 numClipped++; … … 788 788 fabsf(myVector->data.F32[j] - clippedMean) > (stats->clipSigma * clippedStdev)) { 789 789 tmpMask->data.U8[j] = 0xff; 790 psTrace( __func__, 10, "Clipped %d: %f\n", j, myVector->data.F32[j]);790 psTrace("psLib.math", 10, "Clipped %d: %f\n", j, myVector->data.F32[j]); 791 791 numClipped++; 792 792 clipped = true; … … 798 798 vectorSampleMean(myVector, errors, tmpMask, maskVal, statsTmp); 799 799 vectorSampleStdev(myVector, errors, tmpMask, maskVal, statsTmp); 800 psTrace( __func__, 6, "The new sample mean is %f\n", statsTmp->sampleMean);801 psTrace( __func__, 6, "The new sample stdev is %f\n", statsTmp->sampleStdev);800 psTrace("psLib.math", 6, "The new sample mean is %f\n", statsTmp->sampleMean); 801 psTrace("psLib.math", 6, "The new sample stdev is %f\n", statsTmp->sampleStdev); 802 802 803 803 // If the new mean and stdev are NAN, we must exit the loop. … … 821 821 if (stats->options & PS_STAT_CLIPPED_MEAN) { 822 822 stats->clippedMean = clippedMean; 823 psTrace( __func__, 6, "The final clipped mean is %f\n", clippedMean);823 psTrace("psLib.math", 6, "The final clipped mean is %f\n", clippedMean); 824 824 } 825 825 // 8. The last calcuated value of stdev is the clipped stdev. 826 826 if (stats->options & PS_STAT_CLIPPED_STDEV) { 827 827 stats->clippedStdev = clippedStdev; 828 psTrace( __func__, 6, "The final clipped stdev is %f\n", clippedStdev);828 psTrace("psLib.math", 6, "The final clipped stdev is %f\n", clippedStdev); 829 829 } 830 830 831 831 psFree(tmpMask); 832 832 psFree(statsTmp); 833 psTrace( __func__, 4, "---- %s(true) end ----\n", __func__);833 psTrace("psLib.math", 4, "---- %s(true) end ----\n", __func__); 834 834 return true; 835 835 } … … 884 884 ) 885 885 { 886 psTrace( __func__, 4, "---- %s() begin ----\n", __func__);887 psTrace( __func__, 5, "binNum, yVal is (%d, %f)\n", binNum, yVal);886 psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__); 887 psTrace("psLib.math", 5, "binNum, yVal is (%d, %f)\n", binNum, yVal); 888 888 if (psTraceGetLevel(__func__) >= 8) { 889 889 PS_VECTOR_PRINT_F32(xVec); … … 913 913 y->data.F64[1] = yVec->data.F32[binNum]; 914 914 y->data.F64[2] = yVec->data.F32[binNum + 1]; 915 psTrace( __func__, 6, "x vec (orig) is (%f %f %f %f)\n", xVec->data.F32[binNum - 1],915 psTrace("psLib.math", 6, "x vec (orig) is (%f %f %f %f)\n", xVec->data.F32[binNum - 1], 916 916 xVec->data.F32[binNum], xVec->data.F32[binNum+1], xVec->data.F32[binNum+2]); 917 psTrace( __func__, 6, "x data is (%f %f %f)\n", x->data.F64[0], x->data.F64[1], x->data.F64[2]);918 psTrace( __func__, 6, "y data is (%f %f %f)\n", y->data.F64[0], y->data.F64[1], y->data.F64[2]);917 psTrace("psLib.math", 6, "x data is (%f %f %f)\n", x->data.F64[0], x->data.F64[1], x->data.F64[2]); 918 psTrace("psLib.math", 6, "y data is (%f %f %f)\n", y->data.F64[0], y->data.F64[1], y->data.F64[2]); 919 919 920 920 // … … 937 937 psFree(x); 938 938 psFree(y); 939 psTrace( __func__, 5, "---- %s() end ----\n", __func__);939 psTrace("psLib.math", 5, "---- %s() end ----\n", __func__); 940 940 return NAN; 941 941 } … … 949 949 psFree(x); 950 950 psFree(y); 951 psTrace( __func__, 5, "---- %s(NAN) end ----\n", __func__);951 psTrace("psLib.math", 5, "---- %s(NAN) end ----\n", __func__); 952 952 return NAN; 953 953 } 954 psTrace( __func__, 6, "myPoly->coeff[0] is %f\n", myPoly->coeff[0]);955 psTrace( __func__, 6, "myPoly->coeff[1] is %f\n", myPoly->coeff[1]);956 psTrace( __func__, 6, "myPoly->coeff[2] is %f\n", myPoly->coeff[2]);957 psTrace( __func__, 6, "Fitted y vec is (%f %f %f)\n",954 psTrace("psLib.math", 6, "myPoly->coeff[0] is %f\n", myPoly->coeff[0]); 955 psTrace("psLib.math", 6, "myPoly->coeff[1] is %f\n", myPoly->coeff[1]); 956 psTrace("psLib.math", 6, "myPoly->coeff[2] is %f\n", myPoly->coeff[2]); 957 psTrace("psLib.math", 6, "Fitted y vec is (%f %f %f)\n", 958 958 (psF32) psPolynomial1DEval(myPoly, (psF64) x->data.F64[0]), 959 959 (psF32) psPolynomial1DEval(myPoly, (psF64) x->data.F64[1]), 960 960 (psF32) psPolynomial1DEval(myPoly, (psF64) x->data.F64[2])); 961 961 962 psTrace( __func__, 6, "We fit the polynomial, now find x such that f(x) equals %f\n", yVal);962 psTrace("psLib.math", 6, "We fit the polynomial, now find x such that f(x) equals %f\n", yVal); 963 963 tmpFloat = QuadraticInverse(myPoly->coeff[2], myPoly->coeff[1], myPoly->coeff[0], yVal, 964 964 x->data.F64[0], x->data.F64[2]); … … 970 970 psFree(x); 971 971 psFree(y); 972 psTrace( __func__, 5, "---- %s(NAN) end ----\n", __func__);972 psTrace("psLib.math", 5, "---- %s(NAN) end ----\n", __func__); 973 973 return(NAN); 974 974 } … … 990 990 } 991 991 992 psTrace( __func__, 6, "FIT: return %f\n", tmpFloat);992 psTrace("psLib.math", 6, "FIT: return %f\n", tmpFloat); 993 993 psFree(x); 994 994 psFree(y); 995 995 996 psTrace( __func__, 5, "---- %s(%f) end ----\n", __func__, tmpFloat);996 psTrace("psLib.math", 5, "---- %s(%f) end ----\n", __func__, tmpFloat); 997 997 return tmpFloat; 998 998 } … … 1006 1006 ) 1007 1007 { 1008 psTrace( __func__, 4, "---- %s() begin ----\n", __func__);1008 psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__); 1009 1009 PS_ASSERT_VECTOR_NON_NULL(params, NAN); 1010 1010 PS_ASSERT_VECTOR_SIZE(params, 2, NAN); … … 1028 1028 1029 1029 1030 psTrace( __func__, 4, "---- %s() end ----\n", __func__);1030 psTrace("psLib.math", 4, "---- %s() end ----\n", __func__); 1031 1031 return gauss; 1032 1032 } … … 1057 1057 psStats* stats) 1058 1058 { 1059 psTrace( __func__, 4, "---- %s() begin ----\n", __func__);1059 psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__); 1060 1060 if (psTraceGetLevel(__func__) >= 8) { 1061 1061 PS_VECTOR_PRINT_F32(myVector); … … 1085 1085 // Iterate to get the best bin size 1086 1086 for (int iterate = 1; iterate > 0; iterate++) { 1087 psTrace( __func__, 6,1087 psTrace("psLib.math", 6, 1088 1088 "-------------------- Iterating on Bin size. Iteration number %d --------------------\n", 1089 1089 iterate); … … 1098 1098 psFree(statsMinMax); 1099 1099 psFree(mask); 1100 psTrace( __func__, 4, "---- %s(false) end ----\n", __func__);1100 psTrace("psLib.math", 4, "---- %s(false) end ----\n", __func__); 1101 1101 return false; 1102 1102 } 1103 psTrace( __func__, 6, "Data min/max is (%.2f, %.2f)\n", min, max);1103 psTrace("psLib.math", 6, "Data min/max is (%.2f, %.2f)\n", min, max); 1104 1104 1105 1105 // If all data points have the same value, then we set the appropiate members of stats and return. 1106 1106 if (fabs(max - min) <= FLT_EPSILON) { 1107 psTrace( __func__, 5, "All data points have the same value: %f.\n", min);1107 psTrace("psLib.math", 5, "All data points have the same value: %f.\n", min); 1108 1108 if (stats->options & PS_STAT_ROBUST_MEDIAN) { 1109 1109 stats->robustMedian = min; … … 1117 1117 psFree(mask); 1118 1118 1119 psTrace( __func__, 4, "---- %s(0) end ----\n", __func__);1119 psTrace("psLib.math", 4, "---- %s(0) end ----\n", __func__); 1120 1120 return false; 1121 1121 } … … 1125 1125 // Set initial bin size to the specified value. 1126 1126 binSize = stats->binsize; 1127 psTrace( __func__, 6, "Setting initial robust bin size to %.2f\n", binSize);1127 psTrace("psLib.math", 6, "Setting initial robust bin size to %.2f\n", binSize); 1128 1128 } else { 1129 1129 // Determine the bin size of the robust histogram, using the pre-defined number of bins 1130 1130 binSize = (max - min) / INITIAL_NUM_BINS; 1131 1131 } 1132 psTrace( __func__, 6, "Initial robust bin size is %.2f\n", binSize);1132 psTrace("psLib.math", 6, "Initial robust bin size is %.2f\n", binSize); 1133 1133 1134 1134 // ADD step 0: Construct the histogram with the specified bin size. NOTE: we can not specify the bin … … 1136 1136 // we get here, we know that binSize != 0.0. 1137 1137 long numBins = (max - min) / binSize; // Number of bins 1138 psTrace( __func__, 6, "Numbins is %d\n", numBins);1139 psTrace( __func__, 6, "Creating a robust histogram from data range (%.2f - %.2f)\n", min, max);1138 psTrace("psLib.math", 6, "Numbins is %d\n", numBins); 1139 psTrace("psLib.math", 6, "Creating a robust histogram from data range (%.2f - %.2f)\n", min, max); 1140 1140 // Generate the histogram 1141 1141 histogram = psHistogramAlloc(min, max, numBins); … … 1159 1159 // ADD step 2: Find the bin which contains the 50% data point. 1160 1160 totalDataPoints = cumulative->nums->data.F32[numBins - 1]; 1161 psTrace( __func__, 6, "Total data points is %d\n", totalDataPoints);1161 psTrace("psLib.math", 6, "Total data points is %d\n", totalDataPoints); 1162 1162 long binMedian; 1163 1163 if (totalDataPoints/2.0 < cumulative->nums->data.F32[0]) { … … 1175 1175 psFree(cumulative); 1176 1176 psFree(mask); 1177 psTrace( __func__, 4, "---- %s(false) end ----\n", __func__);1177 psTrace("psLib.math", 4, "---- %s(false) end ----\n", __func__); 1178 1178 return false; 1179 1179 } 1180 1180 } 1181 psTrace( __func__, 6, "The median bin is %d (%.2f to %.2f)\n", binMedian,1181 psTrace("psLib.math", 6, "The median bin is %d (%.2f to %.2f)\n", binMedian, 1182 1182 cumulative->bounds->data.F32[binMedian], cumulative->bounds->data.F32[binMedian+1]); 1183 1183 … … 1192 1192 psFree(cumulative); 1193 1193 psFree(mask); 1194 psTrace( __func__, 4, "---- %s(false) end ----\n", __func__);1194 psTrace("psLib.math", 4, "---- %s(false) end ----\n", __func__); 1195 1195 return false; 1196 1196 } 1197 psTrace( __func__, 6, "Current robust median is %f\n", stats->robustMedian);1197 psTrace("psLib.math", 6, "Current robust median is %f\n", stats->robustMedian); 1198 1198 1199 1199 // ADD step 4: Find the bins which contains the 15.8655% and 84.1345% data points. … … 1217 1217 } 1218 1218 } 1219 psTrace( __func__, 6, "The 15.8655%% and 84.1345%% data point bins are (%d, %d).\n",1219 psTrace("psLib.math", 6, "The 15.8655%% and 84.1345%% data point bins are (%d, %d).\n", 1220 1220 binLo, binHi); 1221 psTrace( __func__, 6, "binLo midpoint is %f\n", PS_BIN_MIDPOINT(cumulative, binLo));1222 psTrace( __func__, 6, "binHi midpoint is %f\n", PS_BIN_MIDPOINT(cumulative, binHi));1221 psTrace("psLib.math", 6, "binLo midpoint is %f\n", PS_BIN_MIDPOINT(cumulative, binLo)); 1222 psTrace("psLib.math", 6, "binHi midpoint is %f\n", PS_BIN_MIDPOINT(cumulative, binHi)); 1223 1223 1224 1224 if ((binLo < 0) || (binHi < 0)) { … … 1228 1228 psFree(cumulative); 1229 1229 psFree(mask); 1230 psTrace( __func__, 4, "---- %s(false) end ----\n", __func__);1230 psTrace("psLib.math", 4, "---- %s(false) end ----\n", __func__); 1231 1231 return false; 1232 1232 } … … 1244 1244 float binHiF32 = fitQuadraticSearchForYThenReturnX(cumulative->bounds, cumulative->nums, binHi, 1245 1245 totalDataPoints * 0.841345f); 1246 psTrace( __func__, 6, "The exact 15.8655%% and 84.1345%% data point positions are: (%f, %f)\n",1246 psTrace("psLib.math", 6, "The exact 15.8655%% and 84.1345%% data point positions are: (%f, %f)\n", 1247 1247 binLoF32, binHiF32); 1248 1248 #else 1249 1249 // This code basically interpolates to find the positions exactly. 1250 psTrace( __func__, 6, "binLo is %d. Nums at that bin and the next are (%.2f, %.2f)\n",1250 psTrace("psLib.math", 6, "binLo is %d. Nums at that bin and the next are (%.2f, %.2f)\n", 1251 1251 binLo, cumulative->nums->data.F32[binLo], cumulative->nums->data.F32[binLo+1]); 1252 psTrace( __func__, 6, "binHi is %d. Nums at that bin and the next are (%.2f, %.2f)\n",1252 psTrace("psLib.math", 6, "binHi is %d. Nums at that bin and the next are (%.2f, %.2f)\n", 1253 1253 binHi, cumulative->nums->data.F32[binHi], cumulative->nums->data.F32[binHi+1]); 1254 1254 … … 1266 1266 float base = cumulative->bounds->data.F32[binLo]; 1267 1267 float binLoF32 = base + (deltaBounds / deltaNums) * percentNums; // Value for the 15.8655% mark 1268 psTrace( __func__, 6,1268 psTrace("psLib.math", 6, 1269 1269 "(base, deltaBounds, deltaNums, prevPixels, percentNums) is (%.2f %.2f %.2f %.2f %.2f)\n", 1270 1270 base, deltaBounds, deltaNums, prevPixels, percentNums); … … 1281 1281 base = cumulative->bounds->data.F32[binHi]; 1282 1282 float binHiF32 = base + (deltaBounds / deltaNums) * percentNums; // Value for the 84.1345% mark 1283 psTrace( __func__, 6,1283 psTrace("psLib.math", 6, 1284 1284 "(base, deltaBounds, deltaNums, prevPixels, percentNums) is (%.2f %.2f %.2f %.2f %.2f)\n", 1285 1285 base, deltaBounds, deltaNums, prevPixels, percentNums); 1286 psTrace( __func__, 6,1286 psTrace("psLib.math", 6, 1287 1287 "The exact 15.8655 and 84.1345 percent data point positions are: (%f, %f)\n", 1288 1288 binLoF32, binHiF32); … … 1291 1291 // ADD step 5: Determine SIGMA as 1/2 of the distance between these positions. 1292 1292 sigma = (binHiF32 - binLoF32) / 2.0; 1293 psTrace( __func__, 6, "The current sigma is %f.\n", sigma);1293 psTrace("psLib.math", 6, "The current sigma is %f.\n", sigma); 1294 1294 stats->robustStdev = sigma; 1295 1295 … … 1297 1297 // than 25 bins from the median, recalculate the bin size, and perform the algorithm again. 1298 1298 if (sigma < (2 * binSize)) { 1299 psTrace( __func__, 6, "*************: Do another iteration (%f %f).\n", sigma, binSize);1299 psTrace("psLib.math", 6, "*************: Do another iteration (%f %f).\n", sigma, binSize); 1300 1300 long maskLo = PS_MAX(0, (binMedian - 25)); // Low index for masking region 1301 1301 long maskHi = PS_MIN(histogram->bounds->n - 1, (binMedian + 25)); // High index for masking 1302 1302 psF32 medianLo = histogram->bounds->data.F32[maskLo]; // Value at low index 1303 1303 psF32 medianHi = histogram->bounds->data.F32[maskHi]; // Value at high index 1304 psTrace( __func__, 6, "Masking data more than 25 bins from the median\n");1305 psTrace( __func__, 6,1304 psTrace("psLib.math", 6, "Masking data more than 25 bins from the median\n"); 1305 psTrace("psLib.math", 6, 1306 1306 "The median is at bin number %d. We mask bins outside the bin range (%d:%d)\n", 1307 1307 binMedian, maskLo, maskHi); 1308 psTrace( __func__, 6, "Masking data outside (%f %f)\n", medianLo, medianHi);1308 psTrace("psLib.math", 6, "Masking data outside (%f %f)\n", medianLo, medianHi); 1309 1309 for (long i = 0 ; i < myVector->n ; i++) { 1310 1310 if ((myVector->data.F32[i] < medianLo) || (myVector->data.F32[i] > medianHi)) { 1311 1311 mask->data.U8[i] = 0xff; 1312 psTrace( __func__, 6, "Masking element %d is %f\n", i, myVector->data.F32[i]);1312 psTrace("psLib.math", 6, "Masking element %d is %f\n", i, myVector->data.F32[i]); 1313 1313 } 1314 1314 } … … 1318 1318 } else { 1319 1319 // We've got the bin size correct now 1320 psTrace( __func__, 6, "*************: No more iteration. sigma is %f\n", sigma);1320 psTrace("psLib.math", 6, "*************: No more iteration. sigma is %f\n", sigma); 1321 1321 iterate = -1; 1322 1322 } … … 1347 1347 psFree(cumulative); 1348 1348 psFree(mask); 1349 psTrace( __func__, 4, "---- %s(false) end ----\n", __func__);1349 psTrace("psLib.math", 4, "---- %s(false) end ----\n", __func__); 1350 1350 return false; 1351 1351 } 1352 psTrace( __func__, 6, "The 25-percent and 75-precent data point bins are (%d, %d).\n", binLo25, binHi25);1352 psTrace("psLib.math", 6, "The 25-percent and 75-precent data point bins are (%d, %d).\n", binLo25, binHi25); 1353 1353 1354 1354 // ADD step 8: Interpolate to find these two positions exactly: these are the upper and lower quartile … … 1365 1365 psFree(statsMinMax); 1366 1366 psFree(mask); 1367 psTrace( __func__, 4, "---- %s(1) end ----\n", __func__);1367 psTrace("psLib.math", 4, "---- %s(1) end ----\n", __func__); 1368 1368 return false; 1369 1369 } … … 1371 1371 stats->robustLQ = binLo25F32; 1372 1372 stats->robustUQ = binHi25F32; 1373 psTrace( __func__, 6, "The 25 and 75 percent data point exact positions are (%f, %f).\n",1373 psTrace("psLib.math", 6, "The 25 and 75 percent data point exact positions are (%f, %f).\n", 1374 1374 binLo25F32, binHi25F32); 1375 1375 long N50 = 0; … … 1381 1381 } 1382 1382 stats->robustN50 = N50; 1383 psTrace( __func__, 6, "The robustN50 is %d.\n", N50);1383 psTrace("psLib.math", 6, "The robustN50 is %d.\n", N50); 1384 1384 1385 1385 … … 1405 1405 psFree(statsMinMax); 1406 1406 psFree(mask); 1407 psTrace( __func__, 4, "---- %s(false) end ----\n", __func__);1407 psTrace("psLib.math", 4, "---- %s(false) end ----\n", __func__); 1408 1408 return false; 1409 1409 } … … 1411 1411 // Calculate the number of bins. 1412 1412 long numBins = (max - min) / newBinSize; 1413 psTrace( __func__, 6, "The new min/max values are (%f, %f).\n", min, max);1414 psTrace( __func__, 6, "The new bin size is %f.\n", newBinSize);1415 psTrace( __func__, 6, "The numBins is %d\n", numBins);1413 psTrace("psLib.math", 6, "The new min/max values are (%f, %f).\n", min, max); 1414 psTrace("psLib.math", 6, "The new bin size is %f.\n", newBinSize); 1415 psTrace("psLib.math", 6, "The numBins is %d\n", numBins); 1416 1416 1417 1417 psHistogram *histogram = psHistogramAlloc(min, max, numBins); // A new histogram (without outliers) … … 1448 1448 psFree(histogram); 1449 1449 psFree(mask); 1450 psTrace( __func__, 4, "---- %s(false) end ----\n", __func__);1450 psTrace("psLib.math", 4, "---- %s(false) end ----\n", __func__); 1451 1451 return false; 1452 1452 } … … 1460 1460 } 1461 1461 } 1462 psTrace( __func__, 6, "The peak bin is %d, with %f data.n", binNum, binMaxNums);1462 psTrace("psLib.math", 6, "The peak bin is %d, with %f data.n", binNum, binMaxNums); 1463 1463 1464 1464 // Fit a Gaussian to the bins in the range 20 sigma of the robust histogram median. … … 1480 1480 psFree(histogram); 1481 1481 psFree(mask); 1482 psTrace( __func__, 4, "---- %s(false) end ----\n", __func__);1482 psTrace("psLib.math", 4, "---- %s(false) end ----\n", __func__); 1483 1483 return false; 1484 1484 } … … 1511 1511 psFree(histogram); 1512 1512 psFree(statsMinMax); 1513 psTrace( __func__, 4, "---- %s(false) end ----\n", __func__);1513 psTrace("psLib.math", 4, "---- %s(false) end ----\n", __func__); 1514 1514 return false; 1515 1515 } … … 1537 1537 psFree(params); 1538 1538 psFree(mask); 1539 psTrace( __func__, 4, "---- %s(false) end ----\n", __func__);1539 psTrace("psLib.math", 4, "---- %s(false) end ----\n", __func__); 1540 1540 return false; 1541 1541 } … … 1546 1546 // The fitted mean is the Gaussian mean. 1547 1547 stats->fittedMean = params->data.F32[0]; 1548 psTrace( __func__, 6, "The fitted mean is %f.\n", params->data.F32[0]);1548 psTrace("psLib.math", 6, "The fitted mean is %f.\n", params->data.F32[0]); 1549 1549 1550 1550 // The fitted standard deviation, SIGMA_r is determined by subtracting the smoothing scale in 1551 1551 // quadrature: SIGMA_r^2 = SIGMA^2 - sigma_s^2 1552 1552 stats->fittedStdev = sqrt(PS_SQR(params->data.F32[1]) - PS_SQR(newBinSize)); 1553 psTrace( __func__, 6, "The fitted stdev is %f.\n", stats->fittedStdev);1553 psTrace("psLib.math", 6, "The fitted stdev is %f.\n", stats->fittedStdev); 1554 1554 1555 1555 // Clean up after fitting … … 1564 1564 psFree(mask); 1565 1565 1566 psTrace( __func__, 4, "---- %s(0) end ----\n", __func__);1566 psTrace("psLib.math", 4, "---- %s(0) end ----\n", __func__); 1567 1567 return true; 1568 1568 } … … 1587 1587 psStats* psStatsAlloc(psStatsOptions options) 1588 1588 { 1589 psTrace( __func__, 3,"---- %s() begin ----\n", __func__);1589 psTrace("psLib.math", 3,"---- %s() begin ----\n", __func__); 1590 1590 psStats* newStruct = NULL; 1591 1591 … … 1616 1616 newStruct->options = options; 1617 1617 1618 psTrace( __func__, 3, "---- %s() end ----\n", __func__);1618 psTrace("psLib.math", 3, "---- %s() end ----\n", __func__); 1619 1619 return (newStruct); 1620 1620 } … … 1645 1645 psHistogram* psHistogramAlloc(float lower, float upper, int n) 1646 1646 { 1647 psTrace( __func__, 3, "---- %s() begin ----\n", __func__);1648 psTrace( __func__, 5, "(lower, upper, n) is (%f, %f, %d)\n", lower, upper, n);1647 psTrace("psLib.math", 3, "---- %s() begin ----\n", __func__); 1648 psTrace("psLib.math", 5, "(lower, upper, n) is (%f, %f, %d)\n", lower, upper, n); 1649 1649 PS_ASSERT_INT_POSITIVE(n, NULL); 1650 1650 PS_ASSERT_FLOAT_LARGER_THAN_OR_EQUAL(upper, lower, NULL); … … 1678 1678 newHist->uniform = true; 1679 1679 1680 psTrace( __func__, 3, "---- %s() end ----\n", __func__);1680 psTrace("psLib.math", 3, "---- %s() end ----\n", __func__); 1681 1681 return newHist; 1682 1682 } … … 1693 1693 psHistogram* psHistogramAllocGeneric(const psVector* bounds) 1694 1694 { 1695 psTrace( __func__, 3, "---- %s() begin ----\n", __func__);1695 psTrace("psLib.math", 3, "---- %s() begin ----\n", __func__); 1696 1696 PS_ASSERT_VECTOR_NON_NULL(bounds, NULL); 1697 1697 PS_ASSERT_VECTOR_TYPE(bounds, PS_TYPE_F32, NULL); … … 1721 1721 newHist->uniform = false; 1722 1722 1723 psTrace( __func__, 3, "---- %s() end ----\n", __func__);1723 psTrace("psLib.math", 3, "---- %s() end ----\n", __func__); 1724 1724 return (newHist); 1725 1725 } … … 1757 1757 ) 1758 1758 { 1759 psTrace( __func__, 3, "---- %s() begin ----\n", __func__);1759 psTrace("psLib.math", 3, "---- %s() begin ----\n", __func__); 1760 1760 PS_ASSERT_PTR_NON_NULL(out, false); 1761 1761 PS_ASSERT_PTR_NON_NULL(out->bounds, false); … … 1794 1794 if (boxcarLeftBinNum == boxcarRightBinNum) { 1795 1795 out->nums->data.F32[binNum] += 1.0; 1796 psTrace( __func__, 3, "---- %s(true) end ----\n", __func__);1796 psTrace("psLib.math", 3, "---- %s(true) end ----\n", __func__); 1797 1797 return true; 1798 1798 } … … 1813 1813 (boxcarRight - out->bounds->data.F32[boxcarRightBinNum]) / boxcarWidth; 1814 1814 1815 psTrace( __func__, 3, "---- %s(true) end ----\n", __func__);1815 psTrace("psLib.math", 3, "---- %s(true) end ----\n", __func__); 1816 1816 return true; 1817 1817 } … … 1838 1838 psMaskType maskVal) 1839 1839 { 1840 psTrace( __func__, 3, "---- %s() begin ----\n", __func__);1840 psTrace("psLib.math", 3, "---- %s() begin ----\n", __func__); 1841 1841 PS_ASSERT_PTR_NON_NULL(out, NULL); 1842 1842 PS_ASSERT_VECTOR_NON_NULL(out->bounds, NULL); … … 1933 1933 psFree(errorsF32); 1934 1934 1935 psTrace( __func__, 3, "---- %s() end ----\n", __func__);1935 psTrace("psLib.math", 3, "---- %s() end ----\n", __func__); 1936 1936 return (out); 1937 1937 } … … 1959 1959 psMaskType maskVal) 1960 1960 { 1961 psTrace( __func__, 3,"---- %s() begin ----\n", __func__);1961 psTrace("psLib.math", 3,"---- %s() begin ----\n", __func__); 1962 1962 PS_ASSERT_PTR_NON_NULL(stats, NULL); 1963 1963 PS_ASSERT_VECTOR_NON_NULL(in, NULL); … … 2039 2039 psFree(inF32); 2040 2040 psFree(errorsF32); 2041 psTrace( __func__, 3,"---- %s(NULL) end ----\n", __func__);2041 psTrace("psLib.math", 3,"---- %s(NULL) end ----\n", __func__); 2042 2042 return(NULL); 2043 2043 } … … 2063 2063 psFree(errorsF32); 2064 2064 psFree(maskU8); 2065 psTrace( __func__, 3,"---- %s() end ----\n", __func__);2065 psTrace("psLib.math", 3,"---- %s() end ----\n", __func__); 2066 2066 return (stats); 2067 2067 } -
trunk/psLib/src/sys/psLogMsg.c
r8232 r8245 11 11 * @author GLG, MHPCC 12 12 * 13 * @version $Revision: 1.6 0$ $Name: not supported by cvs2svn $14 * @date $Date: 2006-08-0 8 23:32:23$13 * @version $Revision: 1.61 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2006-08-09 02:26:44 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 172 172 // XXX: If one must at least log error messages, why don't we set logMsg = true here? 173 173 if (!logMsg) { 174 psTrace(" utils.logMsg", 1, "You must at least log error messages (You chose \"%s\")", format);174 psTrace("psLib.sys", 1, "You must at least log error messages (You chose \"%s\")", format); 175 175 176 176 } … … 293 293 294 294 default: 295 psTrace(" utils.logMsg", 2, "Invalid logMsg level: %d (%s)\n", level, format);295 psTrace("psLib.sys", 2, "Invalid logMsg level: %d (%s)\n", level, format); 296 296 level = (level < 0) ? 0 : 9; 297 297 clevel = level + '0'; -
trunk/psLib/src/sys/psTrace.c
r8244 r8245 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.6 6$ $Name: not supported by cvs2svn $12 * @date $Date: 2006-08-09 02: 01:02$11 * @version $Revision: 1.67 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2006-08-09 02:26:44 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 525 525 clevel = level + '0'; 526 526 } else { 527 psTrace(" utils.logMsg", 2, "Invalid logMsg level: %d (%s)\n", level, format);527 psTrace("psLib.sys", 2, "Invalid logMsg level: %d (%s)\n", level, format); 528 528 level = (level < 0) ? 0 : 9; 529 529 clevel = level + '0'; … … 721 721 // XXX: If one must at least log error messages, why don't we set logMsg = true here? 722 722 if (!traceMsg) { 723 psTrace(" utils.traceMsg", 1,723 psTrace("psLib.sys", 1, 724 724 "You must at least trace error messages (You chose \"%s\")", format); 725 725 -
trunk/psLib/src/types/psArguments.c
r8232 r8245 7 7 * @author David Robbins, MHPCC 8 8 * 9 * @version $Revision: 1. 9$ $Name: not supported by cvs2svn $10 * @date $Date: 2006-08-0 8 23:32:23$9 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2006-08-09 02:26:44 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 156 156 157 157 for (int i = 1; i < *argc; i++) { 158 psTrace( __func__, 7, "Looking at %s\n", argv[i]);158 psTrace("psLib.types", 7, "Looking at %s\n", argv[i]); 159 159 psMetadataItem *argItem = psMetadataLookup(arguments, argv[i]); 160 160 if (argItem) { -
trunk/psLib/src/types/psHash.c
r8232 r8245 12 12 * @author GLG, MHPCC 13 13 * 14 * @version $Revision: 1.2 7$ $Name: not supported by cvs2svn $15 * @date $Date: 2006-08-0 8 23:32:23$14 * @version $Revision: 1.28 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2006-08-09 02:26:44 $ 16 16 * 17 17 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 148 148 table->n = nalloc; 149 149 150 psTrace(" utils.hash", 1, "Creating %d-element hash table\n", nalloc);150 psTrace("psLib.types", 1, "Creating %d-element hash table\n", nalloc); 151 151 152 152 // Initialize all buckets to NULL. … … 321 321 // We have found this key in the hash table. 322 322 323 psTrace(" utils.hash.insert", 3, "Replacing data for %s\n", key);323 psTrace("psLib.types", 3, "Replacing data for %s\n", key); 324 324 325 325 // NOTE: I have changed this behavior from the originally -
trunk/psLib/src/types/psMetadata.c
r8232 r8245 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1.12 1$ $Name: not supported by cvs2svn $15 * @date $Date: 2006-08-0 8 23:32:23$14 * @version $Revision: 1.122 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2006-08-09 02:26:44 $ 16 16 * 17 17 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 445 445 unsigned int flag = PS_META_REPLACE; // Flag to indicate MULTI; otherwise, replace 446 446 if (multiCheckItem->type == PS_DATA_METADATA_MULTI) { 447 psTrace( __func__, 10, "MULTI: %s (%s)\n", inItem->name, inItem->comment);447 psTrace("psLib.types", 10, "MULTI: %s (%s)\n", inItem->name, inItem->comment); 448 448 flag = PS_META_DUPLICATE_OK; 449 449 } 450 psTrace( __func__, 5, "Copying %s (%s)...\n", inItem->name, inItem->comment);450 psTrace("psLib.types", 5, "Copying %s (%s)...\n", inItem->name, inItem->comment); 451 451 452 452 // Copy the item and add it on -
trunk/psLib/src/types/psMetadataItemCompare.c
r8224 r8245 67 67 return false; 68 68 } 69 psTrace( __func__, 10, "Comparing '%s' with '%s'\n", compare->data.V, template->69 psTrace("psLib.types", 10, "Comparing '%s' with '%s'\n", compare->data.V, template-> 70 70 data.V); 71 71 return (strcasecmp(compare->data.V, template->
Note:
See TracChangeset
for help on using the changeset viewer.
