[607] | 1 | #include "estim/arx.h" |
---|
| 2 | #include "mat_checks.h" |
---|
| 3 | |
---|
| 4 | using namespace bdm; |
---|
| 5 | |
---|
[698] | 6 | TEST ( arx_straux_test ) { |
---|
[607] | 7 | |
---|
[698] | 8 | UIFile F ( "arx_straux_test.cfg" ); |
---|
| 9 | |
---|
| 10 | Setting &tests=F.getRoot() ["tests"]; |
---|
| 11 | for ( int i=0;i<tests.getLength(); i++ ) { |
---|
| 12 | mat A; |
---|
| 13 | mat B; |
---|
| 14 | ivec o1_ok; |
---|
| 15 | UI::get ( A,tests[i],"A",UI::compulsory ); |
---|
| 16 | UI::get ( B,tests[i],"B",UI::compulsory ); |
---|
| 17 | UI::get ( o1_ok,tests[i],"o1",UI::compulsory ); |
---|
| 18 | |
---|
[607] | 19 | //when updateing matrices do not forget to update CHECK_EQUAL below!!! |
---|
| 20 | |
---|
[698] | 21 | ldmat Ld0 ( 3 ); Ld0.ldform ( A,ones ( A.rows() ) ); |
---|
| 22 | ldmat Ld1 ( 3 ); Ld1.ldform ( A+B,ones ( A.rows() ) ); |
---|
[647] | 23 | |
---|
[607] | 24 | |
---|
[698] | 25 | ivec belief = vec_1 ( 2 ); // default belief |
---|
| 26 | int nbest = 3; // nbest: how many regressors are returned |
---|
| 27 | int nrep = 5; // nrep: number of random repetions of structure estimation |
---|
| 28 | double lambda = 0.9; |
---|
| 29 | int k=2; |
---|
| 30 | |
---|
| 31 | //[strout, rgrsout, statistics] = |
---|
[607] | 32 | // straux1(L, d, nu, L0, d0, nu0, belief, nbest, max_nrep, lambda, |
---|
| 33 | // order_k); |
---|
[698] | 34 | Array<str_aux> o2; |
---|
| 35 | ivec o1 = straux1 ( Ld1,20, Ld0, 10, belief, nbest, nrep, lambda, k, o2 ); |
---|
[607] | 36 | |
---|
[698] | 37 | //o1 is messed up in matlab's straux |
---|
| 38 | sort ( o1_ok ); |
---|
| 39 | sort ( o1 ); |
---|
| 40 | CHECK_EQUAL ( o1_ok, o1 ); |
---|
| 41 | } |
---|
[607] | 42 | |
---|
| 43 | } |
---|