IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 23, 2004, 9:35:30 AM (22 years ago)
Author:
gusciora
Message:

...

File:
1 edited

Legend:

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

    r2370 r2406  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.97 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-11-15 21:13:17 $
     11 *  @version $Revision: 1.98 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-11-23 19:35:30 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    146146this routine sets stats->sampleMean to NAN.
    147147 *****************************************************************************/
    148 void p_psVectorSampleMean(const psVector* restrict myVector,
    149                           const psVector* restrict maskVector,
    150                           psU32 maskVal,
    151                           psStats* stats)
     148int p_psVectorSampleMean(const psVector* restrict myVector,
     149                         const psVector* restrict maskVector,
     150                         psU32 maskVal,
     151                         psStats* stats)
    152152{
    153153    psS32 i = 0;                // Loop index variable
     
    210210
    211211    stats->sampleMean = mean;
     212    if (isnan(mean)) {
     213        return(0);
     214    } else {
     215        return(-1);
     216    }
     217
    212218}
    213219
     
    217223this routine sets stats->max to NAN.
    218224 *****************************************************************************/
    219 void p_psVectorMax(const psVector* restrict myVector,
    220                    const psVector* restrict maskVector,
    221                    psU32 maskVal,
    222                    psStats* stats)
     225int p_psVectorMax(const psVector* restrict myVector,
     226                  const psVector* restrict maskVector,
     227                  psU32 maskVal,
     228                  psStats* stats)
    223229{
    224230    psS32 i = 0;                // Loop index variable
     
    272278    } else {
    273279        stats->max = NAN;
    274     }
     280        return(1);
     281    }
     282    return(0);
    275283}
    276284
     
    280288this routine sets stats->min to NAN.
    281289 *****************************************************************************/
    282 void p_psVectorMin(const psVector* restrict myVector,
    283                    const psVector* restrict maskVector,
    284                    psU32 maskVal,
    285                    psStats* stats)
     290int p_psVectorMin(const psVector* restrict myVector,
     291                  const psVector* restrict maskVector,
     292                  psU32 maskVal,
     293                  psStats* stats)
    286294{
    287295    psS32 i = 0;                // Loop index variable
     
    335343    } else {
    336344        stats->min = NAN;
    337     }
     345        return(1);
     346    }
     347    return(0);
    338348}
    339349
     
    12051215    // Determine minimum and maximum values in the data vector.
    12061216    if (isnan(stats->min)) {
    1207         p_psVectorMin(myVector, maskVector, maskVal, stats);
    1208     }
     1217        if (0 != p_psVectorMin(myVector, maskVector, maskVal, stats)) {
     1218            psLogMsg(__func__, PS_LOG_WARN,
     1219                     "WARNING: p_psVectorMin(): p_psVectorMin() reported a NAN mean.\n");
     1220            return(1);
     1221        }
     1222    }
     1223
     1224
    12091225    if (isnan(stats->max)) {
    1210         p_psVectorMax(myVector, maskVector, maskVal, stats);
     1226        if (0 != p_psVectorMax(myVector, maskVector, maskVal, stats)) {}
    12111227    }
    12121228
     
    17711787    // ************************************************************************
    17721788    if (stats->options & PS_STAT_MAX) {
    1773         p_psVectorMax(inF32, mask, maskVal, stats);
     1789        if (0 != p_psVectorMax(inF32, mask, maskVal, stats)) {
     1790            psError(PS_ERR_UNKNOWN, false,
     1791                    "Failed to calculate vector maximum");
     1792            psFree(stats);
     1793            return(NULL);
     1794        }
    17741795    }
    17751796    // ************************************************************************
    17761797    if (stats->options & PS_STAT_MIN) {
    1777         p_psVectorMin(inF32, mask, maskVal, stats);
     1798        if (0 != p_psVectorMin(inF32, mask, maskVal, stats)) {
     1799            psError(PS_ERR_UNKNOWN, false,
     1800                    "Failed to calculate vector minimum");
     1801            psFree(stats);
     1802            return(NULL);
     1803        }
    17781804    }
    17791805
Note: See TracChangeset for help on using the changeset viewer.