Changeset 2406 for trunk/psLib/src/math/psStats.c
- Timestamp:
- Nov 23, 2004, 9:35:30 AM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/math/psStats.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/math/psStats.c
r2370 r2406 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.9 7$ $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 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 146 146 this routine sets stats->sampleMean to NAN. 147 147 *****************************************************************************/ 148 voidp_psVectorSampleMean(const psVector* restrict myVector,149 const psVector* restrict maskVector,150 psU32 maskVal,151 psStats* stats)148 int p_psVectorSampleMean(const psVector* restrict myVector, 149 const psVector* restrict maskVector, 150 psU32 maskVal, 151 psStats* stats) 152 152 { 153 153 psS32 i = 0; // Loop index variable … … 210 210 211 211 stats->sampleMean = mean; 212 if (isnan(mean)) { 213 return(0); 214 } else { 215 return(-1); 216 } 217 212 218 } 213 219 … … 217 223 this routine sets stats->max to NAN. 218 224 *****************************************************************************/ 219 voidp_psVectorMax(const psVector* restrict myVector,220 const psVector* restrict maskVector,221 psU32 maskVal,222 psStats* stats)225 int p_psVectorMax(const psVector* restrict myVector, 226 const psVector* restrict maskVector, 227 psU32 maskVal, 228 psStats* stats) 223 229 { 224 230 psS32 i = 0; // Loop index variable … … 272 278 } else { 273 279 stats->max = NAN; 274 } 280 return(1); 281 } 282 return(0); 275 283 } 276 284 … … 280 288 this routine sets stats->min to NAN. 281 289 *****************************************************************************/ 282 voidp_psVectorMin(const psVector* restrict myVector,283 const psVector* restrict maskVector,284 psU32 maskVal,285 psStats* stats)290 int p_psVectorMin(const psVector* restrict myVector, 291 const psVector* restrict maskVector, 292 psU32 maskVal, 293 psStats* stats) 286 294 { 287 295 psS32 i = 0; // Loop index variable … … 335 343 } else { 336 344 stats->min = NAN; 337 } 345 return(1); 346 } 347 return(0); 338 348 } 339 349 … … 1205 1215 // Determine minimum and maximum values in the data vector. 1206 1216 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 1209 1225 if (isnan(stats->max)) { 1210 p_psVectorMax(myVector, maskVector, maskVal, stats);1226 if (0 != p_psVectorMax(myVector, maskVector, maskVal, stats)) {} 1211 1227 } 1212 1228 … … 1771 1787 // ************************************************************************ 1772 1788 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 } 1774 1795 } 1775 1796 // ************************************************************************ 1776 1797 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 } 1778 1804 } 1779 1805
Note:
See TracChangeset
for help on using the changeset viewer.
