IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 28, 2006, 6:38:42 PM (20 years ago)
Author:
magnier
Message:

changed return value for psVectorFit functions to bool; now using stats->option to set FitClip

Location:
trunk/psLib/test/math
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/math

    • Property svn:ignore
      •  

        old new  
        44Makefile
        55Makefile.in
        6 tst_psFunc01
        7 tst_psHist00
        8 tst_psHist01
        9 tst_psHist02
        10 tst_psHist03
        11 tst_psMatrix01
        12 tst_psMatrix02
        13 tst_psMatrix03
        14 tst_psMatrix04
        15 tst_psMatrix05
        16 tst_psMatrix06
        17 tst_psMatrix07
        18 tst_psMatrixVectorArithmetic01
        19 tst_psMatrixVectorArithmetic02
        20 tst_psMatrixVectorArithmetic03
        21 tst_psMatrixVectorArithmetic04
        22 tst_psRandom
        23 tst_psStats00
        24 tst_psStats01
        25 tst_psStats02
        26 tst_psStats03
        27 tst_psStats05
        28 tst_psStats06
        29 tst_psStats07
        30 tst_psStats08
        31 tst_psStats09
        326seed_msglog1.txt
        337seed_msglog2.txt
        34 tst_psSpline1D
        35 tst_psMathUtils
        36 tst_psMinimizeLMM
        37 tst_psMinimizePowell
        38 tst_psPolyFit1D
        39 tst_psPolyFit2D
        40 tst_psPolyFit3D
        41 tst_psPolyFit4D
        42 tst_psPolynomial
        43 tst_psPolynomialEval1D
        44 tst_psPolynomialEval2D
        45 tst_psPolynomialEval3D
        46 tst_psPolynomialEval4D
        478*.bb
        489*.bbg
        4910*.da
        5011gmon.out
         12tap_psHist00
         13tap_psHist01
         14tap_psHist02
         15tap_psHist03
         16tap_psMD5
         17tap_psMatrix01
         18tap_psMatrix02
         19tap_psMatrix03
         20tap_psMatrix04
         21tap_psMatrix05
         22tap_psMatrix06
         23tap_psMatrix07
         24tap_psPolyFit1D
         25tap_psPolyFit2D
         26tap_psPolyFit3D
         27tap_psPolyFit4D
         28tap_psPolynomial
         29tap_psPolynomialEval1D
         30tap_psPolynomialEval2D
         31tap_psPolynomialEval3D
         32tap_psPolynomialEval4D
         33tap_psPolynomialUtils_Derivatives
        5134tap_psSparse
         35tap_psStats00
         36tap_psStats01
         37tap_psStats02
         38tap_psStats03
         39tap_psStats05
         40tap_psStats06
         41tap_psStats07
         42tap_psStats08
         43tap_psStats09
        5244tap_psStatsTiming
        53 tap_psMD5
        5445tap_psStats_Sample_01
        55 tap_psPolynomialUtils_Derivatives
  • trunk/psLib/test/math/tap_psStats00.c

    r10831 r10848  
    1 @file  tst_psStats00.c
    2 *
    3 *  @brief Contains tests for psVectorStats with sample mean calculations
    4 *
    5 *  We extensively test the code with data type PS_TYPE_F32.  If these pass, we
    6 *  do
    7     a much simpler test with data type PS_TYPE_U8, PS_TYPE_U16, PS_TYPE_F64.
    8     *
    9     *  @author GLG, MHPCC
    10     *
    11 *  @version $Revision:
    12 1.8 $  $Name:
    13     $
    14 *  @date $Date:
    15 2006/07/28 00:
    16 44:
    17     05 $
    18     *
    19     *  Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii
    20     */
    21     #include <stdio.h>
    22     #include <string.h>
    23     #include <pslib.h>
    24     #include "tap.h"
    25     #include "pstap.h"
    26 
    27     #define N 15
    28 
    29     static psF32 samplesF32[N] =
    30             {
    31                 1.1, 2.2, -3.3, 4.4, 5.5, -6.6, 7.7, 8.8, -9.9, 10.0,
    32                 11.01, -12.02, 13.03, 14.04, -15.05
    33             };
     1/** @file  tst_psStats00.c
     2 *
     3 *  @brief Contains tests for psVectorStats with sample mean calculations
     4 *
     5 
     6 *  We extensively test the code with data type PS_TYPE_F32.  If these pass, we do a much
     7 *  simpler test with data type PS_TYPE_U8, PS_TYPE_U16, PS_TYPE_F64.
     8 *
     9 *  @author GLG, MHPCC
     10 *
     11 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2006-12-29 04:38:42 $
     13 *
     14 *  Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii
     15 */
     16
     17#include <stdio.h>
     18#include <string.h>
     19#include <pslib.h>
     20#include "tap.h"
     21#include "pstap.h"
     22
     23#define N 15
     24
     25static psF32 samplesF32[N] =
     26    {
     27        1.1, 2.2, -3.3, 4.4, 5.5, -6.6, 7.7, 8.8, -9.9, 10.0,
     28        11.01, -12.02, 13.03, 14.04, -15.05
     29    };
    3430static psS8  samplesS8[N]  =
    3531    {
     
    9288    {
    9389        psMemId id = psMemGetId();
    94         myStats = psVectorStats(myStats, myVector, NULL, NULL, 0);
     90        bool result = psVectorStats(myStats, myVector, NULL, NULL, 0);
     91        ok(result, "psVectorStats suceeded");
    9592        ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN");
    9693        ok_float_tol(myStats->sampleMean, expectedMeanNoMaskF32, 1e-4,
     
    10299    {
    103100        psMemId id = psMemGetId();
    104         myStats = psVectorStats(myStats, myVector, myErrors, NULL, 0);
     101        bool result = psVectorStats(myStats, myVector, myErrors, NULL, 0);
     102        ok(result, "psVectorStats suceeded");
    105103        ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN");
    106104        ok_float_tol(myStats->sampleMean, expectedWeightMeanNoMaskF32, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedWeightMeanNoMaskF32);
     
    114112        myStats->min = -10.0;
    115113        myStats->max =   8.0;
    116         myStats = psVectorStats(myStats, myVector, NULL, NULL, 0);
     114        bool result = psVectorStats(myStats, myVector, NULL, NULL, 0);
     115        ok(result, "psVectorStats suceeded");
    117116        ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN");
    118117        ok_float_tol(myStats->sampleMean, expectedMeanRangeNoMaskF32, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedMeanRangeNoMaskF32);
     
    125124        psMemId id = psMemGetId();
    126125        myStats->options = PS_STAT_SAMPLE_MEAN | PS_STAT_USE_RANGE;
    127         myStats = psVectorStats(myStats, myVector, myErrors, NULL, 0);
     126        bool result = psVectorStats(myStats, myVector, myErrors, NULL, 0);
     127        ok(result, "psVectorStats suceeded");
    128128        ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN");
    129129        ok_float_tol(myStats->sampleMean, expectedWeightMeanNoMaskRangeF32, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedWeightMeanNoMaskRangeF32);
     
    135135        psMemId id = psMemGetId();
    136136        myStats->options = PS_STAT_SAMPLE_MEAN;
    137         myStats = psVectorStats(myStats, myVector, NULL, maskVector, 1);
     137        bool result = psVectorStats(myStats, myVector, NULL, maskVector, 1);
     138        ok(result, "psVectorStats suceeded");
    138139        ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN");
    139140        ok_float_tol(myStats->sampleMean, expectedMeanWithMaskF32, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedMeanWithMaskF32);
     
    144145    {
    145146        psMemId id = psMemGetId();
    146         myStats = psVectorStats(myStats, myVector, myErrors, maskVector, 1);
     147        bool result = psVectorStats(myStats, myVector, myErrors, maskVector, 1);
     148        ok(result, "psVectorStats suceeded");
    147149        ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN");
    148150        ok_float_tol(myStats->sampleMean, expectedWeightMeanWithMaskF32, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedWeightMeanWithMaskF32);
     
    154156        psMemId id = psMemGetId();
    155157        myStats->options = PS_STAT_SAMPLE_MEAN | PS_STAT_USE_RANGE;
    156         myStats = psVectorStats(myStats, myVector, NULL, maskVector, 1);
     158        bool result = psVectorStats(myStats, myVector, NULL, maskVector, 1);
     159        ok(result, "psVectorStats suceeded");
    157160        ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN");
    158161        ok_float_tol(myStats->sampleMean, expectedMeanRangeWithMaskF32, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedMeanRangeWithMaskF32);
     
    163166    {
    164167        psMemId id = psMemGetId();
    165         myStats = psVectorStats(myStats, myVector, myErrors, maskVector, 1);
     168        bool result = psVectorStats(myStats, myVector, myErrors, maskVector, 1);
     169        ok(result, "psVectorStats suceeded");
    166170        ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN");
    167171        ok_float_tol(myStats->sampleMean, expectedWeightMeanWithMaskRangeF32, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedWeightMeanWithMaskRangeF32);
     
    178182            }
    179183        }
    180         myStats = psVectorStats(myStats, myVector, NULL, maskVector, 2);
     184        bool result = psVectorStats(myStats, myVector, NULL, maskVector, 2);
     185        ok(result, "psVectorStats suceeded");
    181186        ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN");
    182187        ok_float_tol(myStats->sampleMean, expectedMeanWithMaskF32, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedMeanWithMaskF32);
     
    193198            }
    194199        }
    195         myStats = psVectorStats(myStats, myVector, NULL, maskVector, 4);
     200        bool result = psVectorStats(myStats, myVector, NULL, maskVector, 4);
     201        ok(result, "psVectorStats suceeded");
    196202        ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN");
    197203        ok_float_tol(myStats->sampleMean, expectedMeanNoMaskF32, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedMeanNoMaskF32);
     
    206212            maskVector->data.U8[i] = 1;
    207213        }
    208         myStats = psVectorStats(myStats, myVector, NULL, maskVector, 1);
     214        bool result = psVectorStats(myStats, myVector, NULL, maskVector, 1);
     215        ok(result, "psVectorStats suceeded");
    209216        ok(isnan(myStats->sampleMean), "psVectorStats() returned NAN");
    210217        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     
    214221    {
    215222        psMemId id = psMemGetId();
    216         ok(psVectorStats(myStats, NULL, NULL, NULL, 0) == NULL, "psVectorStats() returned NULL with NULL inputs");
    217         ok(psVectorStats(NULL, myVector, NULL, NULL, 0) == NULL, "psVectorStats() returned NULL with NULL inputs");
    218         ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    219     }
    220 
    221 
    222 
    223 
    224 
    225 
    226 
    227 
    228 
    229 
     223        ok(!psVectorStats(myStats, NULL, NULL, NULL, 0), "psVectorStats() returned false with NULL inputs");
     224        ok(!psVectorStats(NULL, myVector, NULL, NULL, 0), "psVectorStats() returned false with NULL inputs");
     225        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     226    }
    230227
    231228    psFree(myStats);
     
    247244        }
    248245
    249         myStats = psVectorStats(myStats, myVector, NULL, NULL, 0);
     246        bool result = psVectorStats(myStats, myVector, NULL, NULL, 0);
     247        ok(result, "psVectorStats suceeded");
    250248        ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN");
    251249        ok_float_tol(myStats->sampleMean, expectedMeanNoMaskS8, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedMeanNoMaskS8);
     
    267265        }
    268266
    269         myStats = psVectorStats(myStats, myVector, NULL, NULL, 0);
     267        bool result = psVectorStats(myStats, myVector, NULL, NULL, 0);
     268        ok(result, "psVectorStats suceeded");
    270269        ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN");
    271270        ok_float_tol(myStats->sampleMean, expectedMeanNoMaskU16, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedMeanNoMaskU16);
     
    286285        }
    287286
    288         myStats = psVectorStats(myStats, myVector, NULL, NULL, 0);
     287        bool result = psVectorStats(myStats, myVector, NULL, NULL, 0);
     288        ok(result, "psVectorStats suceeded");
    289289        ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN");
    290290        ok_float_tol(myStats->sampleMean, expectedMeanNoMaskF64, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedMeanNoMaskF64);
Note: See TracChangeset for help on using the changeset viewer.