IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 8627 for trunk/psLib/src/math


Ignore:
Timestamp:
Aug 25, 2006, 6:34:28 PM (20 years ago)
Author:
jhoblitt
Message:

add gcc format attributes to:

psAbort()
psErrorStackPrint()
p_psError()
p_psWarning()
psLogMsg()
p_psTrace()

add PS_ASSERT_LONG_LARGER_THAN_OR_EQUAL
add PS_ASSERT_S64_WITHIN_RANGE
fix PS_ASSERT_LONG_WITHIN_RANGE
fix a wide range of format related issues:

  • missing format field specifiers
  • missing format args
  • incorrect format field specifiers
  • constants declared with the wrong type (float vs. int)
  • PS_ASSERT* for the wrong type
  • attemps to print structs with *printf()
  • unportable format specifiers, eg. long vs. long long
Location:
trunk/psLib/src/math
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/math/psBinaryOp.c

    r8232 r8627  
    3030 *  @author Robert DeSonia, MHPCC
    3131 *
    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 $
    3434 *
    3535 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    107107    long n2 = ((psVector*)IN2)->n; \
    108108    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); \
    110110        if (OUT != IN1 && OUT != IN2) { \
    111111            psFree(OUT); \
     
    129129    if (((psVector*)IN1)->type.dimen == PS_DIMEN_VECTOR) { /* Regular vectors */ \
    130130        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); \
    132132            if (OUT != IN1 && OUT != IN2) { \
    133133                psFree(OUT); \
     
    146146    } else {  /* Transposed vectors */ \
    147147        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); \
    149149            if (OUT != IN1 && OUT != IN2) { \
    150150                psFree(OUT); \
     
    187187    if (((psVector*)IN2)->type.dimen == PS_DIMEN_VECTOR) { /* Regular vectors */ \
    188188        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); \
    190190            if (OUT != IN1 && OUT != IN2) { \
    191191                psFree(OUT); \
     
    204204    } else {  /* Transposed vectors */ \
    205205        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); \
    207207            if (OUT != IN1) { \
    208208                psFree(OUT); \
     
    229229    long numCols2 = ((psImage*)IN2)->numCols; \
    230230    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."), \
    232232                numCols1, numRows1, numCols2, numRows2); \
    233233        if (OUT != IN1 && OUT != IN2) { \
     
    360360    } else {                                                                                                 \
    361361        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);               \
    363363        return NULL;                                                                                         \
    364364    }                                                                                                        \
  • trunk/psLib/src/math/psMathUtils.c

    r8245 r8627  
    33 *  This file contains standard math routines.
    44 *
    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 $
    77 *
    88 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    5858    long max; \
    5959    long mid; \
    60     psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__); \
     60    psTrace("psLib.math", 4, "---- () begin ----\n"); \
    6161    /* psTrace("psLib.math", 6, "Determining the bin for: %f\n", x); */\
    6262    if (value < bounds[0]) { \
    6363        psLogMsg(__func__, PS_LOG_WARN, \
    6464                 "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]); \
    6666        return(-2); \
    6767    } \
     
    6969        psLogMsg(__func__, PS_LOG_WARN, \
    7070                 "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]); \
    7272        return(-1); \
    7373    } \
     
    7979        \
    8080        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); \
    8282            return(mid); \
    8383        } else if (value < bounds[mid]) { \
     
    8888        mid = ((max+1)+min)/2; \
    8989    } \
    90     psTrace("psLib.math", 4, "---- %s(%d) end (2) ----\n", __func__, min); \
     90    psTrace("psLib.math", 4, "---- %s(%ld) end (2) ----\n", __func__, min); \
    9191    return(min); \
    9292}
  • trunk/psLib/src/math/psMatrix.c

    r8245 r8627  
    2121 *  @author Robert DeSonia, MHPCC
    2222 *
    23  *  @version $Revision: 1.42 $ $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 $
    2525 *
    2626 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    675675        if (outVector->n != inImage->numRows) {
    676676            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).",
    678678                    inImage->numRows, outVector->n);
    679679            psMatrixToVector_EXIT;
     
    691691        if (outVector->n != inImage->numCols) {
    692692            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).",
    694694                    inImage->numCols, outVector->n);
    695695            psMatrixToVector_EXIT;
     
    727727        } else if (outImage->numRows != inVector->n) {
    728728            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).",
    730730                    outImage->numRows, inVector->n);
    731731            VECTORTOMATRIX_CLEANUP;
     
    746746        } else if (outImage->numCols != inVector->n) {
    747747            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).",
    749749                    outImage->numCols, inVector->n);
    750750            VECTORTOMATRIX_CLEANUP;
  • trunk/psLib/src/math/psMinimizeLMM.c

    r8245 r8627  
    1010 *  @author EAM, IfA
    1111 *
    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 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    181181    psF64 rcF64 = p_psMinLM_SetABX(alpha, beta, params, paramMask, x, y, dy, func);
    182182    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");
    184184        rc = false;
    185185    }
    186     psTrace("psLib.math", 5, "p_psMinLM_SetABX() was succesful\n", __func__);
     186    psTrace("psLib.math", 5, "p_psMinLM_SetABX() was succesful\n");
    187187
    188188    psBool rcBool = p_psMinLM_GuessABP(Alpha, delta, Params, alpha, beta, params, paramMask, NULL, NULL, NULL, 0.0);
    189189    if (rcBool == false) {
    190         psTrace (__func__, 5, "p_psMinLM_GuessABP() returned FALSE.\n");
     190        psTrace ("psLib.math", 5, "p_psMinLM_GuessABP() returned FALSE.\n");
    191191        rc = false;
    192192    }
    193     psTrace("psLib.math", 5, "p_psMinLM_GuessABP() was succesful\n", __func__);
     193    psTrace("psLib.math", 5, "p_psMinLM_GuessABP() was succesful\n");
    194194
    195195    psFree(alpha);
     
    200200        psFree(dy);
    201201    }
    202     psTrace("psLib.math", 3, "---- %s() end ----\n", __func__);
     202    psTrace("psLib.math", 3, "---- end ----\n");
    203203    return(rc);
    204204}
     
    417417        psTrace("psLib.math", 6, "The current Param vector: \n");
    418418        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]);
    420420        }
    421421    }
     
    447447                psTrace("psLib.math", 6, "The current Param vector: \n");
    448448                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]);
    450450                }
    451451            }
  • trunk/psLib/src/math/psMinimizePolyFit.c

    r8467 r8627  
    1010 *  @author EAM, IfA
    1111 *
    12  *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2006-08-22 15:01:12 $
     12 *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2006-08-26 04:34:28 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    816816    //
    817817    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);
    819819        psS32 Nkeep = 0;
    820820        if (psTraceGetLevel(__func__) >= 6) {
     
    894894        // since the polynomial fit won't change.
    895895        //
    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);
    897897        psFree(fit);
    898898    }
     
    12501250
    12511251    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);
    12531253        psS32 Nkeep = 0;
    12541254        if (psTraceGetLevel(__func__) >= 6) {
     
    13311331        }
    13321332
    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);
    13341334        psFree(fit);
    13351335    }
     
    17701770
    17711771    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);
    17731773        psS32 Nkeep = 0;
    17741774        if (psTraceGetLevel(__func__) >= 6) {
     
    18511851        }
    18521852
    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);
    18541854        psFree(fit);
    18551855    }
     
    23382338
    23392339    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);
    23412341        psS32 Nkeep = 0;
    23422342        if (psTraceGetLevel(__func__) >= 6) {
     
    24202420        }
    24212421
    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);
    24232423        psFree (fit);
    24242424    }
  • trunk/psLib/src/math/psPolynomialUtils.c

    r7766 r8627  
    105105        }
    106106
    107         psTrace (__func__, 4, "keeping %d of %d pts for fit\n",
     107        psTrace (__func__, 4, "keeping %d of %ld pts for fit\n",
    108108                 Nkeep, x->n);
    109109
  • trunk/psLib/src/math/psSparse.c

    r7766 r8627  
    6262
    6363    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);
    6565        int temp = i;
    6666        i = j;
  • trunk/psLib/src/math/psSpline.c

    r8245 r8627  
    66*  This file contains the routines that allocate, free, and evaluate splines.
    77*
    8 *  @version $Revision: 1.152 $ $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 $
    1010*
    1111*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    213213    PS_ASSERT_VECTOR_NON_NULL(y, NULL);
    214214    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);
    216216    psS32 numSplines = (y->n)-1;
    217217    psTrace("psLib.math", 5, "numSplines is %d\n", numSplines);
  • trunk/psLib/src/math/psStats.c

    r8245 r8627  
    1616 * use ->min and ->max (PS_STAT_USE_RANGE)
    1717 *
    18  *  @version $Revision: 1.184 $ $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 $
    2020 *
    2121 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    665665    if (count == 0) {
    666666        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);
    668668        return false;
    669669    }
    670670    if (count == 1) {
    671671        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);
    673673        return false;
    674674    }
     
    713713
    714714    // 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);
    718718
    719719    // Allocate a psStats structure for calculating the mean, median, and
     
    777777                        fabsf(myVector->data.F32[j] - clippedMean) > stats->clipSigma * errors->data.F32[j]) {
    778778                    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,
    780780                            myVector->data.F32[j], errors->data.F32[j]);
    781781                    numClipped++;
     
    788788                        fabsf(myVector->data.F32[j] - clippedMean) > (stats->clipSigma * clippedStdev)) {
    789789                    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]);
    791791                    numClipped++;
    792792                    clipped = true;
     
    896896    PS_ASSERT_VECTOR_TYPE(yVec, PS_TYPE_F32, NAN);
    897897    //    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);
    900900
    901901    psVector *x = psVectorAlloc(3, PS_TYPE_F64);
     
    10081008    psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__);
    10091009    PS_ASSERT_VECTOR_NON_NULL(params, NAN);
    1010     PS_ASSERT_VECTOR_SIZE(params, 2, NAN);
     1010    PS_ASSERT_VECTOR_SIZE(params, (long)2, NAN);
    10111011    PS_ASSERT_VECTOR_TYPE(params, PS_TYPE_F32, NAN);
    10121012    PS_ASSERT_VECTOR_NON_NULL(coords, NAN);
    1013     PS_ASSERT_VECTOR_SIZE(coords, 1, NAN);
     1013    PS_ASSERT_VECTOR_SIZE(coords, (long)1, NAN);
    10141014    PS_ASSERT_VECTOR_TYPE(coords, PS_TYPE_F32, NAN);
    10151015
     
    10201020    psF32 gauss = psGaussian(x, mean, stdev, false);
    10211021    if (deriv) {
    1022         PS_ASSERT_VECTOR_SIZE(deriv, 2, NAN);
     1022        PS_ASSERT_VECTOR_SIZE(deriv, (long)2, NAN);
    10231023        PS_ASSERT_VECTOR_TYPE(deriv, PS_TYPE_F32, NAN);
    10241024        psF32 tmp = (x - mean) * gauss;
     
    11361136        // we get here, we know that binSize != 0.0.
    11371137        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);
    11391139        psTrace("psLib.math", 6, "Creating a robust histogram from data range (%.2f - %.2f)\n", min, max);
    11401140        // Generate the histogram
     
    11591159        // ADD step 2: Find the bin which contains the 50% data point.
    11601160        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);
    11621162        long binMedian;
    11631163        if (totalDataPoints/2.0 < cumulative->nums->data.F32[0]) {
     
    11701170            if (binMedian < 0) {
    11711171                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);
    11731173                psFree(statsMinMax);
    11741174                psFree(histogram);
     
    11791179            }
    11801180        }
    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,
    11821182                cumulative->bounds->data.F32[binMedian], cumulative->bounds->data.F32[binMedian+1]);
    11831183
     
    12171217            }
    12181218        }
    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",
    12201220                binLo, binHi);
    12211221        psTrace("psLib.math", 6, "binLo midpoint is %f\n", PS_BIN_MIDPOINT(cumulative, binLo));
     
    12481248        #else
    12491249        // 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",
    12511251                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",
    12531253                binHi, cumulative->nums->data.F32[binHi], cumulative->nums->data.F32[binHi+1]);
    12541254
     
    13041304            psTrace("psLib.math", 6, "Masking data more than 25 bins from the median\n");
    13051305            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",
    13071307                    binMedian, maskLo, maskHi);
    13081308            psTrace("psLib.math", 6, "Masking data outside (%f %f)\n", medianLo, medianHi);
     
    13101310                if ((myVector->data.F32[i] < medianLo) || (myVector->data.F32[i] > medianHi)) {
    13111311                    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]);
    13131313                }
    13141314            }
     
    13501350        return false;
    13511351    }
    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);
    13531353
    13541354    // ADD step 8: Interpolate to find these two positions exactly: these are the upper and lower quartile
     
    13811381    }
    13821382    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);
    13841384
    13851385
     
    14131413        psTrace("psLib.math", 6, "The new min/max values are (%f, %f).\n", min, max);
    14141414        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);
    14161416
    14171417        psHistogram *histogram = psHistogramAlloc(min, max, numBins); // A new histogram (without outliers)
     
    14601460            }
    14611461        }
    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);
    14631463
    14641464        // Fit a Gaussian to the bins in the range 20 sigma of the robust histogram median.
     
    16961696    PS_ASSERT_VECTOR_NON_NULL(bounds, NULL);
    16971697    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);
    16991699
    17001700    // Allocate memory for the new histogram structure.
     
    17611761    PS_ASSERT_PTR_NON_NULL(out->bounds, false);
    17621762    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);
    17641764    PS_ASSERT_FLOAT_LARGER_THAN_OR_EQUAL(error, 0.0, false);
    17651765    PS_ASSERT_FLOAT_WITHIN_RANGE(data, out->bounds->data.F32[0],
  • trunk/psLib/src/math/psUnaryOp.c

    r8232 r8627  
    3030 *  @author Robert DeSonia, MHPCC
    3131 *
    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 $
    3434 *
    3535 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    7878    long nOut = ((psVector*)OUT)->n; \
    7979    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); \
    8181        if (OUT != IN) { \
    8282            psFree(OUT); \
     
    9999    long numColsOut = ((psImage*)OUT)->numCols; \
    100100    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."), \
    102102                numColsIn, numRowsIn, numColsOut, numRowsOut); \
    103103        if (OUT != IN) { \
Note: See TracChangeset for help on using the changeset viewer.