IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 5155 for trunk/psLib/test/math


Ignore:
Timestamp:
Sep 27, 2005, 1:19:47 PM (21 years ago)
Author:
gusciora
Message:

Incorporates new prototypes for the spline functions.

Location:
trunk/psLib/test/math
Files:
3 added
5 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/math/Makefile.am

    r5001 r5155  
    77    tst_psFunc00 \
    88    tst_psFunc01 \
    9     tst_psFunc02 \
    10     tst_psFunc03 \
    11     tst_psFunc04 \
    12     tst_psFunc05 \
    13     tst_psFunc07 \
    149    tst_psFunc08 \
    1510    tst_psFunc09 \
     
    4843    tst_psStats08 \
    4944    tst_psStats09 \
     45    tst_psSpline1D \
    5046    tst_psRandom
    5147
    5248tst_psFunc00_SOURCES =  tst_psFunc00.c
    5349tst_psFunc01_SOURCES =  tst_psFunc01.c
    54 tst_psFunc02_SOURCES =  tst_psFunc02.c
    55 tst_psFunc03_SOURCES =  tst_psFunc03.c
    56 tst_psFunc04_SOURCES =  tst_psFunc04.c
    57 tst_psFunc05_SOURCES =  tst_psFunc05.c
    58 tst_psFunc07_SOURCES =  tst_psFunc07.c
    5950tst_psFunc08_SOURCES =  tst_psFunc08.c
    6051tst_psFunc09_SOURCES =  tst_psFunc09.c
  • trunk/psLib/test/math/tst_psStats07.c

    r5117 r5155  
    4444    /*  Allocate and initialize data structures                              */
    4545    /*************************************************************************/
     46    maskVector = psVectorAlloc( N, PS_TYPE_U8 );
     47    maskVector->n = N;
     48    myVector = p_psGaussianDev( MEAN, STDEV, N );
     49    // Set the mask vector and calculate the expected maximum.
     50    for ( i = 0;i < N;i++ ) {
     51        if ( i < ( N / 2 ) ) {
     52            maskVector->data.U8[ i ] = 0;
     53            count++;
     54        } else {
     55            maskVector->data.U8[ i ] = 1;
     56        }
     57    }
     58    psStats *mySampleStats = psStatsAlloc( PS_STAT_SAMPLE_MEAN |
     59                                           PS_STAT_SAMPLE_MEDIAN |
     60                                           PS_STAT_SAMPLE_STDEV |
     61                                           PS_STAT_SAMPLE_QUARTILE );
     62    mySampleStats = psVectorStats( mySampleStats, myVector, NULL, NULL, 0 );
     63    printf("The Sample Mean is %.2f\n", mySampleStats->sampleMean);
     64    printf("The Sample Median is %.2f\n", mySampleStats->sampleMedian);
     65    printf("The Sample stdev is %.2f\n", mySampleStats->sampleStdev);
     66    printf("The Sample quartiles are (%.2f %.2f)\n", mySampleStats->sampleLQ, mySampleStats->sampleUQ);
     67    psFree(mySampleStats);
     68
     69    psStats *mySampleStatsWithMask = psStatsAlloc( PS_STAT_SAMPLE_MEAN |
     70                                     PS_STAT_SAMPLE_MEDIAN |
     71                                     PS_STAT_SAMPLE_STDEV |
     72                                     PS_STAT_SAMPLE_QUARTILE );
     73    mySampleStatsWithMask = psVectorStats( mySampleStatsWithMask, myVector, NULL, maskVector, 1 );
     74    printf("The Sample Mean is %.2f\n", mySampleStatsWithMask->sampleMean);
     75    printf("The Sample Median is %.2f\n", mySampleStatsWithMask->sampleMedian);
     76    printf("The Sample stdev is %.2f\n", mySampleStatsWithMask->sampleStdev);
     77    printf("The Sample quartiles are (%.2f %.2f)\n", mySampleStatsWithMask->sampleLQ, mySampleStatsWithMask->sampleUQ);
     78    psFree(mySampleStatsWithMask);
     79
    4680    myStats = psStatsAlloc( PS_STAT_ROBUST_MEAN |
    4781                            PS_STAT_ROBUST_MEDIAN |
     
    4983                            PS_STAT_ROBUST_STDEV |
    5084                            PS_STAT_ROBUST_QUARTILE );
    51 
    52     maskVector = psVectorAlloc( N, PS_TYPE_U8 );
    53     maskVector->n = N;
    54     myVector = p_psGaussianDev( MEAN, STDEV, N );
    5585    // Create a full outliers:
    5686    myVector->data.F32[N/4] = -1000.0 * MEAN;
    5787    myVector->data.F32[N/2] = 1000.0 * MEAN;
    58     // Set the mask vector and calculate the expected maximum.
    59     for ( i = 0;i < N;i++ ) {
    60         if ( i < ( N / 2 ) ) {
    61             maskVector->data.U8[ i ] = 0;
    62             count++;
    63         } else {
    64             maskVector->data.U8[ i ] = 1;
    65         }
    66     }
    6788    /*************************************************************************/
    6889    /*  Call psVectorStats() with no vector mask.                            */
Note: See TracChangeset for help on using the changeset viewer.