Changeset 8627 for trunk/psLib/src/math
- Timestamp:
- Aug 25, 2006, 6:34:28 PM (20 years ago)
- Location:
- trunk/psLib/src/math
- Files:
-
- 10 edited
-
psBinaryOp.c (modified) (8 diffs)
-
psMathUtils.c (modified) (5 diffs)
-
psMatrix.c (modified) (5 diffs)
-
psMinimizeLMM.c (modified) (5 diffs)
-
psMinimizePolyFit.c (modified) (9 diffs)
-
psPolynomialUtils.c (modified) (1 diff)
-
psSparse.c (modified) (1 diff)
-
psSpline.c (modified) (2 diffs)
-
psStats.c (modified) (22 diffs)
-
psUnaryOp.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/math/psBinaryOp.c
r8232 r8627 30 30 * @author Robert DeSonia, MHPCC 31 31 * 32 * @version $Revision: 1. 9$ $Name: not supported by cvs2svn $33 * @date $Date: 2006-08- 08 23:32:23$32 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $ 33 * @date $Date: 2006-08-26 04:34:28 $ 34 34 * 35 35 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 107 107 long n2 = ((psVector*)IN2)->n; \ 108 108 if (n1 != n2) { \ 109 psError(PS_ERR_BAD_PARAMETER_SIZE, true, _("Number of elements inconsistent, % d vs %d. Number of elements must match."), n1, n2); \109 psError(PS_ERR_BAD_PARAMETER_SIZE, true, _("Number of elements inconsistent, %ld vs %ld. Number of elements must match."), n1, n2); \ 110 110 if (OUT != IN1 && OUT != IN2) { \ 111 111 psFree(OUT); \ … … 129 129 if (((psVector*)IN1)->type.dimen == PS_DIMEN_VECTOR) { /* Regular vectors */ \ 130 130 if (n1 != numRows2) { \ 131 psError(PS_ERR_BAD_PARAMETER_SIZE, true, _("Number of elements inconsistent, % d vs %d. Number of elements must match."), n1, numRows2); \131 psError(PS_ERR_BAD_PARAMETER_SIZE, true, _("Number of elements inconsistent, %ld vs %ld. Number of elements must match."), n1, numRows2); \ 132 132 if (OUT != IN1 && OUT != IN2) { \ 133 133 psFree(OUT); \ … … 146 146 } else { /* Transposed vectors */ \ 147 147 if (n1 != numCols2) { \ 148 psError(PS_ERR_BAD_PARAMETER_SIZE, true, _("Number of elements inconsistent, % d vs %d. Number of elements must match."), n1, numCols2); \148 psError(PS_ERR_BAD_PARAMETER_SIZE, true, _("Number of elements inconsistent, %ld vs %ld. Number of elements must match."), n1, numCols2); \ 149 149 if (OUT != IN1 && OUT != IN2) { \ 150 150 psFree(OUT); \ … … 187 187 if (((psVector*)IN2)->type.dimen == PS_DIMEN_VECTOR) { /* Regular vectors */ \ 188 188 if (n2 != numRows1) { \ 189 psError(PS_ERR_BAD_PARAMETER_SIZE, true, _("Number of elements inconsistent, % d vs %d. Number of elements must match."), n2, numRows1); \189 psError(PS_ERR_BAD_PARAMETER_SIZE, true, _("Number of elements inconsistent, %ld vs %ld. Number of elements must match."), n2, numRows1); \ 190 190 if (OUT != IN1 && OUT != IN2) { \ 191 191 psFree(OUT); \ … … 204 204 } else { /* Transposed vectors */ \ 205 205 if (n2 != numCols1) { \ 206 psError(PS_ERR_BAD_PARAMETER_SIZE, true, _("Number of elements inconsistent, % d vs %d. Number of elements must match."), n2, numCols1); \206 psError(PS_ERR_BAD_PARAMETER_SIZE, true, _("Number of elements inconsistent, %ld vs %ld. Number of elements must match."), n2, numCols1); \ 207 207 if (OUT != IN1) { \ 208 208 psFree(OUT); \ … … 229 229 long numCols2 = ((psImage*)IN2)->numCols; \ 230 230 if (numRows1 != numRows2 || numCols1 != numCols2) { \ 231 psError(PS_ERR_BAD_PARAMETER_SIZE, true, _("Specified psImage dimensions differed, % dx%d vs %dx%d."), \231 psError(PS_ERR_BAD_PARAMETER_SIZE, true, _("Specified psImage dimensions differed, %ldx%ld vs %ldx%ld."), \ 232 232 numCols1, numRows1, numCols2, numRows2); \ 233 233 if (OUT != IN1 && OUT != IN2) { \ … … 360 360 } else { \ 361 361 psError(PS_ERR_BAD_PARAMETER_VALUE, true, \ 362 "Types (%x,%x) are not appropriate for logical OR.\n", IN1->type, IN2->type); \362 "Types (%x,%x) are not appropriate for logical OR.\n", IN1->type, IN2->type); \ 363 363 return NULL; \ 364 364 } \ -
trunk/psLib/src/math/psMathUtils.c
r8245 r8627 3 3 * This file contains standard math routines. 4 4 * 5 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $6 * @date $Date: 2006-08- 09 02:26:44$5 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2006-08-26 04:34:28 $ 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("psLib.math", 4, "---- %s() begin ----\n", __func__); \60 psTrace("psLib.math", 4, "---- () begin ----\n"); \ 61 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, \ 64 64 "vectorBinDisect%s(): ordinate %f is outside vector range (%f - %f).", \ 65 #TYPE, value, bounds[0],bounds[numBins-1]); \65 #TYPE, (double)value, (double)bounds[0], (double)bounds[numBins-1]); \ 66 66 return(-2); \ 67 67 } \ … … 69 69 psLogMsg(__func__, PS_LOG_WARN, \ 70 70 "vectorBinDisect%s(): ordinate %f is outside vector range (%f - %f).", \ 71 #TYPE, value, bounds[0],bounds[numBins-1]); \71 #TYPE, (double)value, (double)bounds[0], (double)bounds[numBins-1]); \ 72 72 return(-1); \ 73 73 } \ … … 79 79 \ 80 80 if (value == bounds[mid]) { \ 81 psTrace("psLib.math", 4, "---- %s(% d) end (1) ----\n", __func__, mid); \81 psTrace("psLib.math", 4, "---- %s(%ld) 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("psLib.math", 4, "---- %s(% d) end (2) ----\n", __func__, min); \90 psTrace("psLib.math", 4, "---- %s(%ld) end (2) ----\n", __func__, min); \ 91 91 return(min); \ 92 92 } -
trunk/psLib/src/math/psMatrix.c
r8245 r8627 21 21 * @author Robert DeSonia, MHPCC 22 22 * 23 * @version $Revision: 1.4 2$ $Name: not supported by cvs2svn $24 * @date $Date: 2006-08- 09 02:26:44$23 * @version $Revision: 1.43 $ $Name: not supported by cvs2svn $ 24 * @date $Date: 2006-08-26 04:34:28 $ 25 25 * 26 26 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 675 675 if (outVector->n != inImage->numRows) { 676 676 psError(PS_ERR_BAD_PARAMETER_SIZE, true, 677 "Image and vector sizes differ: (%d vs % d).",677 "Image and vector sizes differ: (%d vs %ld).", 678 678 inImage->numRows, outVector->n); 679 679 psMatrixToVector_EXIT; … … 691 691 if (outVector->n != inImage->numCols) { 692 692 psError(PS_ERR_BAD_PARAMETER_SIZE, true, 693 "Image and vector sizes differ: (%d vs % d).",693 "Image and vector sizes differ: (%d vs %ld).", 694 694 inImage->numCols, outVector->n); 695 695 psMatrixToVector_EXIT; … … 727 727 } else if (outImage->numRows != inVector->n) { 728 728 psError(PS_ERR_BAD_PARAMETER_SIZE, true, 729 "Image and vector sizes differ: (%d vs % d).",729 "Image and vector sizes differ: (%d vs %ld).", 730 730 outImage->numRows, inVector->n); 731 731 VECTORTOMATRIX_CLEANUP; … … 746 746 } else if (outImage->numCols != inVector->n) { 747 747 psError(PS_ERR_BAD_PARAMETER_SIZE, true, 748 "Image and vector sizes differ: (%d vs % d).",748 "Image and vector sizes differ: (%d vs %ld).", 749 749 outImage->numCols, inVector->n); 750 750 VECTORTOMATRIX_CLEANUP; -
trunk/psLib/src/math/psMinimizeLMM.c
r8245 r8627 10 10 * @author EAM, IfA 11 11 * 12 * @version $Revision: 1. 19$ $Name: not supported by cvs2svn $13 * @date $Date: 2006-08- 09 02:26:44$12 * @version $Revision: 1.20 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2006-08-26 04:34:28 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 181 181 psF64 rcF64 = p_psMinLM_SetABX(alpha, beta, params, paramMask, x, y, dy, func); 182 182 if (isnan(rcF64)) { 183 psTrace ( __func__, 5, "p_psMinLM_SetABX() returned a NAN.\n");183 psTrace ("psLib.math", 5, "p_psMinLM_SetABX() returned a NAN.\n"); 184 184 rc = false; 185 185 } 186 psTrace("psLib.math", 5, "p_psMinLM_SetABX() was succesful\n" , __func__);186 psTrace("psLib.math", 5, "p_psMinLM_SetABX() was succesful\n"); 187 187 188 188 psBool rcBool = p_psMinLM_GuessABP(Alpha, delta, Params, alpha, beta, params, paramMask, NULL, NULL, NULL, 0.0); 189 189 if (rcBool == false) { 190 psTrace ( __func__, 5, "p_psMinLM_GuessABP() returned FALSE.\n");190 psTrace ("psLib.math", 5, "p_psMinLM_GuessABP() returned FALSE.\n"); 191 191 rc = false; 192 192 } 193 psTrace("psLib.math", 5, "p_psMinLM_GuessABP() was succesful\n" , __func__);193 psTrace("psLib.math", 5, "p_psMinLM_GuessABP() was succesful\n"); 194 194 195 195 psFree(alpha); … … 200 200 psFree(dy); 201 201 } 202 psTrace("psLib.math", 3, "---- %s() end ----\n", __func__);202 psTrace("psLib.math", 3, "---- end ----\n"); 203 203 return(rc); 204 204 } … … 417 417 psTrace("psLib.math", 6, "The current Param vector: \n"); 418 418 for (psS32 i = 0 ; i < Params->n ; i++) { 419 psTrace("psLib.math", 6, "Params[%d] is %f\n", Params->data.F32[i]);419 psTrace("psLib.math", 6, "Params[%d] is %f\n", i, Params->data.F32[i]); 420 420 } 421 421 } … … 447 447 psTrace("psLib.math", 6, "The current Param vector: \n"); 448 448 for (psS32 i = 0 ; i < Params->n ; i++) { 449 psTrace("psLib.math", 6, "Params[%d] is %f\n", Params->data.F32[i]);449 psTrace("psLib.math", 6, "Params[%d] is %f\n", i, Params->data.F32[i]); 450 450 } 451 451 } -
trunk/psLib/src/math/psMinimizePolyFit.c
r8467 r8627 10 10 * @author EAM, IfA 11 11 * 12 * @version $Revision: 1. 19$ $Name: not supported by cvs2svn $13 * @date $Date: 2006-08-2 2 15:01:12$12 * @version $Revision: 1.20 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2006-08-26 04:34:28 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 816 816 // 817 817 for (psS32 N = 0; N < stats->clipIter; N++) { 818 psTrace("psLib.math", 6, "Loop iteration %d. Calling psVectorFitPolynomial1D()\n" );818 psTrace("psLib.math", 6, "Loop iteration %d. Calling psVectorFitPolynomial1D()\n", N); 819 819 psS32 Nkeep = 0; 820 820 if (psTraceGetLevel(__func__) >= 6) { … … 894 894 // since the polynomial fit won't change. 895 895 // 896 psTrace("psLib.math", 6, "keeping %d of % d pts for fit\n", Nkeep, x->n);896 psTrace("psLib.math", 6, "keeping %d of %ld pts for fit\n", Nkeep, x->n); 897 897 psFree(fit); 898 898 } … … 1250 1250 1251 1251 for (psS32 N = 0; N < stats->clipIter; N++) { 1252 psTrace("psLib.math", 6, "Loop iteration %d. Calling psVectorFitPolynomial1D()\n" );1252 psTrace("psLib.math", 6, "Loop iteration %d. Calling psVectorFitPolynomial1D()\n", N); 1253 1253 psS32 Nkeep = 0; 1254 1254 if (psTraceGetLevel(__func__) >= 6) { … … 1331 1331 } 1332 1332 1333 psTrace("psLib.math", 6, "keeping %d of % d pts for fit\n", Nkeep, x->n);1333 psTrace("psLib.math", 6, "keeping %d of %ld pts for fit\n", Nkeep, x->n); 1334 1334 psFree(fit); 1335 1335 } … … 1770 1770 1771 1771 for (psS32 N = 0; N < stats->clipIter; N++) { 1772 psTrace("psLib.math", 6, "Loop iteration %d. Calling psVectorFitPolynomial1D()\n" );1772 psTrace("psLib.math", 6, "Loop iteration %d. Calling psVectorFitPolynomial1D()\n", N); 1773 1773 psS32 Nkeep = 0; 1774 1774 if (psTraceGetLevel(__func__) >= 6) { … … 1851 1851 } 1852 1852 1853 psTrace("psLib.math", 6, "keeping %d of % d pts for fit\n", Nkeep, x->n);1853 psTrace("psLib.math", 6, "keeping %d of %ld pts for fit\n", Nkeep, x->n); 1854 1854 psFree(fit); 1855 1855 } … … 2338 2338 2339 2339 for (psS32 N = 0; N < stats->clipIter; N++) { 2340 psTrace("psLib.math", 6, "Loop iteration %d. Calling psVectorFitPolynomial4D()\n" );2340 psTrace("psLib.math", 6, "Loop iteration %d. Calling psVectorFitPolynomial4D()\n", N); 2341 2341 psS32 Nkeep = 0; 2342 2342 if (psTraceGetLevel(__func__) >= 6) { … … 2420 2420 } 2421 2421 2422 psTrace("psLib.math", 6, "keeping %d of % d pts for fit\n", Nkeep, x->n);2422 psTrace("psLib.math", 6, "keeping %d of %ld pts for fit\n", Nkeep, x->n); 2423 2423 psFree (fit); 2424 2424 } -
trunk/psLib/src/math/psPolynomialUtils.c
r7766 r8627 105 105 } 106 106 107 psTrace (__func__, 4, "keeping %d of % d pts for fit\n",107 psTrace (__func__, 4, "keeping %d of %ld pts for fit\n", 108 108 Nkeep, x->n); 109 109 -
trunk/psLib/src/math/psSparse.c
r7766 r8627 62 62 63 63 if (i < j) { 64 psLogMsg(__func__, PS_LOG_WARN, "i=% ld, j=%ld refers to a sub-diagonal element; values switched.\n");64 psLogMsg(__func__, PS_LOG_WARN, "i=%d, j=%d refers to a sub-diagonal element; values switched.\n", i, j); 65 65 int temp = i; 66 66 i = j; -
trunk/psLib/src/math/psSpline.c
r8245 r8627 6 6 * This file contains the routines that allocate, free, and evaluate splines. 7 7 * 8 * @version $Revision: 1.15 2$ $Name: not supported by cvs2svn $9 * @date $Date: 2006-08- 09 02:26:44$8 * @version $Revision: 1.153 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2006-08-26 04:34:28 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 213 213 PS_ASSERT_VECTOR_NON_NULL(y, NULL); 214 214 PS_ASSERT_VECTOR_TYPE_F32_OR_F64(y, NULL); 215 PS_ASSERT_ INT_LARGER_THAN_OR_EQUAL(y->n,2, NULL);215 PS_ASSERT_LONG_LARGER_THAN_OR_EQUAL(y->n, (long)2, NULL); 216 216 psS32 numSplines = (y->n)-1; 217 217 psTrace("psLib.math", 5, "numSplines is %d\n", numSplines); -
trunk/psLib/src/math/psStats.c
r8245 r8627 16 16 * use ->min and ->max (PS_STAT_USE_RANGE) 17 17 * 18 * @version $Revision: 1.18 4$ $Name: not supported by cvs2svn $19 * @date $Date: 2006-08- 09 02:26:44$18 * @version $Revision: 1.185 $ $Name: not supported by cvs2svn $ 19 * @date $Date: 2006-08-26 04:34:28 $ 20 20 * 21 21 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 665 665 if (count == 0) { 666 666 stats->sampleStdev = NAN; 667 psLogMsg(__func__, PS_LOG_WARN, "WARNING: vectorSampleStdev(): no valid psVector elements (% d). Setting stats->sampleStdev = NAN.\n", count);667 psLogMsg(__func__, PS_LOG_WARN, "WARNING: vectorSampleStdev(): no valid psVector elements (%ld). Setting stats->sampleStdev = NAN.\n", count); 668 668 return false; 669 669 } 670 670 if (count == 1) { 671 671 stats->sampleStdev = 0.0; 672 psLogMsg(__func__, PS_LOG_WARN, "WARNING: vectorSampleStdev(): only one valid psVector elements (% d). Setting stats->sampleStdev = 0.0.\n", count);672 psLogMsg(__func__, PS_LOG_WARN, "WARNING: vectorSampleStdev(): only one valid psVector elements (%ld). Setting stats->sampleStdev = 0.0.\n", count); 673 673 return false; 674 674 } … … 713 713 714 714 // Ensure that stats->clipSigma is within the proper range. 715 PS_ASSERT_ INT_WITHIN_RANGE(stats->clipSigma,716 PS_CLIPPED_SIGMA_LB,717 PS_CLIPPED_SIGMA_UB, -1);715 PS_ASSERT_FLOAT_WITHIN_RANGE(stats->clipSigma, 716 PS_CLIPPED_SIGMA_LB, 717 PS_CLIPPED_SIGMA_UB, -1); 718 718 719 719 // Allocate a psStats structure for calculating the mean, median, and … … 777 777 fabsf(myVector->data.F32[j] - clippedMean) > stats->clipSigma * errors->data.F32[j]) { 778 778 tmpMask->data.U8[j] = 0xff; 779 psTrace("psLib.math", 10, "Clipped % d: %f +/- %f\n", j,779 psTrace("psLib.math", 10, "Clipped %ld: %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("psLib.math", 10, "Clipped % d: %f\n", j, myVector->data.F32[j]);790 psTrace("psLib.math", 10, "Clipped %ld: %f\n", j, myVector->data.F32[j]); 791 791 numClipped++; 792 792 clipped = true; … … 896 896 PS_ASSERT_VECTOR_TYPE(yVec, PS_TYPE_F32, NAN); 897 897 // PS_ASSERT_VECTORS_SIZE_EQUAL(xVec, yVec, NAN); 898 PS_ASSERT_INT_WITHIN_RANGE(binNum, 0, ( xVec->n - 1), NAN);899 PS_ASSERT_INT_WITHIN_RANGE(binNum, 0, ( yVec->n - 1), NAN);898 PS_ASSERT_INT_WITHIN_RANGE(binNum, 0, (int)(xVec->n - 1), NAN); 899 PS_ASSERT_INT_WITHIN_RANGE(binNum, 0, (int)(yVec->n - 1), NAN); 900 900 901 901 psVector *x = psVectorAlloc(3, PS_TYPE_F64); … … 1008 1008 psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__); 1009 1009 PS_ASSERT_VECTOR_NON_NULL(params, NAN); 1010 PS_ASSERT_VECTOR_SIZE(params, 2, NAN);1010 PS_ASSERT_VECTOR_SIZE(params, (long)2, NAN); 1011 1011 PS_ASSERT_VECTOR_TYPE(params, PS_TYPE_F32, NAN); 1012 1012 PS_ASSERT_VECTOR_NON_NULL(coords, NAN); 1013 PS_ASSERT_VECTOR_SIZE(coords, 1, NAN);1013 PS_ASSERT_VECTOR_SIZE(coords, (long)1, NAN); 1014 1014 PS_ASSERT_VECTOR_TYPE(coords, PS_TYPE_F32, NAN); 1015 1015 … … 1020 1020 psF32 gauss = psGaussian(x, mean, stdev, false); 1021 1021 if (deriv) { 1022 PS_ASSERT_VECTOR_SIZE(deriv, 2, NAN);1022 PS_ASSERT_VECTOR_SIZE(deriv, (long)2, NAN); 1023 1023 PS_ASSERT_VECTOR_TYPE(deriv, PS_TYPE_F32, NAN); 1024 1024 psF32 tmp = (x - mean) * gauss; … … 1136 1136 // we get here, we know that binSize != 0.0. 1137 1137 long numBins = (max - min) / binSize; // Number of bins 1138 psTrace("psLib.math", 6, "Numbins is % d\n", numBins);1138 psTrace("psLib.math", 6, "Numbins is %ld\n", numBins); 1139 1139 psTrace("psLib.math", 6, "Creating a robust histogram from data range (%.2f - %.2f)\n", min, max); 1140 1140 // Generate the histogram … … 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("psLib.math", 6, "Total data points is % d\n", totalDataPoints);1161 psTrace("psLib.math", 6, "Total data points is %ld\n", totalDataPoints); 1162 1162 long binMedian; 1163 1163 if (totalDataPoints/2.0 < cumulative->nums->data.F32[0]) { … … 1170 1170 if (binMedian < 0) { 1171 1171 psError(PS_ERR_UNKNOWN, false, 1172 "Failed to calculate the 50 precent data point (% d).\n", binMedian);1172 "Failed to calculate the 50 precent data point (%ld).\n", binMedian); 1173 1173 psFree(statsMinMax); 1174 1174 psFree(histogram); … … 1179 1179 } 1180 1180 } 1181 psTrace("psLib.math", 6, "The median bin is % d (%.2f to %.2f)\n", binMedian,1181 psTrace("psLib.math", 6, "The median bin is %ld (%.2f to %.2f)\n", binMedian, 1182 1182 cumulative->bounds->data.F32[binMedian], cumulative->bounds->data.F32[binMedian+1]); 1183 1183 … … 1217 1217 } 1218 1218 } 1219 psTrace("psLib.math", 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 (%ld, %ld).\n", 1220 1220 binLo, binHi); 1221 1221 psTrace("psLib.math", 6, "binLo midpoint is %f\n", PS_BIN_MIDPOINT(cumulative, binLo)); … … 1248 1248 #else 1249 1249 // This code basically interpolates to find the positions exactly. 1250 psTrace("psLib.math", 6, "binLo is % d. Nums at that bin and the next are (%.2f, %.2f)\n",1250 psTrace("psLib.math", 6, "binLo is %ld. 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("psLib.math", 6, "binHi is % d. Nums at that bin and the next are (%.2f, %.2f)\n",1252 psTrace("psLib.math", 6, "binHi is %ld. 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 … … 1304 1304 psTrace("psLib.math", 6, "Masking data more than 25 bins from the median\n"); 1305 1305 psTrace("psLib.math", 6, 1306 "The median is at bin number % d. We mask bins outside the bin range (%d:%d)\n",1306 "The median is at bin number %ld. We mask bins outside the bin range (%ld:%ld)\n", 1307 1307 binMedian, maskLo, maskHi); 1308 1308 psTrace("psLib.math", 6, "Masking data outside (%f %f)\n", medianLo, medianHi); … … 1310 1310 if ((myVector->data.F32[i] < medianLo) || (myVector->data.F32[i] > medianHi)) { 1311 1311 mask->data.U8[i] = 0xff; 1312 psTrace("psLib.math", 6, "Masking element % d is %f\n", i, myVector->data.F32[i]);1312 psTrace("psLib.math", 6, "Masking element %ld is %f\n", i, myVector->data.F32[i]); 1313 1313 } 1314 1314 } … … 1350 1350 return false; 1351 1351 } 1352 psTrace("psLib.math", 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 (%ld, %ld).\n", binLo25, binHi25); 1353 1353 1354 1354 // ADD step 8: Interpolate to find these two positions exactly: these are the upper and lower quartile … … 1381 1381 } 1382 1382 stats->robustN50 = N50; 1383 psTrace("psLib.math", 6, "The robustN50 is % d.\n", N50);1383 psTrace("psLib.math", 6, "The robustN50 is %ld.\n", N50); 1384 1384 1385 1385 … … 1413 1413 psTrace("psLib.math", 6, "The new min/max values are (%f, %f).\n", min, max); 1414 1414 psTrace("psLib.math", 6, "The new bin size is %f.\n", newBinSize); 1415 psTrace("psLib.math", 6, "The numBins is % d\n", numBins);1415 psTrace("psLib.math", 6, "The numBins is %ld\n", numBins); 1416 1416 1417 1417 psHistogram *histogram = psHistogramAlloc(min, max, numBins); // A new histogram (without outliers) … … 1460 1460 } 1461 1461 } 1462 psTrace("psLib.math", 6, "The peak bin is % d, with %f data.n", binNum, binMaxNums);1462 psTrace("psLib.math", 6, "The peak bin is %ld, 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. … … 1696 1696 PS_ASSERT_VECTOR_NON_NULL(bounds, NULL); 1697 1697 PS_ASSERT_VECTOR_TYPE(bounds, PS_TYPE_F32, NULL); 1698 PS_ASSERT_ INT_LARGER_THAN_OR_EQUAL(bounds->n,2, NULL);1698 PS_ASSERT_LONG_LARGER_THAN_OR_EQUAL(bounds->n, (long)2, NULL); 1699 1699 1700 1700 // Allocate memory for the new histogram structure. … … 1761 1761 PS_ASSERT_PTR_NON_NULL(out->bounds, false); 1762 1762 PS_ASSERT_PTR_NON_NULL(out->nums, false); 1763 PS_ASSERT_ INT_WITHIN_RANGE(binNum, 0,((out->nums->n)-1), false);1763 PS_ASSERT_LONG_WITHIN_RANGE(binNum, (long)0, (long)((out->nums->n)-1), false); 1764 1764 PS_ASSERT_FLOAT_LARGER_THAN_OR_EQUAL(error, 0.0, false); 1765 1765 PS_ASSERT_FLOAT_WITHIN_RANGE(data, out->bounds->data.F32[0], -
trunk/psLib/src/math/psUnaryOp.c
r8232 r8627 30 30 * @author Robert DeSonia, MHPCC 31 31 * 32 * @version $Revision: 1. 9$ $Name: not supported by cvs2svn $33 * @date $Date: 2006-08- 08 23:32:23$32 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $ 33 * @date $Date: 2006-08-26 04:34:28 $ 34 34 * 35 35 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 78 78 long nOut = ((psVector*)OUT)->n; \ 79 79 if (nIn != nOut) { \ 80 psError(PS_ERR_BAD_PARAMETER_SIZE, true, _("Number of elements inconsistent, % d vs %d. Number of elements must match."), nIn, nOut); \80 psError(PS_ERR_BAD_PARAMETER_SIZE, true, _("Number of elements inconsistent, %ld vs %ld. Number of elements must match."), nIn, nOut); \ 81 81 if (OUT != IN) { \ 82 82 psFree(OUT); \ … … 99 99 long numColsOut = ((psImage*)OUT)->numCols; \ 100 100 if(numRowsIn!=numRowsOut || numColsIn!=numColsOut) { \ 101 psError(PS_ERR_BAD_PARAMETER_SIZE, true, _("Specified psImage dimensions differed, % dx%d vs %dx%d."), \101 psError(PS_ERR_BAD_PARAMETER_SIZE, true, _("Specified psImage dimensions differed, %ldx%ld vs %ldx%ld."), \ 102 102 numColsIn, numRowsIn, numColsOut, numRowsOut); \ 103 103 if (OUT != IN) { \
Note:
See TracChangeset
for help on using the changeset viewer.
