|
Revision 493, 1.0 kB
(checked in by vbarta, 16 years ago)
|
|
fixed UIREGISTER
|
| Line | |
|---|
| 1 | /*! |
|---|
| 2 | \file |
|---|
| 3 | \brief Support for testing descendants of mpdf. |
|---|
| 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 MPDF_HARNESS_H |
|---|
| 14 | #define MPDF_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 | |
|---|
| 22 | namespace bdm { |
|---|
| 23 | |
|---|
| 24 | class mpdf_harness : public root { |
|---|
| 25 | private: |
|---|
| 26 | shared_ptr<mpdf> hmpdf; |
|---|
| 27 | vec cond; |
|---|
| 28 | vec mean; |
|---|
| 29 | vec variance; |
|---|
| 30 | int nsamples; |
|---|
| 31 | mat R; |
|---|
| 32 | double tolerance; |
|---|
| 33 | |
|---|
| 34 | public: |
|---|
| 35 | static void test_config ( const char *config_file_name ); |
|---|
| 36 | |
|---|
| 37 | mpdf_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 | |
|---|
| 43 | protected: |
|---|
| 44 | mpdf *get_mpdf() { |
|---|
| 45 | return hmpdf.get(); |
|---|
| 46 | } |
|---|
| 47 | |
|---|
| 48 | private: |
|---|
| 49 | void check_mean(); |
|---|
| 50 | |
|---|
| 51 | // assumes R is valid |
|---|
| 52 | void check_covariance(); |
|---|
| 53 | }; |
|---|
| 54 | UIREGISTER(mpdf_harness); |
|---|
| 55 | |
|---|
| 56 | } |
|---|
| 57 | |
|---|
| 58 | #endif |
|---|