Changeset 766 for library/tests
- Timestamp:
- 01/11/10 22:55:57 (15 years ago)
- Location:
- library/tests
- Files:
-
- 5 modified
Legend:
- Unmodified
- Added
- Removed
-
library/tests/stresssuite/arx_stress.cpp
r722 r766 24 24 //Test constructor 25 25 mat V0 = 0.00001 * eye ( ord + 1 ); 26 V0 ( 0 .0) = 1; //26 V0 ( 0 ) = 1; // 27 27 double nu0 = ord + 5.0; 28 28 -
library/tests/stresssuite/mixtures_stress.cpp
r750 r766 67 67 emix Simul; 68 68 Simul.set_rv ( x ); 69 Simul.set_parameters ( "0.5 0.6", Sim ); 69 Simul._w() = "0.5 0.6"; 70 Simul._Coms() = Sim; 70 71 Simul.validate(); 71 72 -
library/tests/stresssuite/square_mat_stress.cpp
r717 r766 60 60 61 61 tt.tic(); 62 TMatrix sq mat ( A );62 TMatrix sq_mat ( A ); 63 63 double elapsed = tt.toc(); 64 64 cout << "ctor(" << sz << " x " << sz << "): " << elapsed << " s" << endl; 65 65 66 66 tt.tic(); 67 mat res = sq mat.to_mat();67 mat res = sq_mat.to_mat(); 68 68 elapsed = tt.toc(); 69 69 … … 76 76 vec v = point->get_vector(); 77 77 double w = point->get_scalar(); 78 TMatrix sq mat2 = sqmat;79 80 tt.tic(); 81 sq mat2.opupdt ( v, w );78 TMatrix sq_mat2 = sq_mat; 79 80 tt.tic(); 81 sq_mat2.opupdt ( v, w ); 82 82 elapsed = tt.toc(); 83 83 84 84 if ( !fast ) { 85 85 mat expA = A + w * outer_product ( v, v ); 86 CHECK_CLOSE ( expA, sq mat2.to_mat(), epsilon );86 CHECK_CLOSE ( expA, sq_mat2.to_mat(), epsilon ); 87 87 } 88 88 … … 92 92 93 93 tt.tic(); 94 sq mat.inv ( invmat );94 sq_mat.inv ( invmat ); 95 95 elapsed = tt.toc(); 96 96 … … 104 104 105 105 tt.tic(); 106 double ld = sq mat.logdet();106 double ld = sq_mat.logdet(); 107 107 elapsed = tt.toc(); 108 108 … … 115 115 116 116 tt.tic(); 117 double q = sq mat.qform ( ones ( sz ) );117 double q = sq_mat.qform ( ones ( sz ) ); 118 118 elapsed = tt.toc(); 119 119 … … 125 125 126 126 tt.tic(); 127 q = sq mat.qform ( v );127 q = sq_mat.qform ( v ); 128 128 elapsed = tt.toc(); 129 129 … … 136 136 137 137 tt.tic(); 138 q = sq mat.invqform ( v );138 q = sq_mat.invqform ( v ); 139 139 elapsed = tt.toc(); 140 140 … … 146 146 cout << "invqform: " << elapsed << " s" << endl; 147 147 148 TMatrix twice = sq mat;149 150 tt.tic(); 151 twice += sq mat;148 TMatrix twice = sq_mat; 149 150 tt.tic(); 151 twice += sq_mat; 152 152 elapsed = tt.toc(); 153 153 … … 159 159 cout << "+=: " << elapsed << " s" << endl; 160 160 161 sq mat2 = sqmat;162 163 tt.tic(); 164 sq mat2.mult_sym ( A );161 sq_mat2 = sq_mat; 162 163 tt.tic(); 164 sq_mat2.mult_sym ( A ); 165 165 elapsed = tt.toc(); 166 166 167 167 if ( !fast ) { 168 168 res = ( A * A ) * A.T(); 169 CHECK_CLOSE ( res, sq mat2.to_mat(), epsilon );169 CHECK_CLOSE ( res, sq_mat2.to_mat(), epsilon ); 170 170 } 171 171 -
library/tests/testsuite/emix_test.cpp
r750 r766 38 38 emix M1; 39 39 M1.set_rv ( xy ); 40 M1.set_parameters ( vec ( "1" ), A1 ); 40 M1._Coms() = A1; 41 M1._w() = 1; 41 42 M1.validate(); 42 43 … … 68 69 emix M2; 69 70 M2.set_rv ( xy ); 70 M2.set_parameters ( vec ( "1" ), A2 ); 71 M2._Coms() = A2; 72 M2._w() = 1; 71 73 M2.validate(); 72 74 -
library/tests/testsuite/square_mat_test.cpp
r717 r766 20 20 mat A = A0 * A0.T(); 21 21 22 TMatrix sq mat ( A );23 CHECK_EQUAL ( sz, sq mat.rows() );24 CHECK_EQUAL ( sz, sq mat.cols() );22 TMatrix sq_mat ( A ); 23 CHECK_EQUAL ( sz, sq_mat.rows() ); 24 CHECK_EQUAL ( sz, sq_mat.cols() ); 25 25 26 mat res = sq mat.to_mat();26 mat res = sq_mat.to_mat(); 27 27 CHECK_CLOSE ( A, res, epsilon ); 28 28 29 29 vec v = randu ( sz ); 30 30 double w = randu(); 31 TMatrix sq mat2 = sqmat;32 sq mat2.opupdt ( v, w );31 TMatrix sq_mat2 = sq_mat; 32 sq_mat2.opupdt ( v, w ); 33 33 34 34 res = A + w * outer_product ( v, v ); 35 CHECK_CLOSE ( res, sq mat2.to_mat(), epsilon );35 CHECK_CLOSE ( res, sq_mat2.to_mat(), epsilon ); 36 36 37 37 TMatrix invmat ( sz ); 38 sq mat.inv ( invmat );38 sq_mat.inv ( invmat ); 39 39 mat invA = inv ( A ); 40 40 CHECK_CLOSE ( invA, invmat.to_mat(), epsilon ); 41 41 42 42 double d = det ( A ); 43 CHECK_CLOSE ( log ( d ), sq mat.logdet(), epsilon );43 CHECK_CLOSE ( log ( d ), sq_mat.logdet(), epsilon ); 44 44 45 double q = sq mat.qform ( ones ( sz ) );45 double q = sq_mat.qform ( ones ( sz ) ); 46 46 CHECK_CLOSE ( sumsum ( A ), q, epsilon ); 47 47 48 q = sq mat.qform ( v );48 q = sq_mat.qform ( v ); 49 49 double r = ( A * v ) * v; 50 50 CHECK_CLOSE ( r, q, epsilon ); 51 51 52 q = sq mat.invqform ( v );52 q = sq_mat.invqform ( v ); 53 53 r = ( invA * v ) * v; 54 54 CHECK_CLOSE ( r, q, epsilon ); 55 55 56 sq mat2 = sqmat;57 sq mat2.clear();58 CHECK_EQUAL ( 0, sq mat2.qform ( ones ( sz ) ) );56 sq_mat2 = sq_mat; 57 sq_mat2.clear(); 58 CHECK_EQUAL ( 0, sq_mat2.qform ( ones ( sz ) ) ); 59 59 60 TMatrix twice = sq mat;61 twice += sq mat;60 TMatrix twice = sq_mat; 61 twice += sq_mat; 62 62 res = 2 * A; 63 63 CHECK_CLOSE ( res, twice.to_mat(), epsilon ); 64 64 65 twice = sq mat;65 twice = sq_mat; 66 66 twice *= 2; 67 67 CHECK_CLOSE ( res, twice.to_mat(), epsilon ); 68 68 69 sq mat2 = sqmat;69 sq_mat2 = sq_mat; 70 70 mat B = randu ( sz, sz ); 71 sq mat2.mult_sym ( B );71 sq_mat2.mult_sym ( B ); 72 72 res = ( B * A ) * B.T(); 73 CHECK_CLOSE ( res, sq mat2.to_mat(), epsilon );73 CHECK_CLOSE ( res, sq_mat2.to_mat(), epsilon ); 74 74 75 75 mat C = randu ( sz, sz - 1 ); 76 76 TMatrix CAC ( sz - 1 ); 77 sq mat.mult_sym_t ( C, CAC );77 sq_mat.mult_sym_t ( C, CAC ); 78 78 res = ( C.T() * A ) * C; 79 79 CHECK_CLOSE ( res, CAC.to_mat(), epsilon ); 80 80 81 sq mat2 = sqmat;82 sq mat2.mult_sym_t ( B );81 sq_mat2 = sq_mat; 82 sq_mat2.mult_sym_t ( B ); 83 83 res = ( B.T() * A ) * B; 84 CHECK_CLOSE ( res, sq mat2.to_mat(), epsilon );84 CHECK_CLOSE ( res, sq_mat2.to_mat(), epsilon ); 85 85 } 86 86