root/library/tests/epdf_harness.h @ 730

Revision 730, 1.6 kB (checked in by smidl, 15 years ago)

Reworked epdf_harness - testing is now more general.

Corrections of existing tests.

  • Property svn:eol-style set to native
RevLine 
[436]1/*!
2  \file
3  \brief Support for testing descendants of epdf.
4  \author Vaclav Barta.
5
6  -----------------------------------
7  BDM++ - C++ library for Bayesian Decision Making under Uncertainty
8
9  Using IT++ for numerical operations
10  -----------------------------------
11*/
12
13#ifndef EPDF_HARNESS_H
14#define EPDF_HARNESS_H
15
16#include "bdmroot.h"
17#include "itpp_ext.h"
18#include "shared_ptr.h"
19#include "base/bdmbase.h"
20#include "base/user_info.h"
[481]21#include "stat/emix.h"
[730]22#include <stat/discrete.h>
[436]23
[477]24namespace bdm {
[436]25
[477]26class epdf_harness : public root {
[436]27private:
[477]28        shared_ptr<epdf> hepdf;
29        vec mean;
30        vec variance;
[730]31        shared_ptr<rectangular_support> support;
[477]32        int nsamples;
33        mat R;
34        shared_ptr<RV> mrv;
35        double tolerance;
[436]36
37public:
[477]38        static void test_config ( const char *config_file_name );
[436]39
[477]40        epdf_harness() : nsamples ( 1000 ), tolerance ( 0.1 ) { }
[436]41
[477]42        virtual void test ( const char *config_name, int idx );
[456]43
[477]44        void from_setting ( const Setting &set );
[439]45
46protected:
[477]47        epdf *get_epdf() {
48                return hepdf.get();
49        }
[456]50
[477]51        double get_tolerance() const {
52                return tolerance;
53        }
[481]54
55private:
56        // assumes support is valid
57        void check_support_mean();
58
59        // assumes support is valid
60        void check_support_integral();
61
62        // assumes R is valid - it probably shouldn't, but calling it
63        // unconditionally leads to a lot of not implemented
64        // functions...
65        void check_sample_mean();
66
67        // assumes R is valid
68        void check_covariance();
69
70        // assumes marginal_rv is valid
[722]71        void check_cond_mean ( mprod &mep );
[481]72
73        // assumes marginal_rv and R are valid
[722]74        void check_cond_covariance ( mprod &mep );
[436]75};
[722]76UIREGISTER ( epdf_harness );
[436]77
78}
79
80#endif
Note: See TracBrowser for help on using the browser.