IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 9, 2004, 1:34:58 PM (22 years ago)
Author:
desonia
Message:

cleanup of some indent-induced madness.

File:
1 edited

Legend:

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

    r1407 r1440  
    1010 *  @author George Gusciora, MHPCC
    1111 *
    12  *  @version $Revision: 1.52 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-08-07 00:06:06 $
     12 *  @version $Revision: 1.53 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-08-09 23:34:57 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5454#define MAX_ITERATIONS 10
    5555
    56 void p_psVectorRobustStats(const psVector * restrict myVector,
    57                            const psVector * restrict maskVector, unsigned int maskVal, psStats * stats);
     56void p_psVectorRobustStats(const psVector* restrict myVector,
     57                           const psVector* restrict maskVector, unsigned int maskVal, psStats* stats);
    5858
    5959/** Preprocessor macro to generate error on an incorrect type */
     
    116116/*****************************************************************************/
    117117
    118 bool p_psGetStatValue(const psStats * stats, double *value)
     118bool p_psGetStatValue(const psStats* stats, double *value)
    119119{
    120120
     
    175175 *****************************************************************************/
    176176
    177 void p_psVectorPrint(psVector * myVector, psVector * maskVector, unsigned int maskVal, psStats * stats)
     177void p_psVectorPrint(psVector* myVector, psVector* maskVector, unsigned int maskVal, psStats* stats)
    178178{
    179179    int i = 0;                  // Loop index variable.
     
    218218 *****************************************************************************/
    219219
    220 void p_psVectorSampleMean(const psVector * restrict myVector,
    221                           const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
     220void p_psVectorSampleMean(const psVector* restrict myVector,
     221                          const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
    222222{
    223223    int i = 0;                  // Loop index variable
     
    282282    NULL
    283283 *****************************************************************************/
    284 void p_psVectorMax(const psVector * restrict myVector,
    285                    const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
     284void p_psVectorMax(const psVector* restrict myVector,
     285                   const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
    286286{
    287287    int i = 0;                  // Loop index variable
     
    343343    NULL
    344344 *****************************************************************************/
    345 void p_psVectorMin(const psVector * restrict myVector,
    346                    const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
     345void p_psVectorMin(const psVector* restrict myVector,
     346                   const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
    347347{
    348348    int i = 0;                  // Loop index variable
     
    404404    NULL
    405405 *****************************************************************************/
    406 int p_psVectorNValues(const psVector * restrict myVector,
    407                       const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
     406int p_psVectorNValues(const psVector* restrict myVector,
     407                      const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
    408408{
    409409    int i = 0;                  // Loop index variable
     
    456456    NULL
    457457 *****************************************************************************/
    458 void p_psVectorSampleMedian(const psVector * restrict myVector,
    459                             const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
    460 {
    461     psVector *unsortedVector = NULL;    // Temporary vector
    462     psVector *sortedVector = NULL;      // Temporary vector
     458void p_psVectorSampleMedian(const psVector* restrict myVector,
     459                            const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
     460{
     461    psVector* unsortedVector = NULL;    // Temporary vector
     462    psVector* sortedVector = NULL;      // Temporary vector
    463463    int i = 0;                  // Loop index variable
    464464    int count = 0;              // # of points in this mean?
     
    565565    XXX: use a static variable for gaussianCoefs[] and compute them once.
    566566 *****************************************************************************/
    567 psVector *p_psVectorsmoothHistGaussian(psHistogram * robustHistogram, float sigma)
     567psVector* p_psVectorsmoothHistGaussian(psHistogram* robustHistogram, float sigma)
    568568{
    569569    int i = 0;                  // Loop index variable
     
    572572    float expo = 0.0;           // Temporary variable
    573573    float gaussianCoefs[1 + (2 * GAUSS_WIDTH)]; // The Gaussian Coefficients
    574     psVector *smooth = psVectorAlloc(robustHistogram->nums->n, PS_TYPE_F32);
     574    psVector* smooth = psVectorAlloc(robustHistogram->nums->n, PS_TYPE_F32);
    575575
    576576    for (i = 0; i < (1 + (2 * GAUSS_WIDTH)); i++) {
     
    628628    NULL
    629629 *****************************************************************************/
    630 void p_psVectorSampleQuartiles(const psVector * restrict myVector,
    631                                const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
    632 {
    633     psVector *unsortedVector = NULL;    // Temporary vector
    634     psVector *sortedVector = NULL;      // Temporary vector
     630void p_psVectorSampleQuartiles(const psVector* restrict myVector,
     631                               const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
     632{
     633    psVector* unsortedVector = NULL;    // Temporary vector
     634    psVector* sortedVector = NULL;      // Temporary vector
    635635    int i = 0;                  // Loop index variable
    636636    int count = 0;              // # of points in this mean?
     
    710710 
    711711 *****************************************************************************/
    712 void p_psVectorSampleStdev(const psVector * restrict myVector,
    713                            const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
     712void p_psVectorSampleStdev(const psVector* restrict myVector,
     713                           const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
    714714{
    715715    int i = 0;                  // Loop index variable
     
    795795    NULL
    796796 *****************************************************************************/
    797 void p_psVectorClippedStats(const psVector * restrict myVector,
    798                             const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
     797void p_psVectorClippedStats(const psVector* restrict myVector,
     798                            const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
    799799{
    800800    int i = 0;                  // Loop index variable
     
    804804    float oldStanMean = 0.0;    // Temporary variable
    805805    float oldStanStdev = 0.0;   // Temporary variable
    806     psVector *tmpMask = NULL;   // Temporary vector
     806    psVector* tmpMask = NULL;   // Temporary vector
    807807
    808808    // Endure that stats->clipIter is within the proper range.
     
    884884elements of a vector to a range between 0.0 and 1.0.
    885885 *****************************************************************************/
    886 void p_psNormalizeVector(psVector * myData)
     886void p_psNormalizeVector(psVector* myData)
    887887{
    888888    float min = (float)HUGE;
     
    911911specified data point.
    912912 *****************************************************************************/
    913 float p_psGaussian(const psVector * restrict myData, const psVector * restrict myParams)
     913float p_psGaussian(const psVector* restrict myData, const psVector* restrict myParams)
    914914{
    915915    float x = myData->data.F32[0];
     
    928928calculates the specified partial derivative of the above Gaussian function.
    929929 *****************************************************************************/
    930 float p_psGaussianDeriv(const psVector * restrict myData, const psVector * restrict myParams, int whichParam)
     930float p_psGaussianDeriv(const psVector* restrict myData, const psVector* restrict myParams, int whichParam)
    931931{
    932932    float x = myData->data.F32[0];
     
    954954specified data point.
    955955 *****************************************************************************/
    956 float p_psQuadratic(const psVector * restrict myParams, const psVector * restrict myCoords)
     956float p_psQuadratic(const psVector* restrict myParams, const psVector* restrict myCoords)
    957957{
    958958    float x = myCoords->data.F32[0];
     
    970970calculates the specified partial derivative of the above quadratic function.
    971971 *****************************************************************************/
    972 float p_psQuadraticDeriv(const psVector * restrict myParams,
    973                          const psVector * restrict myCoords, int whichParamDeriv)
     972float p_psQuadraticDeriv(const psVector* restrict myParams,
     973                         const psVector* restrict myCoords, int whichParamDeriv)
    974974{
    975975    float x = myCoords->data.F32[0];
     
    996996decreasing within that range.
    997997 *****************************************************************************/
    998 float p_ps1DPolyMedian(psPolynomial1D * myPoly, float rangeLow, float rangeHigh, float getThisValue)
     998float p_ps1DPolyMedian(psPolynomial1D* myPoly, float rangeLow, float rangeHigh, float getThisValue)
    999999{
    10001000    int numIterations = 0;
     
    10361036XXX: This function is currently not being used.
    10371037 *****************************************************************************/
    1038 float p_psFitQuadratic(psHistogram * histogram, psVector * cumulativeSums, int binNum, float fitFloat)
    1039 {
    1040     psVector *x = psVectorAlloc(3, PS_TYPE_F64);
    1041     psVector *y = psVectorAlloc(3, PS_TYPE_F64);
    1042     psVector *yErr = psVectorAlloc(3, PS_TYPE_F64);
    1043     psPolynomial1D *myPoly = psPolynomial1DAlloc(2);
     1038float p_psFitQuadratic(psHistogram* histogram, psVector* cumulativeSums, int binNum, float fitFloat)
     1039{
     1040    psVector* x = psVectorAlloc(3, PS_TYPE_F64);
     1041    psVector* y = psVectorAlloc(3, PS_TYPE_F64);
     1042    psVector* yErr = psVectorAlloc(3, PS_TYPE_F64);
     1043    psPolynomial1D* myPoly = psPolynomial1DAlloc(2);
    10441044
    10451045    if ((binNum > 0) && (binNum < (histogram->nums->n + 1))) {
     
    11001100    NULL
    11011101*****************************************************************************/
    1102 void p_psVectorRobustStats(const psVector * restrict myVector,
    1103                            const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
    1104 {
    1105     psHistogram *robustHistogram = NULL;
    1106     psVector *robustHistogramVector = NULL;
     1102void p_psVectorRobustStats(const psVector* restrict myVector,
     1103                           const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
     1104{
     1105    psHistogram* robustHistogram = NULL;
     1106    psVector* robustHistogramVector = NULL;
    11071107    float binSize = 0.0;        // Size of the histogram bins
    11081108    int LQBinNum = -1;          // Bin num for lower quartile
     
    11131113    float dL = 0.0;
    11141114    int numBins = 0;
    1115     psStats *tmpStats = psStatsAlloc(PS_STAT_CLIPPED_STDEV | PS_STAT_CLIPPED_MEAN);
    1116 
    1117     // psImage *domain;
    1118     // psVector *errors;
    1119     // psVector *data;
    1120     // psVector *initialGuess;
    1121     // psVector *theParams;
     1115    psStats* tmpStats = psStatsAlloc(PS_STAT_CLIPPED_STDEV | PS_STAT_CLIPPED_MEAN);
     1116
     1117    // psImage* domain;
     1118    // psVector* errors;
     1119    // psVector* data;
     1120    // psVector* initialGuess;
     1121    // psVector* theParams;
    11221122    // float chiSq=0.0;
    11231123    // float max = -HUGE;
     
    11291129    float sumSquares = 0.0;
    11301130    float sumDiffs = 0.0;
    1131     psVector *x = psVectorAlloc(3, PS_TYPE_F64);
    1132     psVector *y = psVectorAlloc(3, PS_TYPE_F64);
    1133     psVector *yErr = psVectorAlloc(3, PS_TYPE_F64);
    1134     psPolynomial1D *myPoly = psPolynomial1DAlloc(2);
    1135     psVector *cumulativeRobustSumsFullRange = NULL;
    1136     psVector *cumulativeRobustSumsDlRange = NULL;
     1131    psVector* x = psVectorAlloc(3, PS_TYPE_F64);
     1132    psVector* y = psVectorAlloc(3, PS_TYPE_F64);
     1133    psVector* yErr = psVectorAlloc(3, PS_TYPE_F64);
     1134    psPolynomial1D* myPoly = psPolynomial1DAlloc(2);
     1135    psVector* cumulativeRobustSumsFullRange = NULL;
     1136    psVector* cumulativeRobustSumsDlRange = NULL;
    11371137    float sumRobust = 0.0;
    11381138    float sumN50 = 0.0;
     
    15001500/*****************************************************************************/
    15011501
    1502 static void histogramFree(psHistogram * myHist);
     1502static void histogramFree(psHistogram* myHist);
    15031503
    15041504/******************************************************************************
    15051505    psStatsAlloc(): This routine must create a new psStats data structure.
    15061506 *****************************************************************************/
    1507 psStats *psStatsAlloc(psStatsOptions options)
    1508 {
    1509     psStats *newStruct = NULL;
    1510 
    1511     newStruct = (psStats *) psAlloc(sizeof(psStats));
     1507psStats* psStatsAlloc(psStatsOptions options)
     1508{
     1509    psStats* newStruct = NULL;
     1510
     1511    newStruct = (psStats* ) psAlloc(sizeof(psStats));
    15121512    newStruct->sampleMean = NAN;
    15131513    newStruct->sampleMedian = NAN;
     
    15481548    The histogram structure
    15491549 *****************************************************************************/
    1550 psHistogram *psHistogramAlloc(float lower, float upper, int n)
     1550psHistogram* psHistogramAlloc(float lower, float upper, int n)
    15511551{
    15521552    int i = 0;                  // Loop index variable
    1553     psHistogram *newHist = NULL;        // The new histogram structure
     1553    psHistogram* newHist = NULL;        // The new histogram structure
    15541554    float binSize = 0.0;        // The histogram bin size
    15551555
     
    15671567    // Allocate memory for the new histogram structure.  If there are N
    15681568    // bins, then there are N+1 bounds to those bins.
    1569     newHist = (psHistogram *) psAlloc(sizeof(psHistogram));
     1569    newHist = (psHistogram* ) psAlloc(sizeof(psHistogram));
    15701570    p_psMemSetDeallocator(newHist, (psFreeFcn) histogramFree);
    15711571    newHist->bounds = psVectorAlloc(n + 1, PS_TYPE_F32);
     
    16051605    The histogram structure
    16061606 *****************************************************************************/
    1607 psHistogram *psHistogramAllocGeneric(const psVector * restrict bounds)
    1608 {
    1609     psHistogram *newHist = NULL;        // The new histogram structure
     1607psHistogram* psHistogramAllocGeneric(const psVector* restrict bounds)
     1608{
     1609    psHistogram* newHist = NULL;        // The new histogram structure
    16101610    int i;                      // Loop index variable
    16111611
     
    16261626    }
    16271627    // Allocate memory for the new histogram structure.
    1628     newHist = (psHistogram *) psAlloc(sizeof(psHistogram));
     1628    newHist = (psHistogram* ) psAlloc(sizeof(psHistogram));
    16291629    p_psMemSetDeallocator(newHist, (psFreeFcn) histogramFree);
    16301630    newHist->bounds = psVectorAlloc(bounds->n, PS_TYPE_F32);
     
    16501650}
    16511651
    1652 static void histogramFree(psHistogram * myHist)
     1652static void histogramFree(psHistogram* myHist)
    16531653{
    16541654    psFree(myHist->bounds);
     
    16701670    The histogram structure "out".
    16711671 *****************************************************************************/
    1672 psHistogram *psVectorHistogram(psHistogram * out,
    1673                                const psVector * restrict in,
    1674                                const psVector * restrict mask, unsigned int maskVal)
     1672psHistogram* psVectorHistogram(psHistogram* out,
     1673                               const psVector* restrict in,
     1674                               const psVector* restrict mask, unsigned int maskVal)
    16751675{
    16761676    int i = 0;                  // Loop index variable
     
    17671767the various stat functions.
    17681768 *****************************************************************************/
    1769 psVector *p_psConvertToF32(psStats * stats, psVector * in, psVector * mask, unsigned int maskVal)
     1769psVector* p_psConvertToF32(psStats* stats, psVector* in, psVector* mask, unsigned int maskVal)
    17701770{
    17711771    int i = 0;
    1772     psVector *tmp = NULL;
     1772    psVector* tmp = NULL;
    17731773
    17741774    if (in->type.type == PS_TYPE_S32) {
     
    18121812macro-ize everything and add PS_TYPE_U16 and PS_TYPE_F64.
    18131813 *****************************************************************************/
    1814 psStats *psVectorStats(psStats * stats, psVector * in, psVector * mask, unsigned int maskVal)
    1815 {
    1816     psVector *inF32;
     1814psStats* psVectorStats(psStats* stats, psVector* in, psVector* mask, unsigned int maskVal)
     1815{
     1816    psVector* inF32;
    18171817    int mustFreeTmp = 1;
    18181818
Note: See TracChangeset for help on using the changeset viewer.