Changeset 698
- Timestamp:
- 11/03/09 00:03:42 (15 years ago)
- Location:
- library/tests
- Files:
-
- 1 added
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
library/tests/arx_straux_test.cpp
r689 r698 4 4 using namespace bdm; 5 5 6 TEST(arx_straux_test){ 7 mat A="0.8147 0.9134 0.2785;" 8 "0.9058 0.6324 0.5469;" 9 "0.1270 0.0975 0.9575"; 6 TEST ( arx_straux_test ) { 10 7 11 mat B="0.9649 0.9572 0.1419;" 12 "0.1576 0.4854 0.4218;" 13 "0.9706 0.8003 0.9157"; 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 14 19 //when updateing matrices do not forget to update CHECK_EQUAL below!!! 15 16 ldmat Ld0(3); Ld0.ldform(A,ones(3));17 ldmat Ld1(3); Ld1.ldform(A+B,ones(3));20 21 ldmat Ld0 ( 3 ); Ld0.ldform ( A,ones ( A.rows() ) ); 22 ldmat Ld1 ( 3 ); Ld1.ldform ( A+B,ones ( A.rows() ) ); 18 23 19 24 20 ivec belief = vec_1(2);// default belief21 int nbest = 3; // nbest: how many regressors are returned22 int nrep = 5; // nrep: number of random repetions of structure estimation23 double lambda = 0.9; 24 int k=2;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; 25 30 26 //[strout, rgrsout, statistics] = 31 //[strout, rgrsout, statistics] = 27 32 // straux1(L, d, nu, L0, d0, nu0, belief, nbest, max_nrep, lambda, 28 33 // order_k); 29 Array<str_aux> o2;30 ivec o1 = straux1(Ld1,20, Ld0, 10, belief, nbest, nrep, lambda, k, o2);34 Array<str_aux> o2; 35 ivec o1 = straux1 ( Ld1,20, Ld0, 10, belief, nbest, nrep, lambda, k, o2 ); 31 36 32 33 CHECK_EQUAL(ivec("2 3"), o1); 37 //o1 is messed up in matlab's straux 38 sort ( o1_ok ); 39 sort ( o1 ); 40 CHECK_EQUAL ( o1_ok, o1 ); 41 } 34 42 35 43 }