root/library/tests/epdf_harness.h @ 493

Revision 493, 1.5 kB (checked in by vbarta, 15 years ago)

fixed UIREGISTER

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"
[436]22
[477]23namespace bdm {
[436]24
[477]25class epdf_harness : public root {
[436]26private:
[477]27        shared_ptr<epdf> hepdf;
28        vec mean;
29        vec variance;
30        mat support;
[482]31        ivec nbins;
[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
71        void check_cond_mean( mprod &mep );
72
73        // assumes marginal_rv and R are valid
74        void check_cond_covariance( mprod &mep );
[436]75};
[493]76UIREGISTER(epdf_harness);
[436]77
78}
79
80#endif
Note: See TracBrowser for help on using the browser.