root/library/tests/epdf_harness.h @ 706

Revision 706, 1.5 kB (checked in by smidl, 15 years ago)

eol-native

  • Property svn:eol-style set to native
Line 
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"
21#include "stat/emix.h"
22
23namespace bdm {
24
25class epdf_harness : public root {
26private:
27        shared_ptr<epdf> hepdf;
28        vec mean;
29        vec variance;
30        mat support;
31        ivec nbins;
32        int nsamples;
33        mat R;
34        shared_ptr<RV> mrv;
35        double tolerance;
36
37public:
38        static void test_config ( const char *config_file_name );
39
40        epdf_harness() : nsamples ( 1000 ), tolerance ( 0.1 ) { }
41
42        virtual void test ( const char *config_name, int idx );
43
44        void from_setting ( const Setting &set );
45
46protected:
47        epdf *get_epdf() {
48                return hepdf.get();
49        }
50
51        double get_tolerance() const {
52                return tolerance;
53        }
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
71        void check_cond_mean( mprod &mep );
72
73        // assumes marginal_rv and R are valid
74        void check_cond_covariance( mprod &mep );
75};
76UIREGISTER(epdf_harness);
77
78}
79
80#endif
Note: See TracBrowser for help on using the browser.