root/library/tests/pdf_harness.h @ 706

Revision 706, 1.0 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 pdf.
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 pdf_HARNESS_H
14#define pdf_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
22namespace bdm {
23
24class pdf_harness : public root {
25private:
26        shared_ptr<pdf> hpdf;
27        vec cond;
28        vec mean;
29        vec variance;
30        int nsamples;
31        mat R;
32        double tolerance;
33
34public:
35        static void test_config ( const char *config_file_name );
36
37        pdf_harness() : nsamples ( 1000 ), tolerance ( 0.1 ) { }
38
39        virtual void test ( const char *config_name, int idx );
40
41        void from_setting ( const Setting &set );
42
43protected:
44        pdf *get_pdf() {
45                return hpdf.get();
46        }
47
48private:
49        void check_mean();
50
51        // assumes R is valid
52        void check_covariance();
53};
54UIREGISTER(pdf_harness);
55
56}
57
58#endif
Note: See TracBrowser for help on using the browser.