IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 26, 2004, 2:57:34 PM (22 years ago)
Author:
desonia
Message:

converted native C types to ps Types, where practical.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/dataManip/psStats.c

    r2197 r2204  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.68 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-10-26 21:24:43 $
     11 *  @version $Revision: 1.69 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-10-27 00:57:31 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5151
    5252void p_psVectorRobustStats(const psVector* restrict myVector,
    53                            const psVector* restrict maskVector, unsigned int maskVal, psStats* stats);
     53                           const psVector* restrict maskVector, psU32 maskVal, psStats* stats);
    5454
    5555
     
    7575/*****************************************************************************/
    7676
    77 bool p_psGetStatValue(const psStats* stats, double *value)
     77psBool p_psGetStatValue(const psStats* stats, double *value)
    7878{
    7979
     
    134134 *****************************************************************************/
    135135
    136 void p_psVectorPrint(psVector* myVector, psVector* maskVector, unsigned int maskVal, psStats* stats)
    137 {
    138     int i = 0;                  // Loop index variable.
     136void p_psVectorPrint(psVector* myVector, psVector* maskVector, psU32 maskVal, psStats* stats)
     137{
     138    psS32 i = 0;                  // Loop index variable.
    139139
    140140    for (i = 0; i < myVector->n; i++) {
     
    178178
    179179void p_psVectorSampleMean(const psVector* restrict myVector,
    180                           const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
    181 {
    182     int i = 0;                  // Loop index variable
     180                          const psVector* restrict maskVector, psU32 maskVal, psStats* stats)
     181{
     182    psS32 i = 0;                  // Loop index variable
    183183    float mean = 0.0;           // The mean
    184     int count = 0;              // # of points in this mean?
     184    psS32 count = 0;              // # of points in this mean?
    185185    float rangeMin = 0.0;       // Exclude data below this
    186186    float rangeMax = 0.0;       // Exclude date above this
     
    242242 *****************************************************************************/
    243243void p_psVectorMax(const psVector* restrict myVector,
    244                    const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
    245 {
    246     int i = 0;                  // Loop index variable
     244                   const psVector* restrict maskVector, psU32 maskVal, psStats* stats)
     245{
     246    psS32 i = 0;                  // Loop index variable
    247247    float max = -MY_MAX_FLOAT;  // The calculated maximum
    248248    float rangeMin = 0.0;       // Exclude data below this
     
    303303 *****************************************************************************/
    304304void p_psVectorMin(const psVector* restrict myVector,
    305                    const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
    306 {
    307     int i = 0;                  // Loop index variable
     305                   const psVector* restrict maskVector, psU32 maskVal, psStats* stats)
     306{
     307    psS32 i = 0;                  // Loop index variable
    308308    float min = MY_MAX_FLOAT;   // The calculated maximum
    309309    float rangeMin = 0.0;       // Exclude data below this
     
    363363    NULL
    364364 *****************************************************************************/
    365 int p_psVectorNValues(const psVector* restrict myVector,
    366                       const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
    367 {
    368     int i = 0;                  // Loop index variable
    369     int numData = 0;            // The number of data points
     365psS32 p_psVectorNValues(const psVector* restrict myVector,
     366                        const psVector* restrict maskVector, psU32 maskVal, psStats* stats)
     367{
     368    psS32 i = 0;                  // Loop index variable
     369    psS32 numData = 0;            // The number of data points
    370370    float rangeMin = 0.0;       // Exclude data below this
    371371    float rangeMax = 0.0;       // Exclude date above this
     
    414414 *****************************************************************************/
    415415void p_psVectorSampleMedian(const psVector* restrict myVector,
    416                             const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
     416                            const psVector* restrict maskVector, psU32 maskVal, psStats* stats)
    417417{
    418418    psVector* unsortedVector = NULL;    // Temporary vector
    419419    psVector* sortedVector = NULL;      // Temporary vector
    420     int i = 0;                  // Loop index variable
    421     int count = 0;              // # of points in this mean?
    422     int nValues = 0;            // # of points in vector
     420    psS32 i = 0;                  // Loop index variable
     421    psS32 count = 0;              // # of points in this mean?
     422    psS32 nValues = 0;            // # of points in vector
    423423    float rangeMin = 0.0;       // Exclude data below this
    424424    float rangeMax = 0.0;       // Exclude date above this
     
    497497                                       float sigma)
    498498{
    499     int i = 0;                  // Loop index variable
    500     int j = 0;                  // Loop index variable
     499    psS32 i = 0;                  // Loop index variable
     500    psS32 j = 0;                  // Loop index variable
    501501    float iMid;
    502502    float jMid;
    503     int numBins = robustHistogram->nums->n;
    504     int numBounds = robustHistogram->bounds->n;
     503    psS32 numBins = robustHistogram->nums->n;
     504    psS32 numBounds = robustHistogram->bounds->n;
    505505    psVector* smooth = psVectorAlloc(numBins, PS_TYPE_F32);
    506     int jMin = 0;
    507     int jMax = 0;
     506    psS32 jMin = 0;
     507    psS32 jMax = 0;
    508508    float firstBound = robustHistogram->bounds->data.F32[0];
    509509    float lastBound = robustHistogram->bounds->data.F32[numBounds-1];
     
    566566 *****************************************************************************/
    567567void p_psVectorSampleQuartiles(const psVector* restrict myVector,
    568                                const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
     568                               const psVector* restrict maskVector, psU32 maskVal, psStats* stats)
    569569{
    570570    psVector* unsortedVector = NULL;    // Temporary vector
    571571    psVector* sortedVector = NULL;      // Temporary vector
    572     int i = 0;                  // Loop index variable
    573     int count = 0;              // # of points in this mean?
    574     int nValues = 0;            // # data points
     572    psS32 i = 0;                  // Loop index variable
     573    psS32 count = 0;              // # of points in this mean?
     574    psS32 nValues = 0;            // # data points
    575575    float rangeMin = 0.0;       // Exclude data below this
    576576    float rangeMax = 0.0;       // Exclude date above this
     
    648648 *****************************************************************************/
    649649void p_psVectorSampleStdev(const psVector* restrict myVector,
    650                            const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
    651 {
    652     int i = 0;                  // Loop index variable
    653     int countInt = 0;           // # of data points being used
     650                           const psVector* restrict maskVector, psU32 maskVal, psStats* stats)
     651{
     652    psS32 i = 0;                  // Loop index variable
     653    psS32 countInt = 0;           // # of data points being used
    654654    float countFloat = 0.0;     // # of data points being used
    655655    float mean = 0.0;           // The mean
     
    733733 *****************************************************************************/
    734734void p_psVectorClippedStats(const psVector* restrict myVector,
    735                             const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
    736 {
    737     int i = 0;                  // Loop index variable
    738     int j = 0;                  // Loop index variable
     735                            const psVector* restrict maskVector, psU32 maskVal, psStats* stats)
     736{
     737    psS32 i = 0;                  // Loop index variable
     738    psS32 j = 0;                  // Loop index variable
    739739    float clippedMean = 0.0;    // self-explanatory
    740740    float clippedStdev = 0.0;   // self-explanatory
     
    825825    float min = (float)HUGE;
    826826    float max = (float)-HUGE;
    827     int i = 0;
     827    psS32 i = 0;
    828828
    829829    for (i = 0; i < myData->n; i++) {
     
    856856    float max = (double)-HUGE;
    857857    double range = 0.0;
    858     int i = 0;
     858    psS32 i = 0;
    859859
    860860    for (i = 0; i < myData->n; i++) {
     
    914914 *****************************************************************************/
    915915float p_psGaussianDeriv(const psVector* restrict myData,
    916                         const psVector* restrict myParams, int whichParam)
     916                        const psVector* restrict myParams, psS32 whichParam)
    917917{
    918918    float x = myData->data.F32[0];
     
    957957 *****************************************************************************/
    958958float p_psQuadraticDeriv(const psVector* restrict myParams,
    959                          const psVector* restrict myCoords, int whichParamDeriv)
     959                         const psVector* restrict myCoords, psS32 whichParamDeriv)
    960960{
    961961    float x = myCoords->data.F32[0];
     
    989989                       float getThisValue)
    990990{
    991     int numIterations = 0;
     991    psS32 numIterations = 0;
    992992    float midpoint = 0.0;
    993993    float oldMidpoint = 1.0;
     
    10301030float fitQuadraticSearchForYThenReturnX(psVector *xVec,
    10311031                                        psVector *yVec,
    1032                                         int binNum,
     1032                                        psS32 binNum,
    10331033                                        float yVal)
    10341034{
     
    11291129void p_psVectorRobustStats(const psVector* restrict myVector,
    11301130                           const psVector* restrict maskVector,
    1131                            unsigned int maskVal,
     1131                           psU32 maskVal,
    11321132                           psStats* stats)
    11331133{
     
    11351135    psVector* robustHistogramVector = NULL;
    11361136    float binSize = 0.0;        // Size of the histogram bins
    1137     int LQBinNum = -1;          // Bin num for lower quartile
    1138     int UQBinNum = -1;          // Bin num for upper quartile
    1139     int medianBinNum = -1;
    1140     int i = 0;                  // Loop index variable
    1141     int modeBinNum = 0;
     1137    psS32 LQBinNum = -1;          // Bin num for lower quartile
     1138    psS32 UQBinNum = -1;          // Bin num for upper quartile
     1139    psS32 medianBinNum = -1;
     1140    psS32 i = 0;                  // Loop index variable
     1141    psS32 modeBinNum = 0;
    11421142    float modeBinCount = 0.0;
    11431143    float dL = 0.0;
    1144     int numBins = 0;
     1144    psS32 numBins = 0;
    11451145    float myMean = 0.0;
    11461146    float myStdev = 0.0;
     
    12001200    // bins, not the binSize.  Also, if we get here, we know that
    12011201    // binSize != 0.0.
    1202     numBins = (int)((stats->max - stats->min) / binSize);
     1202    numBins = (psS32)((stats->max - stats->min) / binSize);
    12031203    robustHistogram = psHistogramAlloc(stats->min, stats->max, numBins);
    12041204
     
    14401440    The histogram structure
    14411441 *****************************************************************************/
    1442 psHistogram* psHistogramAlloc(float lower, float upper, int n)
    1443 {
    1444     int i = 0;                  // Loop index variable
     1442psHistogram* psHistogramAlloc(float lower, float upper, psS32 n)
     1443{
     1444    psS32 i = 0;                  // Loop index variable
    14451445    psHistogram* newHist = NULL;        // The new histogram structure
    14461446    float binSize = 0.0;        // The histogram bin size
     
    15001500{
    15011501    psHistogram* newHist = NULL;        // The new histogram structure
    1502     int i;                      // Loop index variable
     1502    psS32 i;                      // Loop index variable
    15031503
    15041504    // NOTE: Verify that this is the correct action.
     
    15651565                               const psVector* restrict in,
    15661566                               const psVector* restrict mask,
    1567                                unsigned int maskVal)
    1568 {
    1569     int i = 0;                  // Loop index variable
     1567                               psU32 maskVal)
     1568{
     1569    psS32 i = 0;                  // Loop index variable
    15701570    float binSize = 0.0;        // Histogram bin size
    1571     int binNum = 0;             // A temporary bin number
    1572     int numBins = 0;            // The total number of bins
    1573     int tmp = 0;
     1571    psS32 binNum = 0;             // A temporary bin number
     1572    psS32 numBins = 0;            // The total number of bins
     1573    psS32 tmp = 0;
    15741574    psScalar tmpScalar;
    15751575    tmpScalar.type.type = PS_TYPE_F32;
    15761576    psVector* inF32;
    1577     int mustFreeTmp = 1;
     1577    psS32 mustFreeTmp = 1;
    15781578
    15791579    // NOTE: Verify that this is the correct action.
     
    16291629                if (out->uniform == true) {
    16301630                    binSize = out->bounds->data.F32[1] - out->bounds->data.F32[0];
    1631                     binNum = (int)((inF32->data.F32[i] - out->bounds->data.F32[0]) / binSize);
     1631                    binNum = (psS32)((inF32->data.F32[i] - out->bounds->data.F32[0]) / binSize);
    16321632
    16331633                    // NOTE: This next if-statement really shouldn't be necessary.
     
    16731673psVector* p_psConvertToF32(psVector* in)
    16741674{
    1675     int i = 0;
     1675    psS32 i = 0;
    16761676    psVector* tmp = NULL;
    16771677
     
    17241724                       psVector* in,
    17251725                       psVector* mask,
    1726                        unsigned int maskVal)
     1726                       psU32 maskVal)
    17271727{
    17281728    psVector* inF32;
    1729     int mustFreeTmp = 1;
     1729    psS32 mustFreeTmp = 1;
    17301730
    17311731    if (in == NULL) {
Note: See TracChangeset for help on using the changeset viewer.