IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 23416


Ignore:
Timestamp:
Mar 18, 2009, 4:54:42 PM (17 years ago)
Author:
eugene
Message:

do not error on nan values in vector; just skip them

File:
1 edited

Legend:

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

    r23327 r23416  
    265265    for (long i = 0; i < num; i++) {
    266266        // Check if the data is with the specified range
    267         if (maskData && (maskData[i] & maskVal)) {
     267        if (!isfinite(vector[i]))
     268            continue;
     269        if (useRange && (vector[i] < stats->min))
    268270            continue;
    269         }
    270 
    271         if (useRange) {
    272             if (vector[i] < stats->min || vector[i] > stats->max) {
    273                 continue;
    274             }
    275         } else if (!isfinite(vector[i])) {
    276             stats->max = stats->min = NAN;
    277             psError(PS_ERR_IEEE, true, "Element %ld of vector is Inf/NaN", i);
    278             return 0;
    279         }
     271        if (useRange && (vector[i] > stats->max))
     272            continue;
     273        if (maskData && (maskData[i] & maskVal))
     274            continue;
    280275
    281276        numValid++;
Note: See TracChangeset for help on using the changeset viewer.