Changeset 141
- Timestamp:
- 08/18/08 14:28:08 (16 years ago)
- Files:
-
- 10 modified
Legend:
- Unmodified
- Added
- Removed
-
bdm/estim/arx.cpp
r115 r141 75 75 ivec ARX::structure_est ( egiw est0 ) { 76 76 ivec ind=linspace ( 1,rv.count()-1 ); 77 double tmp =egiw_bestbelow ( est, est0, est.lognc()- est0.lognc(), ind );77 egiw_bestbelow ( est, est0, est.lognc()- est0.lognc(), ind ); 78 78 return ind; 79 79 } -
bdm/estim/ekf_templ.h
r120 r141 30 30 31 31 32 #endif EKF_TEMP_H32 #endif //EKF_TEMP_H -
bdm/estim/libKF.cpp
r83 r141 141 141 142 142 // if ( !qr ( preA,Q,postA ) ) it_warning ( "QR in kalman unstable!" ); 143 if ( !qr ( preA,postA ) ) it_warning ( "QR in kalman unstable!" );143 if ( !qr ( preA,postA ) ) {it_warning ( "QR in kalman unstable!" );} 144 144 145 145 ( _Ry._Ch() ) =postA ( 0,dimy-1, 0,dimy-1 ); … … 204 204 205 205 // if ( !qr ( preA,Q,postA ) ) it_warning ( "QR in kalman unstable!" ); 206 if ( !qr ( preA,postA ) ) it_warning ( "QR in kalman unstable!" );206 if ( !qr ( preA,postA ) ) {it_warning ( "QR in kalman unstable!" );} 207 207 208 208 ( _Ry._Ch() ) =postA ( 0,dimy-1, 0,dimy-1 ); -
bdm/estim/libPF.h
r129 r141 108 108 // 109 109 110 if ( n>10000 ) it_error ( "increase 10000 here!" );110 if ( n>10000 ) {it_error ( "increase 10000 here!" );} 111 111 112 112 for ( int i=0;i<n;i++ ) { -
bdm/itpp_ext.cpp
r98 r141 90 90 91 91 if (!R_FINITE(a) || !R_FINITE(scale) || a < 0.0 || scale <= 0.0) 92 it_error("Gamma_RNG wrong parameters");92 {it_error("Gamma_RNG wrong parameters");} 93 93 94 94 if (a < 1.) { /* GS algorithm for parameters a < 1 */ -
bdm/math/libDC.cpp
r101 r141 117 117 118 118 void ldmat::inv( ldmat &Inv ) const { 119 int dim = D.length();120 119 Inv.clear(); //Inv = zero in LD 121 120 mat U = ltuinv( L ); -
bdm/stat/emix.cpp
r124 r141 7 7 int i; 8 8 for ( i=0;i<w.length();i++ ) { 9 epdf* Mp=Coms0 ( i );10 9 it_assert_debug ( rv.equal ( Coms0 ( i )->_rv() ),"RVs do not match!" ); 11 10 } -
bdm/stat/emix.h
r124 r141 30 30 31 31 */ 32 class emix : public epdf { 33 protected: 34 //! weights of the components 35 vec w; 36 //! Component (epdfs) 37 Array<epdf*> Coms; 38 public: 39 //!Default constructor 40 emix ( RV &rv ) : epdf ( rv ) {}; 41 //! Set weights \c w and components \c R 42 void set_parameters ( const vec &w, const Array<epdf*> &Coms ); 32 class emix : public epdf 33 { 34 protected: 35 //! weights of the components 36 vec w; 37 //! Component (epdfs) 38 Array<epdf*> Coms; 39 public: 40 //!Default constructor 41 emix ( RV &rv ) : epdf ( rv ) {}; 42 //! Set weights \c w and components \c R 43 void set_parameters ( const vec &w, const Array<epdf*> &Coms ); 43 44 44 vec sample() const; 45 vec mean() const { 46 int i; vec mu=zeros ( rv.count() ); 47 for ( i=0;i<w.length();i++ ) {mu+=w ( i ) *Coms ( i )->mean(); } 48 return mu; 49 } 50 double evalpdflog ( const vec &val ) const { 51 int i; 52 double sum=0.0; 53 for ( i=0;i<w.length();i++ ) {sum+=w ( i ) *Coms ( i )->evalpdflog ( val );} 54 return log ( sum ); 55 }; 45 vec sample() const; 46 vec mean() const 47 { 48 int i; vec mu=zeros ( rv.count() ); 49 for ( i=0;i<w.length();i++ ) {mu+=w ( i ) *Coms ( i )->mean(); } 50 return mu; 51 } 52 double evalpdflog ( const vec &val ) const 53 { 54 int i; 55 double sum=0.0; 56 for ( i=0;i<w.length();i++ ) {sum+=w ( i ) *Coms ( i )->evalpdflog ( val );} 57 return log ( sum ); 58 }; 56 59 57 60 //Access methods 58 //! returns a pointer to the internal mean value. Use with Care!59 vec& _w() {return w;}61 //! returns a pointer to the internal mean value. Use with Care! 62 vec& _w() {return w;} 60 63 }; 61 64 … … 64 67 65 68 */ 66 class eprod: public epdf { 67 protected: 68 Array<epdf*> epdfs; 69 Array<mpdf*> mpdfs; 70 public: 69 class eprod: public epdf 70 { 71 protected: 72 Array<epdf*> epdfs; 73 Array<mpdf*> mpdfs; 74 public: 71 75 72 76 … … 76 80 77 81 */ 78 class mmix : public mpdf { 79 protected: 80 //! Component (epdfs) 81 Array<mpdf*> Coms; 82 //!Internal epdf 83 emix Epdf; 84 public: 85 //!Default constructor 86 mmix ( RV &rv, RV &rvc ) : mpdf ( rv, rvc ), Epdf ( rv ) {ep=&Epdf;}; 87 //! Set weights \c w and components \c R 88 void set_parameters ( const vec &w, const Array<mpdf*> &Coms ) { 89 Array<epdf*> Eps ( Coms.length()); 82 class mmix : public mpdf 83 { 84 protected: 85 //! Component (epdfs) 86 Array<mpdf*> Coms; 87 //!Internal epdf 88 emix Epdf; 89 public: 90 //!Default constructor 91 mmix ( RV &rv, RV &rvc ) : mpdf ( rv, rvc ), Epdf ( rv ) {ep=&Epdf;}; 92 //! Set weights \c w and components \c R 93 void set_parameters ( const vec &w, const Array<mpdf*> &Coms ) 94 { 95 Array<epdf*> Eps ( Coms.length() ); 90 96 91 for ( int i=0;i<Coms.length();i++ ) {mpdf* Ci=Coms(i); 92 Eps ( i ) =& ( Coms ( i )->_epdf() );} 93 Epdf.set_parameters ( w,Eps ); 94 }; 97 for ( int i=0;i<Coms.length();i++ ) 98 { 99 Eps ( i ) =& ( Coms ( i )->_epdf() ); 100 } 101 Epdf.set_parameters ( w,Eps ); 102 }; 95 103 96 void condition ( const vec &cond ) { 97 for ( int i=0;i<Coms.length();i++ ) {Coms ( i )->condition ( cond );} 98 }; 104 void condition ( const vec &cond ) 105 { 106 for ( int i=0;i<Coms.length();i++ ) {Coms ( i )->condition ( cond );} 107 }; 99 108 }; 100 109 #endif //MX_H -
tests/CMakeLists.txt
r134 r141 32 32 add_executable (blas_test blas_test.cpp) 33 33 target_link_libraries (blas_test itpp) 34 35 add_executable (struct_test struct_test.cpp)36 target_link_libraries (struct_test itpp)37 38 add_executable (linefit2_c linefit2_c.cpp)39 target_link_libraries (linefit2_c ${BdmLibs})40 34 41 35 add_executable (test0 test0.cpp) -
tests/blas_test.cpp
r126 r141 59 59 60 60 tt.tic(); 61 for ( int i =0;i<10;i++ ) {C = matmul ( A,B );}61 for ( int ii=0;ii<10;ii++ ) {C = matmul ( A,B );} 62 62 exec_times ( i ) =tt.toc(); 63 63 64 64 tt.tic(); 65 for ( int i =0;i<10;i++ ) {C = A*B;}65 for ( int ii=0;ii<10;ii++ ) {C = A*B;} 66 66 exec_times_b ( i ) =tt.toc(); 67 67 68 68 C = zeros(n,n); 69 69 tt.tic(); 70 for ( int i =0;i<10;i++ ) { matmul2(n,A._data(),B._data(),C._data());}70 for ( int ii=0;ii<10;ii++ ) { matmul2(n,A._data(),B._data(),C._data());} 71 71 exec_times_c ( i ) =tt.toc(); 72 72 }