Changeset 178 for bdm/stat/emix.h
- Timestamp:
- 10/15/08 19:04:09 (16 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
bdm/stat/emix.h
r176 r178 36 36 //! Component (epdfs) 37 37 Array<epdf*> Coms; 38 //!Flag if owning Coms 39 bool destroyComs; 38 40 public: 39 41 //!Default constructor 40 emix ( RV &rv ) : epdf ( rv ) {};41 //! Set weights \c w and components \c R42 void set_parameters ( const vec &w, const Array<epdf*> &Coms );42 emix (const RV &rv ) : epdf ( rv ) {}; 43 //! Set weights \c w and components \c Coms , Coms are not copied! 44 void set_parameters ( const vec &w, const Array<epdf*> &Coms, bool copy=true ); 43 45 44 46 vec sample() const; … … 58 60 //! returns a pointer to the internal mean value. Use with Care! 59 61 vec& _w() {return w;} 62 virtual ~emix(){if (destroyComs){for(int i=0;i<Coms.length();i++){delete Coms(i);}}} 63 //! Auxiliary function for taking ownership of the Coms() 64 void ownComs(){destroyComs=true;} 60 65 }; 61 66 … … 102 107 ll = 0; 103 108 for ( int i = ( n - 1 );i >= 0;i-- ) { 104 if ( rvcinds ( i ).length() > 0) {105 condi = zeros ( rvcsinrv .length() + rvcinds.length() );109 if (( rvcinds ( i ).length() > 0 )||( rvcsinrv ( i ).length() > 0 )) { 110 condi = zeros ( rvcsinrv(i).length() + rvcinds(i).length() ); 106 111 // copy data in condition 107 112 set_subvector ( condi,rvcinds ( i ), cond ); 108 113 // copy data in already generated sample 109 set_subvector ( condi,rv csinrv ( i ), smp);114 set_subvector ( condi,rvinrvcs ( i ), get_vec(smp,rvcsinrv(i)) ); 110 115 111 116 mpdfs ( i )->condition ( condi );