IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 2, 2021, 2:12:52 PM (5 years ago)
Author:
eugene
Message:

fix index for UQ and LQ (was ignored, but still)

File:
1 edited

Legend:

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

    r41503 r41520  
    377377    }
    378378
    379     int Qmin = (int)0.25*count;
    380     int Qmax = (int)0.75*count;
     379    int Qmin = (int)(0.25*count);
     380    int Qmax = (int)(0.75*count);
    381381    psAssert (Qmin >=           0, "oops");
    382382    psAssert (Qmin < outVector->n, "oops");
     
    385385
    386386    // Calculate the quartile points exactly.
    387     stats->sampleUQ = output[(int)(0.75*count)];
    388     stats->sampleLQ = output[(int)(0.25*count)];
    389 
     387    stats->sampleUQ = output[Qmax];
     388    stats->sampleLQ = output[Qmin];
     389     
    390390    stats->results |= PS_STAT_SAMPLE_MEDIAN;
    391391    stats->results |= PS_STAT_SAMPLE_QUARTILE;
     
    19151915        // NOTE: vectorSampleMedian only returns 'false' for very bad cases:
    19161916        // NULL input vector, psVectorCopy failure, invalid vector type (likely programming errors)
    1917         if (!vectorSampleMedian(inF32, maskVector, maskVal, stats)) {
    1918             psError(PS_ERR_UNKNOWN, false, "Failed to calculate sample median");
    1919             status &= false;
    1920         }
     1917        if (!vectorSampleMedian(inF32, maskVector, maskVal, stats)) {
     1918            psError(PS_ERR_UNKNOWN, false, "Failed to calculate sample median");
     1919            status &= false;
     1920        }
    19211921    }
    19221922
Note: See TracChangeset for help on using the changeset viewer.